SSH keys in the SCS environment

The step by step instructions for the impatient.

Ssh (Secure shell) provides a means for secure connection to a remote machine by encrypting some of the information transmitted (e.g. the password). It also allows the creation of keys. Keys are a mechanism which allows you to login without having to type a password. In this sense, it's more secure to use keys. However, you need to be careful with where you leave your keys, as you do with your home's and car's.

The concept is similar to actual keys: if the keys and the door lock match, you can get in. If not, bad luck. How does it work? you create the keys on your local machine (which we are going to call "MyDesktop"). This will generate two files with random numbers: one of them containing information that will remain in MyDesktop, and the other which you will copy to the remote machine (which we will call "OurServer"). When you try to login from MyDesktop to OurServer, OurServer sends back the key you previously copied. If MyDesktop decodes the key and matches it against the information it has, then it sends the positive result to OurServer, which happily accepts the connection. If the match doesn't happen, OurServer gives you an alternative before denying the connection: you can type your password. Notice that in the first case you logged in without a need to type your password. You just typed "ssh OurServer", and the machines, transparently to you, exchanged information.

The issue, however, about the SCS nevironment is that home directories are usually on AFS (Andrew File System). If your home directory is on AFS, you need Kerberos authentication to access files. When you login with keys, the shell does not do any Kerberos authentication. Therefore, AFS will not let you access the directory $HOME/.ssh, and your login will fail. Moreover, since permissions on AFS are set on a directory basis and not on a file basis, and AFS ignores the Unix permissions, your directory .ssh may be accessible from outside if you are not careful enough. In any case, considering that you need to avoid the need for Kerberos authentication, you have two possible solutions: ask facilities to change your home directory to a local directory on the machine you want to login to (not the easiest solution); or you can create a folder .ssh in a local directory in a networked machine and create a link from your AFS home directory to that folder. The latter has the advantage (or disadvantage, depends on you) that you will be able to login to any machine without typing your password, provided that your home directory is on AFS.

Now you are thinking, "I'm tired of typing passwords, how can I do that?". CMU's current servers use ssh protocol 2. Some old servers still use ssh protocol 1 (RSA1). This will affect the key creation and the files you need to copy.

Anyway, here you are the step by step instructions:

You should now be able to login from MyDesktop to OurServer without typing a password.


Evandro B. Gouvêa
Last modified: Tue Oct 23 11:05:35 Eastern Daylight Time 2007