在 Debian 上开启 SSH 服务,通常步骤如下:
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
sudo systemctl status ssh
看到 active (running) 就说明已经开启了。
如果开了 ufw 防火墙,需要放行 22 端口:
sudo ufw allow ssh
# 或
sudo ufw allow 22
ip a
然后用其他机器:
ssh 用户名@服务器IP
sshd:sudo systemctl start sshd
sudo systemctl restart ssh
/etc/ssh/sshd_config
如果你是在 云服务器 / 虚拟机 / 局域网 环境,或者遇到连不上,可以告诉我具体情况。