大网数据广告活动
服务器运维问答

ssh is no longer using ~/.ssh/config

· 52CE 我爱测

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…

问题原文

原帖链接 · Kuba · CC BY-SA 4.0

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

社区高分解答

原帖链接 · tike · CC BY-SA 3.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。