Linux Reset Root Password: A Comprehensive Guide

图床——以红帽系RockyLinux9.5安装部署轻量图库EasyImage+PicGo+Typora实践操作教程 摘要:本文详细讲解了在红帽系Rocky9.5安装部署轻量图库EasyImage+PicGo+Typora实践操作保姆级教程。1、介绍了图床是什么?有啥用?图床的分类(免费公共图床、免费开源自建图床、商业化图床)。2、详细讲解了使用源码安装部署EasyImage图床步骤(安装部署图床所需的指定版本PHP与nginx环境,EasyImage图床的部署上线,自签名域名配置)。3、详细讲解了使用docker安装部署EasyImage图床的操作步骤。4、Typora+PicGo对接EasyImage图床实现图片的上传 阅读详情

In the Linux operating system, the root user is a superuser with unrestricted access to all files, commands, and system settings. There are various scenarios where you might need to reset the root password, such as forgetting the current password or wanting to enhance security. This blog will provide a detailed overview of the fundamental concepts, usage methods, common practices, and best practices for resetting the root password in Linux.

Discover more

Linux & Unix

Computer Drives & Storage

scripting

Table of Contents#

  1. Fundamental Concepts
  2. Usage Methods
  3. Common Practices
  4. Best Practices
  5. Conclusion
  6. References

Discover more

Programming

open-source

Linux Kernel

Fundamental Concepts#

Root User#

The root user in Linux is similar to the administrator user in Windows. It has the highest level of privileges and can perform any operation on the system. However, due to its high-level access, it should be used with caution.

Password Storage#

In Linux, user passwords are stored in the /etc/shadow file. This file is protected and can only be accessed by the root user. When you reset the root password, you are essentially modifying the corresponding entry in this file.

Discover more

Operating Systems

Linux kernel

Software

Usage Methods#

Resetting Root Password in GRUB Menu (for most Linux distributions)#

  1. Reboot the system: Start by rebooting your Linux machine. When the GRUB menu appears during the boot process, quickly press any key to stop the automatic boot.
  2. Select the kernel: Highlight the kernel you want to boot with using the arrow keys.
  3. Edit the kernel parameters: Press the e key to edit the kernel parameters.
  4. Locate the line starting with linux or linux16: Look for the line that begins with linux or linux16 in the text editor that appears.
  5. Modify the kernel parameters: Add rw init=/sysroot/bin/sh at the end of the line. This changes the root filesystem to read-write mode and starts a shell instead of the normal init process.
  6. Boot into the modified environment: Press Ctrl + x to boot into the modified environment.
  7. Chroot into the system: Run the following command to chroot into the system:
chroot /sysroot
  1. Reset the root password: Use the passwd command to reset the root password:
passwd root

You will be prompted to enter the new password twice. 9. Update SELinux context (if applicable): If your system uses SELinux, run the following command:

touch /.autorelabel
  1. Exit the chroot environment and reboot: Exit the chroot environment by typing exit and then reboot the system:
reboot

Using Single User Mode#

  1. Reboot the system: Reboot your Linux machine.
  2. Access the GRUB menu: When the GRUB menu appears, press e to edit the kernel parameters.
  3. Modify the kernel parameters: Locate the line starting with linux or linux16 and add single or 1 at the end of the line. This boots the system into single-user mode.
  4. Boot into single-user mode: Press Ctrl + x to boot into single-user mode.
  5. Reset the root password: Once you are in single-user mode, use the passwd command to reset the root password:
passwd root

Discover more

Scripting

Scripting Languages

Open Source

Common Practices#

  • Backup important data: Before attempting to reset the root password, it is a good practice to back up important data on the system. This ensures that you do not lose any critical information in case something goes wrong during the process.
  • Keep a record of the new password: Write down the new root password in a secure location. Avoid using easily guessable passwords.

Best Practices#

  • Use strong passwords: When resetting the root password, use a strong password that includes a combination of uppercase and lowercase letters, numbers, and special characters.
  • Limit root access: Try to limit the use of the root account as much as possible. Instead, use a regular user account for day-to-day tasks and use sudo when administrative privileges are required.
  • Regularly update passwords: Periodically update the root password to enhance security.

Discover more

Linux

Linux & Unix

Software

Conclusion#

Resetting the root password in Linux is a crucial task that can be accomplished through various methods. By understanding the fundamental concepts, usage methods, common practices, and best practices, you can ensure that you can reset the root password safely and effectively. Remember to follow the security guidelines to protect your system from unauthorized access.

References#

This blog provides a detailed guide on resetting the root password in Linux. By following the steps and best practices outlined here, you can successfully reset the root password and maintain the security of your Linux system.

QNX Neutrino 进程间通信编程之Message-passing/Pulse Interprocess Communication(IPC,进程间通信)在QNX Neutrino从一个嵌入式实时系统向一个全面的POSIX系统转变起着至关重要的作用。IPC是将在内核中提供各种服务的进程内聚在一起的粘合剂。在QNX中,消息传递是IPC的主要形式,也提供了其他的形式,除非有特殊的说明,否则这些形式也都是基于本地消息传递而实现的。本篇幅主要讲解Message-passing和Pulse。 阅读详情

相关推荐

基于EKF的UWB-IMU融合定位系统在农业机器人中的抗干扰优化与Matlab仿真

本文探讨了基于扩展卡尔曼滤波(EKF)的UWB-IMU传感器融合定位系统在农业机器人中的应用。通过Matlab仿真验证,该系统有效解决了农业环境中UWB信号遮挡和IMU累积误差问题,实现了厘米级高精度定位,显著提升了机器人在复杂场景下的抗干扰能力和导航可靠性。

numpy6sculptor的博客 630

工作中使用到的单词(软件开发)

1.エイリアス   alias 别名 powershell使用 get-help 命令时,会得到与此命令 相关(别名)的命令 2.プロキシ proxy 代 理 3.プロモート   promote 促进,提升   开发的系统新功能上线发布,有时会使用到这个词,比如 STプロモート 还有使用リリース这个词的。比如STリリース。个人认为两者含义相同。 4.見逃し み................................................................

sun0322 6万+

分析以太网帧结构_100G以太网接口调试初体验

是的,标题没有多敲一个“0”,明人不说暗话,就是在FPGA上实现100G以太网接口设计。正好参与了实验室某项目中的100G接口的调试,早想写个专栏文章了,由于调试过程中发现了一些硬件问题,导致迟迟没有往前推进,现在问题解决了之后可以简单分享一下100G以太网接口的调试初体验了~(好像DDR4读写测试系列文章还没搞完 )这篇初体验暂时不分多个章节了,基本设计流程与之前发布的“10G以太网接口”系列文...

weixin_39574050的博客 1613

企业网站上线后如何做好服务器安全巡检?从 Linux、Nginx、MySQL 到数据备份

网站上线之后,安全巡检要按层做:Linux 看系统和账户,Nginx 看版本、配置和日志,PHP 看版本和组件,MySQL 看权限、状态和备份,网站程序看代码、请求和文件,补丁按判断、备份、验证的步骤走,备份要做恢复测试,运行指标和日志要长期盯着。建站解决的是怎么交付,运维解决的是能不能一直稳稳地用。前者一次完成,后者没有终点。

hzxpaipai的博客 313

海康工业相机 Could not find module MvCameraControl.dll(已解决)

【代码】海康摄像机 Could not find module MvCameraControl.dll(已解决)

hmbbpdx的博客 2239

避坑指南:C#用S7NetPlus读写西门子PLC字符串(String/WString)的完整方案

本文详细解析了C#通过S7NetPlus读写西门子PLC字符串(String/WString)的完整方案,包括内存布局、编码差异和字节序处理等关键技术细节。提供了实战优化的代码示例和常见问题排查指南,帮助开发者避免乱码、截断等常见陷阱,提升工业自动化项目的开发效率。

weixin_32956805的博客 336

用 AI 手搓海康视频播放插件:NVR 在 Linux 网页下实时播放、回放

信创版的一般是统信、麒麟,ARM的芯片,但海康平台的NVR在 Linux 平台下,插件是 LocalServices.exe的,因此无法预览、回放、截图、录像功能。因此做了这个项目,通过本地拉取流,转格式后再进行视频输出。具有NVR、通道管理功能。在统信、麒麟系统下测试正常。然后做了安装版做为附件,如果想更简单点,直接单独下载 hikvision-monitor-preadmin-20261203.tar.gz 即可。项目地址:https://gitcode.com/jiecy/hik_monitor。

28

BurpSuite实战:5分钟搞定DVWA的CSRF漏洞测试(附详细截图)

本文详细介绍了如何使用BurpSuite在DVWA靶场中进行CSRF漏洞测试,包括环境配置、攻击原理剖析、分步攻击演示及企业级防御方案。通过实战案例,帮助读者深入理解CSRF漏洞的危害与防护措施,提升Web应用安全防护能力。

weixin_30879169的博客 498

Linux 上怎么用 SSH 连接远程服务器

本文介绍如何在 Linux 上使用 OpenSSH 连接远程服务器,涵盖客户端检查、连接命令、端口指定、主机密钥验证、密码与公钥认证、常用配置和故障排查。文章强调核对服务器身份、保护私钥与凭据,并在获准范围内操作,避免因忽略警告或盲目修改配置带来风险。

momodfg123的博客 355

Android15音频进阶之音效配置与解析(一百三十一)

本篇目的:Android15音频进阶之音效配置与解析。

Android系统攻城狮 2155

RAG的“诊断艺术”:从测试集结果倒追根源,精准优化检索、排序与生成

当RAG应用给出一个糟糕的答案时,开发者的第一反应可能是:“我的Prompt写得不够好?”这种基于“感觉”的猜测往往是低效的。通过构建一个包含黄金上下文信息的测试集,我们可以像一位经验丰富的医生一样,对RAG系统的各个“器官”进行独立的“健康检查”。一个用于RAG诊断的测试集,除了问题和答案,还需要包含中间环节的“黄金标准”。如果你的RAG流程包含Re-ranker,那么在评估完初期的召回后,需要单独评估Re-ranker的效果。RAG的优化是一个持续的过程,应该形成一个闭环。的文档块尽可能多地召回。

kakaZhui的博客 156

Linux 7.4 最新的 TCP_ROCCET 拥塞控制解析

新玩意儿来了,但也不算新,我已经出版了很多类似的版本,没混社区不开大会没人看罢了,大差不差,这个算法能提交社区并入主线也算是印证了我的一些想法的合理性。视角看,仅以吞吐量最大化为单目标,约束边界宽松,导致最优解落在了大时延区域,这属可行域定义错误导致,但在下载时代,这不是问题。的稳态为极限环,前文说过不再赘述,深缓冲区下,反馈滞后和阶跃,系统相位裕度低,易进入大幅极限环振荡,振荡幅度与缓冲区大小。总之,就是时代变了,从带宽攸关转到了时延攸关,所有不利于低时延,低抖动的,一律要改,这话题我也说过多次,

TCP/IP 197

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

open() 为什么常返回 3?从一个数字读懂 Linux 文件 I/O

本文从文件打开机制入手,解析了C标准库fopen()与Linux系统调用open()的差异,揭示了FILE*与文件描述符fd的关系。通过实例说明相对路径解析、文件模式控制、读写位置管理及文件描述符表结构,最终阐释“一切皆文件”的核心思想:统一接口下,普通文件、设备、管道等均以struct file和file_operations实现差异化操作,体现Linux I/O设计的统一性与灵活性。

2401_89031099的博客 311

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Linux conntrack:连接跟踪表与只读排查

1. 用途 conntrack 是查询 Netfilter 连接跟踪状态的工具。可观察协议、原始方向和应答方向的地址端口,辅助排查状态防火墙与 NAT;它不是需要单独启动的网络服务。 2. 准备运行环境 在 UOS/Debian 实验机使用具备相应网络管理权限的账号。软件包通常为 conntrack。先确认系统和命令存在;容器内还需确认所在网络命名空间。 若

weixin_44524357的博客 244

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Linux/MCU上的USB主从实现

✅ USB 有分层的规范定义,但是。

qq_28576837的博客 340

8.4M,我把 Linux 变成了一块“磁盘”

不装 FTP、不建网盘、不开第二套系统账号:CHFS + DESK 的 WebDAV 实测

DeskUI 289

【Linux】41:网络层原理

本文系统阐述了网络层核心功能——路由与IP协议。重点介绍IP协议头结构、网段划分与CIDR机制,解析私有与公网IP地址差异及NAT技术原理。深入讲解路由表生成机制,涵盖直连、静态、动态路由(RIP、OSPF、BGP)算法特点与选路规则,揭示复杂网络中路径选择的实现逻辑,为理解互联网数据传输奠定基础。

qq_62473190的博客 198

从零入门计算机网络系列(三十一):Linux I/O 多路复用详解——select 工作原理与底层机制

本文围绕Linux I/O多路复用机制中的select展开,从核心定位入手,逐步分析可读、可写事件的判断原理,以及select的完整工作流程。通过函数原型,详细拆解nfds、fd_set、timeout等核心参数,讲清fd_set位图的输入输出特性、重复初始化问题和常用辅助宏。随后结合TCP Echo Server实战,演示select如何同时监视监听套接字和多个客户端连接。最后分析select在fd数量、用户态与内核态数据拷贝、内核遍历等方面的局限,为后续学习poll和epoll做好铺垫。

沫漓的博客 488

Linux磁盘100%满了怎么办?定位大文件+清理+防复发实战

服务器磁盘100%导致网站打不开、数据库写不进数据?这篇按 df、df -i、du、find、lsof 的顺序一步步定位,讲清删了文件空间不释放的坑,再给 journald、Docker 日志和 logrotate 的封顶办法。

274

深入 Linux 设备管理:从认识设备到挂载、移出与磁盘管理的完整实战指南

本文系统讲解Linux设备管理核心知识,从“一切皆文件”理念出发,详解 /dev 目录下块设备与字符设备的区分,掌握 lsblk、blkid、fdisk 等常用命令查看设备信息。重点解析挂载与卸载流程,对比Ubuntu、CentOS等主流发行版在设备命名与管理上的差异,并强调使用UUID或标签实现稳定挂载。内容涵盖udev动态管理、热插拔机制及内核日志排查,帮助用户实现透明、可控的设备操作。

一只懂代码不懂人情世故的源码爱好猿 337

Linux C/C++网络编程:基于libpcap手写一个BPF网络抓包器

libpcap是Tcpdump社区维护的跨平台网络数据包捕获库,提供统一C接口实现网卡或离线文件抓包,支持BPF过滤以降低CPU开销。其核心功能包括网卡枚举、实时抓包、BPF过滤、链路层帧解析与pcap文件读写。广泛应用于协议分析、网络运维、安全审计及IDS/IPS系统中。通过pcap_open_live、pcap_compile、pcap_setfilter等接口可实现高效抓包与定制化处理,结合pcap_loop、pcap_dispatch等机制适用于事件循环场景。开发时需注意链路类型(DLT)判断与资源

程序员与背包客_CoderZ 407

Linux GPIO 技术详解

GPIO 场景对应其他篇知识扩展控制器 cansleep同步篇:原子上下文铁律gpio-keys 线程化 IRQ中断篇:hardirq/线程化/ONESHOTgpio-ranges 与 debugfs 对账内存篇:I/O 映射、寄存器访问gpio-sim/注入测试调试篇:可复现性与故障注入pca953x(I2C 后端)I2C 篇:client 驱动、regmap、三态判定。

2401_86843901的博客 464

Linux - Linux 服务器选择

Linux - Linux 服务器选择

weixin_52173250的博客 179

C++map 和 set 的使用

map 和 set 的使用

2601_96348813的博客 183

RustRover Linux 平台深度评测与实战指南

RustRover 2026.1 在 Linux 平台实现非商业免费,本文基于 Ubuntu、Fedora、Debian 多发行版实测其安装、编译调试性能、智能补全与重构准确性。评测显示其在 X11 环境下兼容性良好,内存占用稳定,调试器与 cargo-nextest 集成提升效率;但 Wayland 支持仍不成熟,低配设备(8GB 内存)易出现卡顿。相较 VS Code + rust-analyzer,RustRover 在大型项目整合度与代码分析精度上更具优势,适合中大型 Rust 项目开发者。

独坐一隅,凝神遐想,是种幸福! —— 独隅 434
上一篇: HCE、openEuler和EulerOS镜像的主要区别是什么?
下一篇: smbpasswd Command in Linux
allway2
博客等级 码龄16年 6724粉丝 8053原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值