在 Ubuntu 上开启 SSH 功能,通常步骤如下:
Ubuntu 默认一般没有安装 openssh-server:
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
sudo systemctl status ssh
看到 active (running) 说明已正常运行。
sudo ufw allow ssh
# 或
sudo ufw allow 22
ip a
# 或
hostname -I
从其他机器连接:
ssh 用户名@Ubuntu的IP
/etc/ssh/sshd_config如果你是在 云服务器 / WSL / 虚拟机 环境,可以告诉我,我可以给对应具体说明。