Link to home
Start Free TrialLog in
Avatar of anuboggaram
anuboggaramFlag for India

asked on

ssh asking for password inspite of copying public key to destination server.

Hi,
There is cygwin configured on jenkins server (win-2012)and on application server. It was working from last 2 years and suddenly its not able to copy code from jenkins machine to application server.

When did SSH, its asking for password and a new was generated and copied to app server, the key value is seen in authorized_keys, still asking for password. Firewall is off on both server. Port 22 is opened. Cygwin service is also running. Tried without password also did not resolve the issue. Please help resolving the issue.

Command used to copy code:
unison -perms=0 -dontchmod=true -force "D:/sourcepath/" "D:/sourcepath/" "ssh://Administrator@host//cygdrive/c/inetpub/wwwroot/Rootfolder" -batch -terse -ignorearchives

Error :
Administrator@host's password :
ASKER CERTIFIED SOLUTION
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Connect_From_Test_Machine => Destination_Machine
1. At_Destination_Machine
In following command creating ~/.ssh/id_rsa without using password ( -N "" ) or you can use password also -N "requiredpassword"
if [ ! -d ~/.ssh ]
then
/bin/mkdir ~/.ssh
fi
/bin/chmod -R 700 ~/.ssh
/bin/echo "y" | /usr/bin/ssh-keygen -N "" -f ~/.ssh/id_rsa
/bin/cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
/bin/cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2

Open in new window

2. At_Test_Machine
if [ ! -d ~/.ssh ]
then
/bin/mkdir ~/.ssh
fi
/bin/chmod -R 700 ~/.ssh
cd ~/.ssh
sftp user@Destination_Machine
lcd ~/.ssh
cd ./.ssh
get authorized_keys
get authorized_keys2
quit

Open in new window


As informed by savone check the permissions in Test_Machine and Destination_Machine.
you could pass on the key explicitly by using the `-i /key/location` along with `ssh` command.
else just try to ssh again with -vvvv (verbose) and paste the logs here. it will make it easy for us to assist.