ubuntu22.04开启root用户登录

1、在 Ubuntu 中,通常不推荐使用 root > 用户来执行日常任务,因为这可能会导致系统安全性降低。然而,如果你确实需要这样做,你可以按照以下步骤操作:

打开终端。

  1. 设置 root 用户的密码。在终端中输入以下命令并按 Enter 键:
    sudo passwd root

然后,你需要输入你的当前用户密码以获取sudo权限,接着你将被提示输入新的 root 密码。输入你想要设置的密码,然后再次输入以确认。

  1. 启用 root 用户。输入以下命令并按 Enter 键:
    sudo passwd -u root

这将解锁 root 用户,允许其登录。

3.修改/etc/ssh/sshd_config

sudo vim /etc/ssh/sshd_config #用管理员的权限进行修改这个只读文件

permitRootLogin prohibit-password 替换成 PermitRootLogin yes

然后wq! 强制保存退出

重启服务

4.保存修改,重启ssh服务

service ssh restart

相关推荐
晚风吹长发7 小时前
Docker基础——Docker Network(网络详解)
linux·运维·网络·ubuntu·docker·容器
Sisphusssss10 小时前
香橙派5plus GPIO
linux·python·ubuntu
半句唐诗18 小时前
Ubuntu 离线安装 OpenSpec CLI、CodeGraph CLI 与相关工具实战笔记
ubuntu·arcgis
如若12319 小时前
Ubuntu 无 sudo 安装花生壳并实现 SSH 内网穿透:Conda 环境部署、冲突排查与自动启动
linux·运维·ubuntu·ssh·内网穿透
Better Bench1 天前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
LSG_Dawn2 天前
XBOX360 kinect + ROS2_humble
ubuntu·深度相机
jing.wang_20252 天前
NVIDIA CUDA C++编程环境搭建--Windows + Ubuntu 22.04
c++·windows·ubuntu·gpu算力
黑白园2 天前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
想你依然心痛3 天前
从监控数据到告警管理:Prometheus与Alertmanager部署实战
ubuntu·prometheus·内网穿透·系统监控·cpolar·告警管理
黑白园3 天前
解决服务器拒绝连接导致ubuntu镜像无法下载问题 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/
ubuntu