Setting Up SSH For No PasswordPeter Cvar, April 2006 This setup will allow you to log in to another account without having to provide the password.
This Tech Tip concentrates on SSH2, the second version of SSH. Don't use the first version any longer; it contains security bugs. Also, older versions of the second version might contain security bugs. Check with
If you can't find any of the SSH commands (
If you can't find a package suitable for your version, refer to the OpenSSH web site for the source, and then download, unpack, read the
In your server1:~/.ssh> ssh-keygen -t dsaThis creates id_dsa and id_dsa.pub in ~/.ssh.
If you want to enable remote connections that don't require a password, do not enter a passphrase. If you do enter a non-empty passphrase, when connecting to the remote server you will be asked for the passphrase instead of the password!
Append the public key to the file server1:~/.ssh> cat id_dsa.pub >> authorized_keys2
Don't worry if
Sun provides SSH in the Solaris OS starting from release 9, but uses SSH version 1 naming conventions. On the Solaris 9 OS, use the Now you should already be able to make a secure connection to your own machine, using this account, without having to provide a password.
Check permissions on your keys and refer to the man page. The
Copy your public key into server1:~/.ssh> scp id_dsa.pub server2:/your/remote/home/.ssh/server1.key.pub user@server2's password: id_dsa.pub 100% |*****************************| 236 00:00
Do the same thing for the remote key; copy it into your local server1:~/.ssh> scp server2:/your/remote/home/.ssh/id_dsa.pub ./server2.key.pub user@server2's password: id_dsa.pub 100% |*****************************| 236 00:00
On both servers, append the key from the other server to the file server1:~/.ssh> cat server2.key.pub >> authorized_keys2 And also for the second server: user@server2:~/.ssh> cat server1.key.pub >> authorized_keys2 That's it! Try to connect to the remote server now. It should do something similar to this: server1:~/.ssh> ssh server2 Last login: Mon Nov 21 16:23:26 2005 from :0 user@server2>
If things don't work, check the logs, possibly in Nov 21 10:24:41 ocean sshd[26446]: Authentication refused: bad ownership or modes for file /home/name/.ssh/authorized_keys Most likely, the problem is too many permissions.
By default, the Solaris OS doesn't allow
Also on the Solaris OS, make sure that you use the file
A typical entry in ssh-dss FGKJTJUVFMAAACBAOk6t1czfh7nV9sb0syK1CebJ/6nwLb9OPLr0LcqcE1J8GYbePDVfg\ erUIJSpn1UDmujH8emiLR30y9BQN9JU+XmEc5Ab1rrwHWEMahWgZANgEmQt4FmgBNfv+BFGn/tRmd\ cHX07mauLbAB3Uf8sIHJHK57659KHJL8473JUHFRT39uBxv1HAAAAFQCoRN6CXBpYH5VjOzbO4Euj\ cTdXkQAAAIAMUxdVJ6CAFE54a3mdvVO0OWOzhvS8w0iCBbZMdDbzqxmqEexAh8PHaZM5oMN1VzhO9\ HX7qxjlZCqffzZOwepOMPWv5pWabtEf5hfWa4xb4QkLqZC42JhHtUr7KUUnJwkvaoLwKjOcWERAQY\ 5anvABcUE/h5CbOS4fh0M21lPdnAAAAIBaZuS3a2qdrtYX/fJ72Bp1kAt9qDq7apMOnA0m4Vireiu\ t433qchgBrvfYBpNyuJ0OXMVLciingYkfAs7a6nl8avMmW3LM37Gkgt06LP+hfdgetsdhsyHAd7dl\ SS9VV1wDloE1fwkJSjtSLbdeJSliu3liu43uztu4u34zutNMI7== name@email.comLine broken at the '\' for readability.
If you can't connect to a remote server using a particular user name on that server, check that the appropriate key is in your
Use
The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource. Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
| |||