RHCSA(1)基础知识,修改密码,破解root密码

  • 终端:也称为终端设备,是计算机网络处于网络最外围的设备,主要用于用户信息的输入以及处理结果的输出等。

  • 虚拟终端:同一台终端设备上拟出的多个终端,他们之间互相不影响,这些终端就是虚拟终端,默认有6个,ctrl+alt+f1/2/3/4/5/6
    终端窗口:
    在这里插入图片描述/ 根目录

  • 获取终端地址
    让DHCP服务来发送地址:dhclient
    获取地址:ip addr/ip add
    第二条里边的地址为你的IP地址在这里插入图片描述 强制关闭进程 kill -9 +进程编号

  • 远程登录服务器
    复制IP地址,粘贴到xshell中
    输入需要登录的用户名和密码在这里插入图片描述[root@localhost ~]#
    [用户名@主机名 工作目录] # root用户的命令提示符 $普通用户的提示符
    永久修改主机名:hostnamectl set-hostname 主机名
    ~ 代表用户的家目录
    / 代表根目录或路径分割符
    查看当前工作目录(print work directory):pwd
    根用户的家目录 /root
    redhat用户的家目录 /home/redhat

  • 切换用户(switch user):su - redhat
    root用户可以给所有人修改密码:
    修改密码:passwd 用户名 直接输入passwd修改当前用户的密码**
    删除密码:passwd -d 用户名
    [student@localhost ~]$ su -c passwd普通用户给root用户修改密码

  • 切换目录(change directory):cd
    1.绝对路径(以/开头的路径):cd /home/haha 绝对路径是从根开始的
    2.相对路径(以./开头的路径):cd / cd home cd haha
    直接回到当前用户主目录:cd
    回到当前目录的上一级目录:cd …
    回到当前目录:cd .
    切换到之前的目录:cd -
    重启:reboot,shutdown -r now
    关机:shutdown -h now,poweroff

  • 查看当前Linux发行版本信息:cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 7.2 (Maipo)
    [root@localhost 桌面]# uname -r 内核版本号
    3.10.0-327.el7.x86_64 主版本号 . 子版本号 [ 修正版本号 [. 编译版本号 ]]
    3主版本号
    10次版本号,一般偶数表示较稳定版本
    0修订版本号
    327.el7 表示修改了327次
    1.项目初版本时,版本号可以为 0.1 或 0.1.0,也可以为 1.0 或 1.0.0
    2.当项目在进行了重大修改或局部修正累积较多,而导致项目整体发生全局变化时,主版本号加 1;
    3.当项目在原有的基础上增加了部分功能时,主版本号不变,子版本号加 1,修正版本号复位为 0,因而可以被忽略掉 ;
    4.当项目在进行了局部修改或 bug 修正时,主版本号和子版本号都不变,修正版本号加 1;
    5.另外,编译版本号一般是编译器在编译过程中自动生成的,我们只定义其格式,并不进行人为控制 .
    破解密码
    1.Reboot the system.
    2.Interrupt the boot loader count down by pressing anykey.
    3.Move the cursor to the entry that needs to be booted.
    4.Press “e” to edit the select edentry.
    5.Move the cursor to the kernel command line(the line that start swith linux16.
    6.Append rd.break
    7.Press Ctrl+x to start.
    8.Remount /sysroot as read-write.
    switch_root:/# mount -o remount,rw /sysroot
    9.Switch into a chroot jail, where /sysroot is treated as the root of the filesystem tree
    switch_root:/# chroot /sysroot
    10.Set a new root password:
    sh-4.2# passwd [root] (change the root password)
    or
    sh-4.2# passwd -d root (delete the root password)
    11.Make sure that all unlabeled files (including/etc/shadow at this point)get relabeled during boot.
    sh-4.2# touch /.autorelabel
    12.sh-4.2# exit
    13.switch_root:/# exit

  • 破解root密码:
    1、重启虚拟机
    2、在linux16末尾加上 rd.break, 点击ctrl+x执行命令
    3、mount -o remount,rw /sysroot (挂载)
    4、chroot /sysroot
    5、passwd root
    6、输入新密码:
    7、确认密码
    8、touch /.autorelabel
    9、exit
    10、exit
    在这里插入图片描述

发布了22 篇原创文章 · 获赞 3 · 访问量 337

猜你喜欢

转载自blog.csdn.net/qq_45161607/article/details/103995311