LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 11-19-2012, 04:38 PM   #1
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Rep: Reputation: 0
Creating rsa keys for ssh - Having trouble- Still asks for password


Hello Friends,

I'm am trying to create rsa keys for ssh to use with rsync. I want to be able to have my nas connect to my three servers automatically without asking me for a password everytime and pull data for backups. I have tried all the tutorials and I am still lost. I still get a password prompt everytime. What am I doing wrong?

Thanks
 
Old 11-19-2012, 04:47 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Tell us in detail what you've done so far and show
Code:
ls -l ~/.ssh/
 
Old 11-19-2012, 05:28 PM   #3
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Original Poster
Rep: Reputation: 0
Okay. I generated the rsa key pair on nas2, which is the server that I want to connect to my other three servers to grab the data for backup.

I used this command:
Code:
ssh-keygen -t rsa -f /root/.ssh/4rsync/rsa_key4backup
Then I used this command to copy the .pub key to the target machine:

Code:
scp ~/.ssh/rsa_key4backup.pub dns1:/root/.ssh/rsa_key4backup.pub
and I entered the password for the target server.

Next I ssh into target (dns1) to register the key:
Code:
ssh dns1
entered the password
cat rsa_key4backup.pub >> authorized_keys
Here is the ls -l ~/.ssh/ output for target (dns1):
Code:
root@dns1:~# ls -l ~/.ssh/
total 64
-rw------- 1 root root 2637 2012-11-19 16:28 authorized_keys
-rw------- 1 root root  391 2012-11-19 16:04 authorized_keys2
-rw-r--r-- 1 root root  395 2011-11-07 14:52 commserv.jab
-rw------- 1 root root  668 2005-12-07 09:59 id_dsa
-rw-r--r-- 1 root root  610 2005-12-07 10:00 id_dsa.pub
-rw------- 1 root root  883 2005-12-07 09:59 id_rsa
-rw------- 1 root root 1675 2012-09-20 17:19 id_rsa-new
-rw-r--r-- 1 root root  391 2012-09-20 17:19 id_rsa-new.pub
-rw-r--r-- 1 root root  230 2005-12-07 10:00 id_rsa.pub
-rw-r--r-- 1 root root 2456 2008-07-30 12:23 jab
-rw-r--r-- 1 root root 6501 2012-09-21 16:41 known_hosts
-rw-r--r-- 1 root root  223 2005-08-27 20:49 rsa_key.pub
-rw-r--r-- 1 root root  391 2012-11-19 16:02 rsa_key4backup.pub                          <<<<<<<<This is my .pub key from nas2]]]]]]]
-rw-r--r-- 1 root root  395 2008-07-30 12:54 serv_ssh_host_rsa_key.pub
-rw-r----- 1 root root  210 2011-11-07 15:50 uniserv.jab

Here is the ls -l ~/.ssh/ for nas2:

Code:
root@nas2:~#ls -l ~/.ssh/
drwxr-xr-x    2 root     root         1024 Nov 19 15:33 4rsync/                      <<<<<the rsa key pairs are in this dir]]]
-rw-r--r--    1 root     root          601 Oct  8 09:09 authorized_keys
-rw-r--r--    1 root     root         1116 Jul 12 10:44 authorized_keys2
-rw-------    1 root     root          668 Oct  8 09:09 id_dsa
-rw-r--r--    1 root     root         1699 Nov 19 15:52 known_hosts
 
Old 11-19-2012, 05:37 PM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
When you do "ssh" from nas1 it expects keys in certain filenames (including ".ssh/id_dsa") but not the ones in the subdirectory where you have put the keys. You'll need to use "-i" to tell it what private key file to use.
 
1 members found this post helpful.
Old 11-19-2012, 06:31 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
ssh -i  /root/.ssh/4rsync/rsa_key4backup  user@host
 
2 members found this post helpful.
Old 11-20-2012, 08:05 AM   #6
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Original Poster
Rep: Reputation: 0
@linosaurusroot and @Habitual, thank you both very much. I now have a clear understanding of how this works and I have successfully accomplished my task.

Thanks again!!!
 
Old 11-20-2012, 08:18 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
You are Very Welcome.
Glad it worked out!
 
  


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 RSA keys location 10110111 Linux - Software 1 09-13-2011 05:38 PM
SSH Private RSA keys keysorsoze Linux - Security 4 11-22-2006 10:44 PM
Trouble creating and using rsa keys for vsftpd on FedoraCore4. hunterhunter Linux - Software 2 03-27-2006 08:20 AM
SSH Forcing users to use RSA keys XaViaR Linux - Security 8 07-07-2005 12:42 AM
RSA Keys for SSH XaViaR Linux - General 4 07-02-2005 09:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:24 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
Open Source Consulting | Domain Registration