SSH connection issue

Hi Guys,

Asking your kind help to solve the issue

connecting to remote server via ssh
Purpose not to use password

Server A (Client) commands used

 
 mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''

copied the public key in server B (Server)

Commands used

 
mkdir -p $HOME/.ssh
cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
chmod 0600 $HOME/.ssh/authorized_keys2

Now used the below command for ssh

 
 ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa Server B

and found the below error

 
Permission denied (gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive)

I dont have the rights to change in config file

Please suggest how can I login without using password

Why did You use authorized_keys2 file on server side? Default sshd setting uses authorized_keys (without trailing "2"). Maybe that's the problem...

1 Like

If both the server is not having the same user then you need to specify the user in the ssh command eg:- ssh <remote user>@serverb

run with -v option, it might help.

--ahamed

1 Like

Thanks a lot both of you...its working fine now

---------- Post updated at 11:33 PM ---------- Previous update was at 07:24 AM ----------

Can anyone kindly give me the equivalent code in perl.Thanks a lot