切换root用户
debian 系统用
su -
在弹出的提示中,输入 root
用户密码 , 即进入 root 用户终端
ubuntu 系统用
sudo -i
在弹出的提示中,输入 当前
用户的密码 , 即进入 root 用户终端
安装基础软件
安装软件
apt install sudo vim curl wget -y
启用root 远程登陆
编辑 sshd 配置文件
vim /etc/ssh/sshd_config
修改或添加内容
#PermitRootLogin prohibit-password
修改为
PermitRootLogin yes
修改或添加内容
#PasswordAuthentication yes
修改为
PasswordAuthentication yes
应用并生效
ubuntu22.10
systemctl restart ssh.service
其他系统
systemctl restart sshd.service
或者使用快捷命令
cat >> /etc/ssh/sshd_config << EOF
PermitRootLogin yes
PasswordAuthentication yes
EOF
systemctl restart sshd