cas第二次作业

1.查看文件/test/passwd的第三行内容标准输出到屏幕上

head   -3 /test/passwd |  tail -1

2.用vim在文件file里编辑内容,并替换redhat为red

vim file

root     192.168.222.1      202305091230

​ hellon    192.168.203.128     202305091254

​ redhat   192.168.23.5       202305091830

​ root     192.168.222.1  202305091856

​ root     192.168.222.1  202305091900

​ redhat   192.168.23.5       202305092020

esc

:wq!

cat file

vim file

:%s/redhat/red/g

:wq!

3.找到访问本服务器最多的人的ip地址

cut file | cut -d " " -f 1,2 file | sort | uniq -c

4创建一个所有用户都可以用的命令别名shuaxin,每次使用刷新,都可以更新/file文件的时间

vim   /etc/bashrc

 esc

:wq!

useradd hellen

useradd mysuer

groupadd the

gpasswd -a hellen the

gpasswd -a mysuer the

usermod -aG the file

chmod 760 /file

ls -lh file

vim /etc/sudoers 

 esc

:wq!

6.hellen创建一个mod文件,所有人都只可读,除了root和myuser可读可写

sudo touch mod

ls

gpasswd -a mysuerr for  

gpasswd -a root for 

chgrp for mod
chmod 464 mod

7.创建g1组,要求创建一个属于redhat用户g1组的文件redhat.txt useradd redhat

gpasswd -a redhat g1

touch redhat.txt

chown redhat:g1 redhat.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值