LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2011, 10:55 PM   #1
mspatil0037
LQ Newbie
 
Registered: Mar 2010
Location: Bangalore,India
Distribution: Red Hat
Posts: 26

Rep: Reputation: 0
SSH without password for multiple server login


Hi,

I use to ssh to different machines in my office. Every time it asks me for password. How do i prevent ssh from asking password every time or is there any way of exporting password every time i login to different machine.?
 
Old 07-28-2011, 11:08 PM   #2
roger_heslop
Member
 
Registered: Oct 2009
Location: Leander, TX
Distribution: Fedora 20
Posts: 97

Rep: Reputation: 35
You can do passwordless login if you create an RSA pubic key on the management system, and place that key in the ~/.ssh/authorized_keys file on the host you want to manage:

Create the key:

Code:
ssh-keygen -t rsa
Move the key:

Code:
scp .ssh/id_rsa.pub 192.168.1.2:/home/username/.ssh
Copy the key (On the desired host for passwordless login):

Code:
cat .ssh/rsa.pub >> .ssh/authorized_keys
Let me know if you have any questions.
 
Old 07-29-2011, 12:10 AM   #3
mspatil0037
LQ Newbie
 
Registered: Mar 2010
Location: Bangalore,India
Distribution: Red Hat
Posts: 26

Original Poster
Rep: Reputation: 0
I guess this will work for only one remote host. Do I need to do the same process for every new machine i login?
 
Old 07-29-2011, 12:21 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You can use the same key to login to multiple hosts. The public key just needs to be in your ~/.ssh/authorized_keys file on each host you want to login on.
 
Old 07-29-2011, 12:22 AM   #5
mspatil0037
LQ Newbie
 
Registered: Mar 2010
Location: Bangalore,India
Distribution: Red Hat
Posts: 26

Original Poster
Rep: Reputation: 0
1.on the local host I keyed in ssh-keygen -t rsa which generated the keys.

2.I moved the key using scp .ssh/id_rsa.pub remoethost:/home/username/.ssh

3.On the remote host, I keyed in cat .ssh/rsa.pub >> .ssh/authorized_keys. I am getting this message .ssh/authorized_keys: No such file or directory.
 
Old 07-29-2011, 12:26 AM   #6
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
It's id_rsa.pub, not rsa.pub. But it seems that the authorized_keys file doesn't exist yet (this is the normal case if you have not set up any keys). Simply do "cp .ssh/id_rsa.pub .ssh/suthorized_keys" to create the file with your public key in it.
 
Old 07-29-2011, 01:41 AM   #7
mspatil0037
LQ Newbie
 
Registered: Mar 2010
Location: Bangalore,India
Distribution: Red Hat
Posts: 26

Original Poster
Rep: Reputation: 0
Its working now..Thanks so much.

How to get back to the default mode of ssh? I mean , ssh must prompt for password
 
Old 07-29-2011, 08:33 AM   #8
roger_heslop
Member
 
Registered: Oct 2009
Location: Leander, TX
Distribution: Fedora 20
Posts: 97

Rep: Reputation: 35
SSH will look first for an entry in the remote hosts authorized_keys files for authentication, and if that fails attempt to authenticate using the username's log in.

To go back to having the system request a password, open that file, and delete the entry that allows your management system to log in. If this is the first time you've set something like this up, there should be only one entry to delete, so the following would work as well:

Code:
cp /dev/null > ~/.ssh/authorized_keys
or...

Code:
rm ~/.ssh/authorized_keys
 
Old 08-01-2011, 01:48 AM   #9
mspatil0037
LQ Newbie
 
Registered: Mar 2010
Location: Bangalore,India
Distribution: Red Hat
Posts: 26

Original Poster
Rep: Reputation: 0
Thanks you for your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to login ssh server without password attenuation saravanakumar Linux - Server 1 07-25-2011 04:54 PM
[SOLVED] Configuring the Linux server to login to Windows server without password using SSH srajeshkumar Linux - Server 2 03-09-2011 10:49 PM
[SOLVED] SSH login problem for additional users after password-less login setup uncle-c Linux - Newbie 3 02-10-2010 01:51 PM
ssh login without password centos1986 Linux - Security 1 05-01-2007 08:45 AM
SSH Login with no password mperkel Linux - Security 3 01-16-2007 09:42 AM


All times are GMT -5. The time now is 04:37 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration