sshportcoreos

can't change the sshd's prot in CoreOS


System release: CoreOS 2135.5.0
Kernel: 4.19.50-coreos-r1
System install way: vmware

When I change the port in the sshd.service,it displays:

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

Solution

  • In coreos /usr is designed to be a read-only file system, Remounting /usr is theoretically feasible, but is not officially recommended

    You can refer to this

    I use the following command to solve this problem

    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