Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to login to a Debian server using ssh.exe from Cygwin. I've generated an RSA key and appended it to the authorized_keys file.

Debian is OK, because I was able to use the RSA key using PuTTY to login there. However when I try to login with ssh.exe it says that the password is incorrect. I can't access the ./ssh/ folder from Cygwin.

Update: As I suspected, adding -vvvv shows the following:

debug1: could not open key file '/home/steve/.ssh/id_rsa': Permission denied

The file is there and I can view C:\cygwin\home\steve\.ssh\id_rsa by my file manager.

Update 2:

ls -lA ~/
drwx------+ 1 steve None         0 фев 27 13:20 .ssh

$ ls -l ./.ssh/
ls: невозможно открыть каталог ./.ssh/: Permission denied

How can I fix this?

share|improve this question
2  
The fact that you cannot access the directory ~/.ssh is not normal. I would like to see the output of ls -lA ~/ and of ls -l ~/.ssh/. –  enzotib Aug 9 '13 at 10:38
    
What are the permissions on that file? Please add the output of the commands that enzotib suggests. –  Mat Aug 10 '13 at 13:40
    
I've added info on permissions. –  stiv Aug 10 '13 at 16:46
    
Are you logged in as steve? –  paraxor Aug 10 '13 at 23:03
    
Does cygwin even have its own permissions layer? This might just be a problem with the NTFS permissions... –  derobert Aug 12 '13 at 17:46
add comment

1 Answer 1

up vote 0 down vote accepted

Which .ssh folder can you not access? (You won't be able to see from Cygwin it is on Ubuntu, however you should be able to see it on Ubuntu, from Ubuntu, if that is where it resides). If you generated the RSA key with puttygen, it will not work with Cygwin's ssh.exe because they use different formats for their key file (putty uses a file with extension .ppk which is of a different format).

You can load this ppk file in puttygen and then use Conversions -> Export OpenSSH key to save it in the correct format that ssh.exe can use. If you want to load that key file in Cygwin from your Windows disk drive, you can use the /cygdrive directory to get access to your C: drive (or other drive) where the key resides. You can then use -i to point ssh to it. The other alternative is to use ssh-keygen to generate a new key for Cygwin and add that to Ubuntu's authorized_keys.

Also Cygwin ssh defaults to the username you logged into windows with as the username for the remote host unless you specify it as part of ssh's command arguments.

If it still doesn't work then I'd check what ssh was doing by adding -vvv to your command arguments.

ssh -vvvv -i /cygdrive/c/path/to/my/id_dsa -l username host.address.here

(obviously replacing the correct arguments for -i -l and host.address.here).

share|improve this answer
    
I've added some debug info. I'd really appreciate if you take a look. –  stiv Aug 10 '13 at 7:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.