前置信息
- 垃圾Ubuntu系统默认ssh、vim都没有!!! 已踩坑cnm
- Ubuntu处于sb安全机制要求,默认是禁用root直接登录的
1、修改root密码
plain
sudo -sH (可以让一个具有sudo权限的普通用户进入 root)
然后就是passwd ,修改密码成root (忽略密码校验 !!忽略校验!!)

2、切换到root后安装vim、ssh
plain
apt install vim
apt install openssh-server #被连接
apt install openssh-client #连接三方
并设置开机自启ssh
systemctl enable ssh
3、禁用防火墙
plain
ufw disable
4、开启远程连接
plain
vim /etc/ssh/sshd_config #踩坑 记住一定得是sshd_config,而不是ssh_config !! 先安装openssh-server ,才有
PermitRootLogin yes # 文件中添加或no 改成yes ,我这里是直接没有这一行,我添加
systemctl restart sshd
5、禁用GUI图形
plain
systemctl disable gdm3 # GNOME桌面(Ubuntu默认)
6、踩坑!!
plain
vim /etc/ssh/sshd_config #踩坑 记住一定得是sshd_config,而不是ssh_config !!