root只有对/ etc / ssh / sshd_config的读权限?

我正在按照以下说明编辑我的/ etc / ssh / sshd_config文件,以在我的Synology NAS上正确设置git: http : //www.wonko.de/2010/04/set-up-git-on- synology-nas.html (步骤6)

但是,当我试图保存修改后的sshd_config文件以root身份login时,出现以下错误:

"/etc/ssh/sshd_config" File is read only 

当我input“ls -l / etc / ssh / sshd_config”时,我得到:

 --rw-r--r-- 1 root root 3745 May 27 06:32 /etc/ssh/sshd_config 

有谁知道我可以如何改变这些权限,所以他们是读/写根?

lsattr会给你这样的东西

 $:/etc/ssh# lsattr sshd_config s---ia------------- sshd_config 

从“男人聊天”

具有“a”属性集的文件只能以附加模式打开才能写入。 只有拥有CAP_LINUX_IMMUTABLE能力的超级用户或进程才能设置或清除该属性。

具有'i'属性的文件不能被修改:不能被删除或重命名,不能创build链接到这个文件,也没有数据可以被写入文件。 只有拥有CAP_LINUX_IMMUTABLE能力的超级用户或进程才能设置或清除该属性。

 chattr -ia sshd_config 

做这个工作

我相信布鲁诺所暗示的是可能不是根。 比较“who”命令和“id”输出的结果。

如果你根,你应该能够愉快地chmod写标志(u + w)(带着祝福):

  /etc/ssh/sshd_config Contains configuration data for sshd. This file should be writable by root only, but it is recommended (though not neces- sary) that it be world-readable. 

好的,我find了一个解决方法,但我不知道为什么我必须首先做(如果有人可以澄清这一点,这将是启发!)

我重置权限使用:

 chown -R root.users /etc/ssh/sshd_config 

而且我可以以root身份login后再次写入。