ubuntu中ssh连接root用户

开启ssh服务

复制代码
#下载
sudo apt-get install openssh-server

#设为开机自启动
sudo systemctl enable ssh

配置ssh 远程root连接

复制代码
sudo nano /etc/ssh/sshd_config

修改

1.去掉Port 22 前面的注释 #

2.去掉 ListenAddress 0.0.0.0 前面的#

3.去掉PermitRootLogin prohibit-password 前面的#

修改为

PermitRootLogin yes

4.去掉PasswordAuthentication yes前面的#

重启SSH服务

修改配置后,需要重启SSH服务以使更改生效。

复制代码
sudo systemctl restart sshd

如果还是失败可能是root没有设置密码

复制代码
sudo passwd root
相关推荐
Johny_Zhao3 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行3 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux
埃博拉酱5 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code