Proxmox如何进入单人维护模式(重置root密码)

本文介绍了两种在 Proxmox VE 主机上重置 root 账户密码的方法,以及如何在容器中重置 root 密码。方法一通过 grub 单用户模式进入系统并使用 passwd 命令更改密码;方法二则借助 Debian Live CD 访问文件系统,编辑 shadow 文件来修改密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

官网连接:https://pve.proxmox.com/wiki/Root_Password_Reset

Root Password Reset

 
 

Resetting the root account password on the PVE Host

The following is quoted from Debian Squeeze change root password and works for Proxmox VE3.x and 4.x (It can also be used to change any account password as well as for other Debian based distributions):

Method 1

  • Boot into grub, select single user but do not press enter.
  • Press e to go into edit mode.
  • Scroll down to the kernel line you will boot from, it starts with "linux /boot/vmlinuz-……."
  • Scroll to the end of that line and press space key once and type init=/bin/bash
  • Press Ctrl X to boot

 

# Remount / as Read/Write 
mount -rw -o remount /
# Change the root account password with
passwd
# Change any other account password with
passwd username
# type new password, confirm and hit enter and then reboot.

 

Method 2

  • Boot from another installation of Debian. (One can use a LiveCD to get access to the "/" partition.)
  • Then, mount the partition where you have Debian's "/" (root directory), then change directory to /mnt/etc
  • Used vim / nano as an editor to edit the file shadow.
  • Find the line starting with root: (or another username)
  • Delete everything between the first and second colons (:), and the line will now look like:
root::$6$fsdsdgdsg74.:14862:0:99999:7:::
  • Reboot and login as root (or another username as used above) without a password.
  • At the end use passwd to set a new password for the root account (or passwd username to change any account password).
  • Reboot and login as root with the new root password.

Resetting the root account password in a Container

  • Enter the working container and change the password using:
lxc-attach -n enter <VEID>
passwd <new password>
exit

  • When using OpenVZ containers (up to PVE 3.4) use

 

vzctl enter <VEID>

to enter the container.

转载于:https://www.cnblogs.com/djoker/p/6393398.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值