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
(...)
Run Code Online (Sandbox Code Playgroud)
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
(...)
Run Code Online (Sandbox Code Playgroud)
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
(...)
Run Code Online (Sandbox Code Playgroud)
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
^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
But my home dir seems to be set ok:
$ cd ~; pwd
/Users/kuba
$ echo $HOME
/Users/kuba
Run Code Online (Sandbox Code Playgroud)
tik*_*ike 17
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
Run Code Online (Sandbox Code Playgroud)
检查权限
ls -lsd ~/.ssh
Run Code Online (Sandbox Code Playgroud)
和
ls -ls ~/.ssh/*
Run Code Online (Sandbox Code Playgroud)
如果权限不好,那么 ssh 客户端将不会尝试从中读取
归档时间: |
|
查看次数: |
53701 次 |
最近记录: |