Access Single User Mode (Reset Root Password)

Published on: Wed, Sep 17, 2014 at 12:52 pm EST

To reset the root password of your server, you will need to boot into single user mode.

Access the Manage section of your server in the customer portal and follow these steps. The option depends on the bootloader version on the machine:

CentOS 6

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. You will see a GRUB boot prompt telling you to press any key - you have only a few seconds to press a key to stop the automated booting process. (If you miss this prompt you will need to restart the VM again)
  3. At the GRUB prompt, type "a" to append to the boot command.
  4. Add the text "single" and press enter.
  5. System will boot and you will see the root prompt. Type "passwd" to change the root-password and then reboot again.

CentOS 7

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.
  3. You will see a GRUB boot prompt - press "e" to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  4. Find the kernel line (starts with "linux16"), change ro to rw init=/sysroot/bin/sh.
  5. Press CTRL-X or F10 to boot single user mode.
  6. Access the system with the command: chroot /sysroot.
  7. Run passwd to change the root password.
  8. Reboot the system: reboot -f.

Debian, Ubuntu

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.
  3. You will see a GRUB boot prompt - press "e" to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  4. Find the kernel line (starts with "linux /boot/") and add init="/bin/bash" at the end of the line (On CentOS 7, the line may start with linux16).
  5. Press CTRL-X or F10 to boot.
  6. System will boot and you will see the root prompt. Type "mount -rw -o remount /" and then "passwd" to change the root password and then reboot again.

FreeBSD

The boot menu has an option to boot into single-user mode. Press the key for single user mode (2). At the root prompt, type "passwd" to change the root password and then reboot again.

CoreOS

CoreOS by default uses SSH key authentication. On Vultr, a root user and password are created. If an SSH key is selected when creating the VPS, this SSH key can be used to login as user "core".

It is possible to reset the standard root login by executing "sudo passwd" as user "core". Login as "core" using the SSH key first.

If you lost your SSH key, then you can login as the "core" user by editing the grub loader. Follow these steps:

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. You will see a GRUB boot prompt - press "e" to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  3. At the end of the line that begins with "linux$" add " coreos.autologin=tty1" (no quotes).
  4. Press CTRL-X or F10 to boot. You will be logged in as "core" when the system boots.
  5. Remember to reboot your server after you have reset your login.

Windows Server 2012

See this guide for instructions on how to reset the administrator password on Windows Server 2012.

Access Single User Mode (Reset Root Password)--CentOS 修改root密码的更多相关文章

  1. CentOS修改用户密码方法

    CentOS修改用户密码方法 CentOS修改用户密码方法 1. 普通用户 a. 获取超级用户root权限 命令:su或者su -或者su - root b. passwd 用户名 2. 超级用户 a ...

  2. CentOS 修改用户密码

    CentOS 修改用户密码 1.普通用户 ①获取超级用户root权限 命令:su 或者 su- 或者 su -root ②输入命令: passwd 用户名 ③输入新密码 2.超级用户 ①打开syste ...

  3. RedHat/Centos修改root密码

    Linux主机忘记密码,只要你能接触物理主机都可以修改root密码的!   Redhat6.x 5.x  / Centos6.x  5.x 01.开机-空格/enter 02.e-编辑模式 CentO ...

  4. ansible非root用户批量修改root密码

    前言: 由于线上服务器密码长久没有更新,现领导要求批量更换密码.线上的之前部署过salt,但由于各种因素没有正常使用. 使用自动化工具批量修改的计划搁浅了,后来领导给了个python多线程修改密码脚本 ...

  5. centos修改mysql密码或者进入mysql后解决Access denied for user ''@'localhost' to database 'mysql错误

    原因是MySQL的密码有问题 用mysql匿名用户可以进入数据库,但是看不见mysql数据库. 解决办法:具体操作步骤:关闭mysql:# service mysqld stop然后:# mysqld ...

  6. CentOS修改root密码

    1.在系统启动时,按任意键中止启动 2.按E键修改系统启动文件 3.找到linux16开头的行,把整行ro后面内容删除,添加rd.break 4.Ctrl+X更改并重启 5.重新挂载/sysroot ...

  7. Proxmox Reset Root Password

    http://c-nergy.be/blog/?p=1777 Step 1 – Boot your Proxmox VE machine. In the boot menu screen, you s ...

  8. mysql forget root password

    http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password MySQL - ...

  9. mysql5.7.11修改root默认密码

    知道 MySQL 出了5.7了,并且网上说性能提高了一两倍,于是在虚拟机上安装了个 CentOS 7,在上面安装 MySQL 5.7 我使用的是 yum安装方式,要求虚拟机能够上网,因为它会在线下载安 ...

  10. MySQL 修改 root 密码命令

    安装好 MySQL 并成功启动 MySQL 服务后,可以通过以下方法修改root密码: ①用 mysqladmin.exe 操作.指令如下: cd C:\Program Files\MySQL Ser ...

随机推荐

  1. [前端] html和原生js实现鼠标拖动和触摸拖动以及点击后跟随鼠标移动

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. JAVA微服务分布式事务的几种实现方式

    基础理论 CAP理论 一致性(Consistency) :在分布式系统中所有的数据备份,在同一时刻都保持一致状态,如无法保证状态一致,直接返回错误: 可用性(Availability):在集群中一部分 ...

  3. Find The Multiple 题解

      Find The Multiple The long-lost Sunday is coming again, and the ACM Laboratory Elimination Competi ...

  4. 010 editor 文件指纹分析

    1.010 Editor  介绍 16进制编辑器,支持模板和脚本操作,010编辑器支持编辑的文件类型 https://www.sweetscape.com/010editor/repository/t ...

  5. 学习ASP.NET MVC 编程系列文章目录

    学习ASP.NET MVC(一)--我的第一个ASP.NET MVC应用程序 学习ASP.NET MVC(二)--我的第一个ASP.NET MVC 控制器 学习ASP.NET MVC(三)--我的第一 ...

  6. offline RL | D4RL:最常用的 offline 数据集之一

    pdf:https://arxiv.org/pdf/2004.07219.pdf html:https://ar5iv.labs.arxiv.org/html/2004.07219 GitHub:ht ...

  7. XAF新手入门 - 应用程序模型(Application Model)

    应用程序模型不仅是XAF的核心,它更是XAF的最大特色,它自动收集XAF项目中的信息,用于生成不同平台的UI.由于应用程序模型在XAF中的重要性,官方文档对它的介绍比较详细,大家可以直接阅读官方文档 ...

  8. idea editor tabs 标题头 多行显示,全部显示出来 (vscode也放一个)

  9. mockjs 前端写完 给后台调 mock.js | 改到2.0版本

    需求:最近活太忙了,实在是联调没有时间了,无奈又拾起来mockjs 1 安装mockjs npm install mockjs // 这是个只在开发的时候用,打包后就没有了,业务更安全 npm ins ...

  10. node开发命令行脚本 / commander

    1. 脚本第一行添加 #!/usr/bin/env node // index.js #!/usr/bin/env node console.log('hello world') 2. package ...