LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 04-05-2008, 06:55 PM   #1
babag
Member
 
Registered: Aug 2003
Posts: 419

Rep: Reputation: 31
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
 
Old 04-05-2008, 07:01 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
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
 
Old 04-05-2008, 07:24 PM   #3
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
It's dead easy to do:
Code:
ssh-keygen -t rsa -f mykeypair
Just press return when it asks for a password.
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
scp mykey.pub <username@server>:.ssh/authorized_keys
mv mykey ~/.ssh/id_rsa
mv mykey.pub ~/.ssh/id_rsa.pub
There's plenty of tutorials on the web if you get stick. Google is your friend. It's the same for all distros.
Good luck.
 
Old 04-05-2008, 07:32 PM   #4
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
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.
 
Old 04-06-2008, 02:25 PM   #5
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
thanks all! exactly what i needed.

BabaG
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh login without password centos1986 Linux - Security 1 05-01-2007 07:45 AM
SSH Login with no password mperkel Linux - Security 3 01-16-2007 08:42 AM
ssh login without password for only one user zhjim Linux - Server 4 11-21-2006 04:31 PM
script detecting ssh password request jp9999 Linux - Software 1 05-02-2006 02:46 PM
how to deny password login in the ssh? please u2911 Linux - Security 4 07-02-2004 12:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration