ssh hostname returns “Bad owner or permissions on ~/.ssh/config” (chmod 600 not working with MingW)
Solution 1
The issue was not to chmod
but chown
the file since cygwin
said my account wasn't the owner of the file. Confusion was again in that MINGW32
said I was the owner... Wish I had the skills to fix the chmod
and chown
in their project.
Solution 2
Actually for me none of the above worked.
The inspiration came from http://yifanpeng.blogspot.co.uk/2013/03/cygwin-ssh-tip.html
On linux you would just ensure the owner and group on your .ssh
dir is jujhar
by executing chown jujhar.jujhar ~/.ssh
where ~
is a shortcut for /home/jujhar
The only difference with cygwin on windows is that the jujhar
group is not created and you have to use the Users
group. Once that is set then you can chmod
correctly.
In my case I did the following and it works great
chown jujhar.Users /cygdrive/c/Users/jujhar/.ssh
chmod 0700 /cygdrive/c/Users/jujhar/.ssh
chmod 0600 /cygdrive/c/Users/jujhar/.ssh/*
NB My home directory for my username jujhar
is set to /cygdrive/c/Users/jujhar
(you can change it in /etc/passwd
. This makes backups and stuff easier for me (Crashplan ftw.)
Solution 3
Important note if your Windows is not in US English: the "users" group's name is locale-dependant. If your Windows is in Spanish, you'll have to change the files' ownership with chown $USER:Usuarios *
Related videos on Youtube
user29600
Updated on September 18, 2022Comments
-
user29600 over 1 year
This question is a near duplicate of Robert's question but after trying
chmod 600 ~/.ssh/config
I still have the same error.I've tried using
cygwin
andMINGW32
to do thechmod 600
.ls -la
returns-rw-------
oncygwin
and returns-rw-r--r--
onMINGW32
.By these results,
cygwin
says that it does have the proper permissions and therefore shouldn't be complaining when Issh hostname
, however bothcygwin
andMINGW32
complain when trying to ssh.This is similar to the issues I had with gitosis where this article said that I needed to switch over the
ssh.exe
files fromcygwin
togit
(MINGW32) which did actually fix the issue at the time. However, this fix doesn't seem to be working any more asMINGW32
isn'tchmod
ing properly.Any ideas?
-
Icebreaker almost 13 yearsMake sure the permissions are reasonably restrictive on all ancestor directories as well. For example, chmod 700 ~/.ssh and chmod 755 ~.
-