RHCSA 基础练习

软/硬链接

1. 在test_dir目录下创建一个test_file.txt文件,然后再创建该文件的软链接链接名为soft_link.txt,再创建一个硬链接,链接名为hard_link.txt。

2. 删除test_file.txt文件,查看软链接和硬链接文件是否还能访问,分别说明原因。

软链接 soft_link.txt :无法访问
原因:软链接是文件路径的引用(类似快捷方式),仅记录原文件的路径。当原文件 test_file.txt 被删除后,软链接指向的路径失效,因此无法访问(会提示"没有那个文件或目录")。
硬链接 hard_link.txt :可以正常访问
原因:硬链接是原文件的"别名",与原文件共享同一个 inode (文件的唯一标识)和数据块。删除原文件只是减少了 inode 的引用计数,只要引用计数不为0(硬链接仍存在),文件数据就不会被删除,因此硬链接可以正常访问。

文件权限管理

1. 将copy_of_test.txt文件的所有者修改为当前系统中的普通用户user1(假设user1存在),文件所属组修改为group1(假设group1存在)。

root@localhost \~# useradd user1
root@localhost \~# groupadd group1
root@localhost \~# touch copy_of_test.txt

root@localhost \~# chown user1:group1 copy_of_test.txt

​2. 为copy_of_test.txt文件设置权限,使得所有者有读写执行权限,所属组有读和执行权限,其他用户只有读权限,写出具体命令。

root@localhost \~# chmod 754 copy_of_test.txt

​3. 查看copy_of_test.txt文件的详细权限信息。

root@localhost \~# ls -l copy_of_test.txt

用户和用户组基础操作

1. 创建一个名为newuser1的普通用户,并指定其默认登录 Shell 为/bin/bash。

root@localhost \~# useradd -s /bin/bash newuser1

说明: -s 选项用于指定默认登录Shell。

​2. 创建一个名为newgroup1的用户组,然后将newuser1添加到该用户组中。

root@localhost \~# groupadd newgroup1
root@localhost \~# usermod -G newgroup1 newuser1

3. 删除用户newuser1,要求保留其家目录。

root@localhost \~# userdel newuser1

说明:userdel 默认保留家目录;若需删除家目录,需加 -r 选项。

文件和目录权限设置与修改

​1. 在用户主目录下创建一个名为perm_test_dir的目录和perm_test_file.txt的文件,分别为该目录和文件设置权限:目录的所有者有读写执行权限,所属组有读和执行权限,其他用户无任何权限;文件的所有者有读写权限,所属组和其他用户只有读权限。

root@localhost \~# mkdir perm_test_dir
root@localhost \~# touch perm_test_file.txt
root@localhost \~# chmod 750 perm_test_dir
root@localhost \~# chmod 644 perm_test_file.txt

​2. 将perm_test_dir目录及其下所有文件的所属组修改为newgroup1。

root@localhost \~# chgrp -R newgroup1 perm_test_dir

说明:-R 表示递归处理所有子文件/目录。

​3. 递归地将perm_test_dir目录的权限修改为:所有者和所属组有读写执行权限,其他用户只有读权限。

root@localhost \~# chmod -R 774 perm_test_dir

写出通过dnf安装cockpit的详细过程

root@localhost \~# mount /dev/sr0 /mnt
root@localhost \~# vim /etc/yum.repos.d/base.repo

保存后退出

root@localhost \~# systemctl stop firewalld

root@localhost \~# vim /etc/cockpit/disallowed-users(删除root那行)

保存后退出
root@localhost \~# systemctl restart cockpit

window浏览器访问 虚拟机ip地址:9090

相关推荐
无足鸟ICT6 分钟前
【RHCA+】查看变量
linux·运维·服务器
Kina_C15 分钟前
Linux DNS 服务器-从高速缓存到辅助 DNS 部署指南
linux·运维·服务器·dns
suaizai_28 分钟前
TypeScript 7 正式发布!Vue 暂被 “拒之门外“ !!!
linux·运维·ubuntu
慕伏白1 小时前
【慕伏白】Linux 系统如何根据端口号关闭进程
linux·运维·服务器
letisgo52 小时前
VMware Workstation + Ubuntu 26.04 LTS 小白运维部署手册
linux·运维·ubuntu
IT探索2 小时前
Linux 查找文件指令总结
linux·算法
晚风吹长发2 小时前
Docker使用——Docker容器及相关命令
linux·运维·服务器·docker·容器·架构
sulikey2 小时前
个人Linux操作系统学习笔记11 - 环境变量
linux·笔记·学习
Kina_C2 小时前
NFS与Autofs快速讲解-从原理到实战配置
linux·nfs·autofs
皮卡狮2 小时前
文件系统:磁盘硬件寻址和系统软件寻址
linux