Ssh is no longer using ~/.ssh/config

ssh

I cannot ssh anything I was able to. After a little digging I found out that it's not reading ssh config from my home directory.

$ ssh -xvvv server
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
(...)

When on an identical computer of a friend, where everything works it looks like this:

$ ssh -xvvv server
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/kuba/.ssh/config
(...)

It worked earlier and I am not aware of anything I could have done to cause this problem. How could this happen, and how to fix it?

In documentation link pointed by tike it states that

Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not accessible by others.

My permissions are:

$ ls -la ~/.ssh
total 80
drwx------+ 42 kuba  1029   1428 Jul  1 16:33 ..
-rwx------   1 kuba  1029   1528 May 15 13:07 config
(...)

I think the problem might be with a confusion about home directory. When I force the local config file it starts to work, and then suddenly starts reading from /nas/kuba

$ ssh -xvvvF ~/.ssh/config server
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/kuba/.ssh/config
debug1: /Users/kuba/.ssh/config line 1: Applying options for *
debug1: /Users/kuba/.ssh/config line 39: Applying options for bio
debug2: ssh_connect: needpriv 0
debug1: Connecting to XXXX [YYYY.YYY.YYY.YYY] port 22.
debug1: Connection established.
debug1: identity file /nas/kuba/.ssh/id_dsa type -1
                      ^^^^^^^^^^

But my home dir seems to be set ok:

$ cd ~; pwd
/Users/kuba
$ echo $HOME
/Users/kuba

Best Answer

You seem to be trapped between user specific vs global ssh_config.

Please check the permission settings of your user's configuration file (~/.ssh/config) and your system-wide configuration file (/etc/ssh/ssh_config) to understand in more details.

You can read more about this here. Practically, all files under your user based .ssh directory should be on 600, and the config file should be on 644. You can set this with the following commands in your home directory:

chmod 600 ~/.ssh/* 
chmod 644 ~/.ssh/config