1828222 Members
1935 Online
109975 Solutions
New Discussion

Re: ssh without password

 
SOLVED
Go to solution
ITSD-ACCS
Frequent Advisor

ssh without password

Hi,

I have a normal a/c called uat, and need to access a remote system machine called guest@machine1. They gave me a key and I have put into uat 's HOME under .ssh.

1. Let's say I am the client. Should I rename the given key as id_rsa or id_dsa or authorized_keys ? I am confused.

2. Since I am using an a/c called 'uat', but I want to sftp some files from there using 'guest' a/c. How can it be password less ?

THank you very much.
10 REPLIES 10
Senthil Prabu.S_1
Trusted Contributor
Solution

Re: ssh without password

Hi,
you must have same users on both the servers to have password-less authentication, ie using public keys. Also, you must rename the public key of the client as authorised_keys on the server machine.

Refer the following doc for setting up public key authentication between two unix machines.
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Patrick Terlisten
Honored Contributor

Re: ssh without password

Hello,

you can overwrite the actual username with the option "-u" for ssh. If you are logged in with uat, and you want to connect a remote maschine with the login name "guest", use the command

ssh -u guest

Regards,
Patrick
Best regards,
Patrick
ITSD-ACCS
Frequent Advisor

Re: ssh without password

There is no -u option. I used -l. The point is, I want to do

Client Server
machine 1 ---> machine 2
(a/c : uat) (a/c: guest)

Now, I have a key generated from machine2, and have it pasted in /.ssh/authorized_keys in machine1. What else do I need to make it passwordless ?
Alexander Chuzhoy
Honored Contributor

Re: ssh without password

generaly that's it.

append the content of $HOME/.ssh/id_dsa.pub file to remotehost:/home/desired_user's_homedir/.ssh/authorized_keys file
and that's it you should be able to login as the desired_user without password on remotehost.
also make sure you have the correct permissions set on .ssh/*
id_dsa shoud have 600
all other files in .ssh can be 644
ITSD-ACCS
Frequent Advisor

Re: ssh without password

To be specify, you mean gen key in the client and then have it pasted in server's authorized_keys ? Even if different user ?
Alexander Chuzhoy
Honored Contributor

Re: ssh without password

if you place/append the content of your user's .ssh/id_dsa.pub in .ssh/autorized_keys of any user on remote system (let's call him test1),then you'll be able to ssh/sftp from your user to test1 on remote system.
Thus
ssh -l test1 remotesystem will login without password
Senthil Prabu.S_1
Trusted Contributor

Re: ssh without password

Hi,
Create the ssh keys on the client, copy the id_rsa.pub to the guest home directory on the server, ie /home/guest/.ssh. Then execute these commands,

#chmod 0700 /home/guest/.ssh
#mv /home/guest/.ssh/id_rsa.pub /home/guest/.ssh/authorized_keys
#chmod 0600 /home/guest/.ssh/authorised_keys


Then execute from client machine
ssh guest@server

This should work, otherwise, execute ssh command with debugging option as
#ssh --v guest@server and post the output.
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Senthil Prabu.S_1
Trusted Contributor

Re: ssh without password

And also, plz assign points to the replies. This will help you to get replies soon.
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Mike Stroyan
Honored Contributor

Re: ssh without password

If you always want the uat account to use the guest account on machine2, you can specify
that as a default in ~uat/.ssh/config with
lines like-

Host machine2
User guest

This is documented in "man ssh_config".
Patrick Terlisten
Honored Contributor

Re: ssh without password

Hello,

mea maxima culpa. I mean "ssh -l", not "ssh -u". My fault.

Regards,
Patrick
Best regards,
Patrick