RHCSAday7-Linux文件系统权限/Linux文件系统权限/管理Linux软件包和进程

Linux文件系统权限

一、练习

设置权限,要求如下:
(1)创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt
[root@localhost ~]# groupadd g1
[root@localhost ~]# useradd redhat
[root@localhost ~]# mkdir redhat
[root@localhost ~]# cd redhat
[root@localhost redhat]# touch redhat.txt
[root@localhost redhat]# chown redhat redhat.txt
[root@localhost redhat]# chgrp g1 ./redhat.txt
[root@localhost redhat]# ll
total 0
-rw-r--r--. 1 redhat g1 0 Aug 28 08:51 redhat.txt
(2)新建/sc目录,所属组为group组,root用户和group组用户可在该目录下创建文件,其他人无任何权 限
[root@localhost ~]# mkdir sc
[root@localhost ~]# groupadd group
[root@localhost ~]# chgrp group ./sc
[root@localhost ~]# ll
total 8
-rw-------. 1 root root  1210 Aug 26 14:32 anaconda-ks.cfg
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Desktop
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Documents
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Downloads
-rw-r--r--. 1 root root  1482 Aug 26 14:35 initial-setup-ks.cfg
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Music
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Pictures
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Public
drwxr-xr-x. 2 root root    24 Aug 28 08:51 redhat
drwxr-xr-x. 2 root group    6 Aug 28 08:54 sc
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Templates
drwxr-xr-x. 3 root root    35 Aug 28 07:27 test
drwxr-xr-x. 2 root root     6 Aug 26 14:37 Videos
(3)新建/cw目录为财务部存储目录,只能对财务部人员可以写入,并且财务部人员所建立的文件都自动属于mygroup组中
[root@localhost /]# mkdir /cw
[root@localhost /]# groupadd mygroup
[root@localhost /]# chgrp mygroup /cw
[root@localhost /]# chmod -R g+wx /cw
(4)设置 helen用户对于/sc和/cw目录可以读,写,执行
[root@localhost /]# setfacl -m u:helen:rwx /sc
[root@localhost /]# setfacl -m u:helen:rwx /cw
(5)设置/test目录为公共存储目录对所有用户可以读,写,执行,但用户只能删除属于自己的文件(t权限)
[root@localhost /]# chmod -R 1777 /test  
(6)在/test/dir里创建的新文件自动属于temp组
[root@localhost test]# groupadd temp
[root@localhost test]# chgrp temp /test/dir

二、总结

在这里插入图片描述

管理Linux的联网

一、练习

配置网络
(1)为网卡添加一个会话static,在此会话配置ip地址为x.x.x.123
[root@localhost /]# nmcli c add type ethernet con-name static ifname ens160
[root@localhost /]# nmcli c modify static ipv4.addresses 192.168.2.123 
[root@localhost /]# nmcli c modify static ipv4.gateway 192.168.2.2 ipv4.dns 8.8.8.8
(2)测试网络连通性,看是否能够ping通百度,并把百度首页文件下载下来
[root@localhost ~]# nmcli c up ens160
[root@localhost ~]# wget https://www.baidu.com/
[root@localhost ~]# cat index.html
(3)设置系统开机时,该网卡通过DHCP协议自动获取IP地址
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
`修改ONBOOT,将no修改为yes` `保存退出即可`

二、总结

在这里插入图片描述

管理Linux软件包和进程

一、练习

1、RPM软件管理
1)通过rpm安装vsftpd软件。
[root@localhost /]# wget http://rpmfind.net/linux/opensuse/distribution/leap/15.5/repo/oss/x86_64/vsftpd-3.0.5-150400.3.3.1.x86_64.rpm
[root@localhost /]# rpm -ivh vsftpd-3.0.5-150400.3.3.1.x86_64.rpm.1 --force --nodeps
2)查询vsftpd软件包的信息。
[root@localhost /]# rpm -qi vsftpd
3)卸载软件包vsftpd。
[root@localhost /]# rpm -e vsftpd
2、YUM软件管理
1)挂载本地光盘,配置yum源为rhel8.repo。
[root@localhost /]# mldir -p /etc/yum.repos.d/back
[root@localhost /]# mv /etc/yum.repos.d/* /etc/yum.repos.d/back
[root@localhost /]# vim /etc/yum.repos.d/rhel8.repo
[CenOS8-Base]
name=CenOS8-Base
baseurl=file:///mnt/cdrom/BaseOS
gpgcheck=0
enabled=1
[CenOS8-AppStream]
name=CenOS8-AppStream
baseurl=file:///mnt/cdrom/AppStream
gpgcheck=0
enabled=1
[root@localhost /]# mount /dev/sr0 /mnt
2)通过yum来安装httpd。
[root@localhost /]# yum install httpd -y
3)使用yum查询ifconfig命令是由那个软件包提供的。
[root@localhost /]# yum whatprovides ifconfig
4)卸载软件包httpd。
[root@localhost /]# yum remove httpd
3、源码管理
下载tree源码包并编译安装。
[root@localhost /]# wget http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz
[root@localhost /]# tar zxvf tree-1.7.0.tgz
[root@localhost /]# cd tree-1.7.0
[root@localhost /]# make && make install
4、进程管理
1)通过ps命令的两种选项形式查看进程信息
[root@localhost /]# ps -ef
[root@localhost /]# ps aux
2)通过pgrep和pidof命令查看sshd服务的进程号
[root@localhost /]# pgrep -ef
[root@localhost /]# pidof aux
3)使dd if=/dev/zero of=/root/file bs=1M count=8190 命令操作在前台运行
[root@localhost /]# dd if=/dev/zero of=/root/file bs=1M count=8190
4)将上题操作调入到后台并暂停
Ctrl + z
5)使dd if=/dev/zero of=/root/file2 bs=1M count=1024 命令操作在后台运行
[root@localhost ~]# dd if=/dev/zero of=/root/file2 bs=1M count=1024 &
6)查看后台的任务列表
[root@localhost ~]# jobs
7)恢复dd if=/dev/zero of=/root/file bs=1M count=8190 让其在后台继续运行
[root@localhost ~]# bg %1
8)查询dd if=/dev/zero of=/root/file bs=1M count=8190 命令的进程并通过kill杀死
[root@localhost ~]# kill %1

二、总结

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值