LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-22-2005, 01:01 AM   #1
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Rep: Reputation: 15
ssh no password prompt


hi all

i want to set up a cronjob that rsync's file on our web server
so i need to setup ssh so that there is no login prompt

i'm having issues though
this is what i've tried

m1 is the computer that needs to login and sync files
m2 is the computer with the files

root@m1 -> ssh-keygen -t dsa, no passphrase
root@m1 -> scp id_dsa.pub remoteuser@m2:~/.ssh/authorized_keys

still asks for password after that

when i try

root@m1 -> ssh-keygen -t dsa, no passphrase
root@m1 -> scp id_dsa.pub root@m2:~/.ssh/authorized_keys

there is no problem, exactly the same procedure, same files

i've tried it with three different computers and it always works with root@m2
but never when it is user@m2

anyone have any ideas
thanks
dave

Last edited by dtra; 05-22-2005 at 02:18 AM.
 
Old 05-22-2005, 01:54 AM   #2
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Re: ssh no password prompt

Quote:
Originally posted by dtra
hi all

i want to set up a cronjob that rsync's file on our web server
so i need to setup ssh so that there is no login prompt

i'm having issues though
this is what i've tried

m1 is the computer that needs to login and sync files
m2 is the computer with the files

root@m1 -> ssh-keygen -t dsa, no passphrase
root@m1 -> scp id_dsa.pub remoteuser@m2:/.ssh/authorized_keys

still asks for password after that

when i try

root@m1 -> ssh-keygen -t dsa, no passphrase
root@m1 -> scp id_dsa.pub root@m2:/.ssh/authorized_keys

there is no problem, exactly the same procedure, same files

i've tried it with three different computers and it always works with root@m2
but never when it is user@m2

anyone have any ideas
thanks
dave
You should copy to userdirectory
Code:
scp id_dsa.pub remoteuser@m2:~/.ssh/authorized_keys
Make sure authorized_keys owner by remoteuser. @ server:
Code:
chown remoteuser remoteuser_home/.ssh/authorized_keys 
chmod 600 remoteuser_home/.ssh/authorized_keys
Good luck,
Giang Hu
 
Old 05-22-2005, 02:17 AM   #3
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Original Poster
Rep: Reputation: 15
hi thanks for your reply
the authorized_keys files was copied to the user's .ssh directory
i just typed in rush format

and the authorized_keys file is owned by remoteuser
 
Old 05-22-2005, 02:28 AM   #4
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Quote:
Originally posted by dtra
hi thanks for your reply
the authorized_keys files was copied to the user's .ssh directory
i just typed in rush format

and the authorized_keys file is owned by remoteuser
Your remoteuser@server had difference uid with remoteuser@client, I think. Try out:

Code:
ssh remoteuser@server 
Password:

cat ~/.ssh/authorized_keys
What does it say? (Dont tell me "Permission denied")
 
Old 05-22-2005, 02:42 AM   #5
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Original Poster
Rep: Reputation: 15
is this what you expected?
logged in as root@m1
shell root@m1] ssh remoteuser@m2
password:

shell remoteuser@m2]cat ~/.ssh/authorized_keys

it prints out the public key exactly the same as what it is on m1
 
Old 05-22-2005, 03:22 AM   #6
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Quote:
Originally posted by dtra
is this what you expected?
logged in as root@m1
shell root@m1] ssh remoteuser@m2
password:

shell remoteuser@m2]cat ~/.ssh/authorized_keys

it prints out the public key exactly the same as what it is on m1
Its seemed really strange . I had tested (with normal user) on my network and everything go right :-o

Code:
# login as localuser 
[localuser@knoppix ~] ssh-keygen -t dsa
[localuser@knoppix ~] ssh remoteuser@gentoo mkdir ~/.ssh
Password:
[localuser@knoppix ~] scp id_dsa.pub remoteuser@gentoo:~/.ssh/authorized_keys
[localuser@knoppix ~] ssh remoteuser@gentoo ls 
[localuser@knoppix ~]
Could you try again? (remove remoteuser .ssh dir before try)
Giang Hu

Last edited by freegianghu; 05-22-2005 at 03:23 AM.
 
Old 05-22-2005, 04:45 AM   #7
MiscGeek
Member
 
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189

Rep: Reputation: 30
Check your directory permissions for the remote user's ~/.ssh directory. SSH is very picky about permissions. It should have only drwx.
 
Old 05-22-2005, 05:52 AM   #8
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Original Poster
Rep: Reputation: 15
hey thanks guys

miscgeek, you were on the money, .ssh directory permissions were the one
it was 755 for the remote .ssh directory
changed it to 700 and voila

thanks again
 
Old 05-22-2005, 07:44 AM   #9
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Smile

Quote:
Originally posted by dtra
hey thanks guys

miscgeek, you were on the money, .ssh directory permissions were the one
it was 755 for the remote .ssh directory
changed it to 700 and voila

thanks again
Congratulation, but have you ever tried change back permission to 755?
 
Old 05-25-2005, 02:08 PM   #10
vineet.k
LQ Newbie
 
Registered: Apr 2005
Distribution: RedHat
Posts: 17

Rep: Reputation: 1
Try this out

) Type the following script in a file named "sshlogin".

#!/usr/bin/expect --

set timeout 180
set machine [lindex $argv 0]
set username [lindex $agrc 1]
set password [lindex $argv 2]
spawn ssh $username@$machine
expect "$username@$machine's password: "
send "$password\n"
interact


2) Give executable permission to the file.

chmod 711 sshlogin

3) put this file in /bin folder

4) Now for a user "abc" wants to login to a machine node1 using password "xyz", the command is :
sshlogin node1 abc xyz

I think this should solve your problem

__________________
Vin.K
--------
touch /proc/kcore
 
  


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
Does not prompt for password ssharma_02 Linux - Security 6 06-02-2005 02:51 AM
ssh password prompt delay long while chaze Linux - Networking 1 04-14-2005 11:03 PM
ssh without the password prompt markehb Linux - Networking 27 03-25-2004 12:12 PM
remote command over ssh, password prompt linowes Linux - General 2 10-27-2002 09:22 PM
no password prompt stroh78 Linux - General 3 01-02-2001 10:22 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration