Sunday, 18 August 2019

windows - "Bad owner or permissions" error using Cygwin's ssh.exe


I'm trying to use ssh.exe in Cygwin (in Windows 7). I copied a config file into c:\cygwin\home\[USERNAME]\.ssh. When I run ssh (for example, ssh -vT git@bitbucket.org) I get the following error:



OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011 Bad owner or permissions on /home/[USERNAME]/.ssh/config



How do I get ssh to read my configuration file?



Answer



Check the permissions of the config file using Cygwin's ls command:


> c:\cygwin\bin\ls.exe -la c:\cygwin\home\[USERNAME]\.ssh

It will probably be something like this:


total 5
drwxrwxrwt+ 1 Administrators None 0 Oct 20 17:02 .
drwxr-xr-x+ 1 [USERNAME] None 0 Oct 19 08:15 ..
-rw------- 1 Administrators None 57 Oct 20 16:58 config

The config file needs to belong to [USERNAME]. Try this:


> c:\cygwin\bin\chown.exe [USERNAME] c:\cygwin\home\[USERNAME]\.ssh\config

ls -la should now show the correct owner. If that still doesn't work, try resetting the mode (permissions):


> c:\cygwin\bin\chmod.exe 700 c:\cygwin\home\[USERNAME]\.ssh\config

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...