![]() |
|
Customer Support
How do I get ssh to authenticate me via public/private keypairs instead of by password?
Use ssh-keygen on your local system to generate public and private keys. If your local system runs Windows, you can use Cygwin's ssh-keygen program.There are two types of keys that can be created using ssh-keygen, DSA and RSA. Simply put, they are two different types of encryption. Because the construction of DSA was private in nature and RSA was not, many feel that RSA is a more secure standard because of the public scrutiny in the creation of it.
The method for creating either key is very similar.
The following method is to create SSH keys. It is important to hit ENTER twice when prompted for passphrase for the keys, so that no passphrase is generated (this is required for WinCVS users).
To create an RSA key use: ssh-keygen
To create a DSA key use: ssh-keygen -t dsa
The steps listed below are used to create a DSA key. The only differences between the creation of the keys are the output file (id_rsa.pub or id_dsa.pub) and the file stored on the remote server (authorized_keys2 for DSA and authorized_keys for RSA keys).
Here is a sample screencopy of what generating keys looks like:
$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /your/local/system/home
Your public key has been saved in /your/local/system/home
The key fingerprint is:
some:unique:hex:codes you@your.local.hostname
Now login to the remote system here and make sure in your home directory there is a subdirectory named: .ssh (include the period '.' before the 'ssh'). You may need to create this directory. To see the file, you will need to type:
ls -alThe .ssh directory should be chmod 700, which looks like this in the first column of a detailed file listing:
-rwx------If those are not the permissions on the .ssh dir, then set them by typing:
chmod 700 .sshNow take the id_dsa.pub (or id_rsa.pub) file (your public key) that you generated with ssh-keygen on your local system, and copy it to the .ssh directory on the remote system here, renaming the file authorized_keys2 (or authorized_keys for rsa).
You can copy it in various ways, such as screencopying the contents of the file on your local system and editting a new file on the remote system, pasting and saving. Or you could ftp the file to the remote system and then rename it. If your local system is some kind of unix, the easiest thing is to scp it, or use a combination of cat and ssh like this typed all on one line:
$ scp id_dsa.pub youruser@ftp.modwest.com:/.ssh/authorized_keys2
or this:
$ cat id_dsa.pub | ssh youruser@ftp.modwest.com 'cat - >> ~/.ssh/authorized_keys2'
Once it is uploaded to the remote system, the authorized_keys2 (authorized_keys) file should be chmod 600, which looks like this in the first column of a detailed file listing:
-rw-------If those are not the permissions on the authorized_keys2 (authorized_keys) file, then set them by typing:
chmod 600 /.ssh/authorized_keys2At this point you should be able to login to the remote system via ssh without being prompted for a password.
User-Contributed Notes |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
Related Questions:
What is a good SSH or Telnet program for me to use?
How do I change the timezone for my account?
Do you support SCP?
Can I use gcc or a compiler?
How do I run a script in a restricted shell?
How can I make Pico my default editor instead of Vi?
Do I get a shell with my account?
What if I need a certain program installed in my bin?
Can I have Emacs?
Can I have Eggdrop or run some other bot or daemon?
How can I kill off my processes on the shell server?
Do I get root access?
Browse Categories:Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales |
