无法在 CoreOS 中更改 sshd 的 prot

can't change the sshd's prot in 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

您正在使用的文件系统当前处于 Read-only 模式。将文件系统重新挂载到 read-write 应该可以解决问题。您将需要拥有 root 权限:

$ mount -o remount,rw /

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

在coreos中/usr被设计为read-only文件系统,重装/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