Ubuntu server setup (VPS):修订间差异

Riguz​(留言 | 贡献)
Riguz​(留言 | 贡献)
第35行: 第35行:


# vim /etc/ssh/sshd_config
# vim /etc/ssh/sshd_config
Port 54194
PermitRootLogin no
PermitRootLogin no
PasswordAuthentication no
PasswordAuthentication no
第41行: 第42行:
service ssh restart
service ssh restart
ssh -p 50000 ubuntu@12.98.23.12
ssh -p 50000 ubuntu@12.98.23.12
</syntaxhighlight>
Note: for Ubuntu 24.04+ with systemd socket
<syntaxhighlight lang="bash">
# To change the port
sudo vim /lib/systemd/system/ssh.socket
[Socket]
ListenStream=0.0.0.0:54194
ListenStream=[::]:54194
sudo systemctl daemon-reload
sudo systemctl stop ssh.socket
sudo systemctl restart ssh
netstat -anp | grep 54194
(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp        0      0 0.0.0.0:54194          0.0.0.0:*              LISTEN      -
tcp6      0      0 :::54194                :::*                    LISTEN      -
</syntaxhighlight>
</syntaxhighlight>