RHCSA第一天命令笔记

本文记录了RHCSA操作系统的常用命令,包括获取网络地址的dhclient、查看IP的ifconfig或ip a,以及进程管理、切换用户、修改主机名、密码管理等操作。此外,还详细介绍了如何破解或重置root密码的步骤。

dhclient 地址请求(网络连接)
#dhclient
ifconfig 或 ip a 查看ip地址
在这里插入图片描述
Kill ID 结束相应的进程
在这里插入图片描述
pwd 指出当前工作环境 --> print workdoing directory
在这里插入图片描述
hostname 查看完整主机名
在这里插入图片描述
hostname A 当前主机运行状态临时更改主机名
在这里插入图片描述
hostnamectl set-hostname A 永久更改主机名(重启生效)

su 切换到root用户并不切换环境(工作目录) --> switch user
su redhat 切换root身份,但不切换
在这里插入图片描述
su -
su -l root ==su - root 切换到root用户并切换环境(切换了工作目录)

cd 切换目录 change directory 切换目录【文件夹】
绝对路径 从根开始到目标的路径叫绝对路径 cd/home/redhat
相对路径 相对当前目录开始到目标路径 /]#cd root
/ 根
~ 家目录 /root/home/redhat
·USERNAME(root用户有权限) 直接切换到指定用户的家目录
-上一次切换的目录
. 当前目录.

passwd;password
修改密码:passwd 用户名 直接输入passwd修改当前用户的密码
删除密码:passwd -d 用户名
root用户:不需要输入原始密码,可以不符合密码复杂性规则,可以给任何人修改密码
普通用户:需要输入原始密码,必须符合密码复杂性规则,passwd修改密码无法指定用户
在这里插入图片描述

>>破解密码(重置密码)
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

eg:破解root密码:
1、重启虚拟机 + e
2、在linux末尾加上 rd.break ctrl+x执行
3、mount -o remount,rw /sysroot (根分区 给根系统一个读写权限)
4、chroot /sysroot
5、passwd root 或passwd -d root
6、输入新密码:
7、确认密码
8、touch /.autorelabel 盖章
9、exit
10、exit logout

重启:reboot ,shutdown -r now
关机:shutdown -h now,poweroff init 0 init 3 init 5 init 1
查看当前Linux发行版本信息:cat /etc/redhat-release
在这里插入图片描述

远程登陆
ssh+IP地址
选择用户
输入密码
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

.Demon  

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值