无法在CoreOS中更改sshd的属性

时间:2019-07-10 02:55:09

标签: ssh port coreos

系统版本:CoreOS 2135.5.0
内核:4.19.50-coreos-r1
系统安装方式:vmware

当我在sshd.service中更改端口时,它显示:

CoreOS-234 ssh # echo "Port 10000" >> /usr/share/ssh/sshd_config ;systemctl mask sshd.socket;systemctl enable sshd.service;systemctl restart  sshd.service

-bash: /usr/share/ssh/sshd_config: Read-only file system

有人可以帮我吗?

2 个答案:

答案 0 :(得分:0)

您正在使用的文件系统当前处于只读模式。将文件系统重新安装为可读写可解决此问题。您将需要具有root特权:

$ mount -o remount,rw /

有时,文件系统将以只读模式运行的原因是由于内核问题,因此,系统中可能还有其他问题需要调试。关于内核错误,您可能需要查看以下链接:https://unix.stackexchange.com/questions/436483/is-remounting-from-read-only-to-read-write-potentially-dangerous?rq=1

答案 1 :(得分:0)

在coreos中,/ usr被设计为只读文件系统,从理论上讲,重新挂载/ usr是可行的,但官方不建议

You can refer to this

我使用以下命令解决此问题

sudo sed -i '$a\Port=60022' /etc/ssh/sshd_config && \
sudo systemctl mask sshd.socket && \
sudo systemctl enable sshd.service && \
sudo systemctl start sshd.service