remove password request during scripted ssh login?
can someone please explain or point me to a tutorial
on how to use rsa keys to eliminate the remote computer's request for a password during an ssh login? i want to use a script to log in and therefore would like to eliminate this password request. something mandriva-specific in the form of a step-by-step walkthrough would be very helpful. i am able to login now via ssh but would love to be able to incorporate this into a script. using 2007.1 (spring) here. thanks, BabaG |
Not distro specific but shows the creation of the passphrase, correct permissions on the certain files and directories, and other info. You will need to run the ssh-add command or something similiar and enter the passphrase before it work headless why. Not sure of how to specify the passphrase automatically. I think it would be a bit of security issue if the setup would rquire the passphrase to be present in a plain script to work this way. Maybe someone knows a good way for that.
http://www.suso.org/docs/shell/ssh.sdf Brian |
It's dead easy to do:
Code:
ssh-keygen -t rsa -f mykeypair It'll create two files, mykeypair (which is your private key, so keep it safe), and mykeypair.pub (the public key that everyone can see). Append the mykeypair.pub file to the <userhomedir>/.ssh/authorized_keys file on the server (if it doesn't exist just create it). Then move your private key (in this case 'mykeypair' to your home/.ssh/id_rsa file, and move the mykeypair.pub file to home/.ssh/id_rsa.pub. That should be job done. Try and log into the server. ssh will (should) handle to key exchange automatically. So the complete steps will be: Code:
ssh-keygen -t rsa -f mykey Good luck. |
Once you have generated your key, use ssh-copy-id to transfer your public key to the remote server - it is simpler than editing the .authorized_keys file.
|
thanks all! exactly what i needed.
BabaG |
All times are GMT -5. The time now is 06:46 AM. |