标签:passwd update auth 系统运行级别 操作系统 level 运行级别 root 密钥
目录
passwd
重置密码root用户,直接执行
passwd
回车 输入两次新密码即可
普通用户,也可以改。passwd username
user1
登录后,改自己密码,只需要执行passwd
即可
[root@localhost ~]# passwd root #修改root用户密码
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# useradd user1 #增加普通用户
[root@localhost ~]# passwd user1 #修改普通用户密码
Changing password for user user1.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.
当我们忘记了密码,也没有密钥,该怎么办呢???Linux系统提供了一种单用户模式。单用户模式是Centos 7系统的一个运行级别。那么什么是运行级别呢?
运行级别就是操作系统当前正在运行的功能级别,级别是从0到6。Centos7系统之前的版本是通过/etc/inittab
文件来定义系统运行级别:
[root@localhost ~]# cat /etc/centos-release
CentOS release 6.4 (Final)
[root@localhost ~]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this) # 运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动
# 1 - Single user mode # 运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 运行级别2:多用户状态(没有NFS)
# 3 - Full multiuser mode # 运行级别3:完全的多用户状态(有NFS),登陆后进入控制台命令行模式
# 4 - unused # 运行级别4:系统未使用,保留
# 5 - X11 # 运行级别5:X11控制台,登陆后进入图形GUI模式
# 6 - reboot (Do NOT set initdefault to this) # 运行级别6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动
#
id:3:initdefault: # 表示运行级别3,是默认的
CentOS 7 版本不再使用该文件定义系统运行级别,相关运行级别设置无效:
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
[root@localhost ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run: #查看当前运行级别使用如下命令
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target #设置默认运行级别,使用如下命令
#
标签:passwd update auth 系统运行级别 操作系统 level 运行级别 root 密钥
原文地址:https://www.cnblogs.com/linuxk/p/10302009.html