1、在根下创建一个目录ceshi,在测试目录下创建一个user目录,将/etc/passwd和/etc/shadow文件复制到/ceshi/user目录中,给/ceshi/user/passwd文件创建一个硬链接文件为passwd.bak,给/ceshi/user/shadow文件创建一个软连接为sh.link。
[root@localhost ~]# cd /
[root@localhost /]# mkdir ceshi
[root@localhost /]# cd ceshi
[root@localhost ceshi]# mkdir user
[root@localhost ceshi]# cp /etc/passwd /etc/shadow /ceshi/user
[root@localhost user]# ln /ceshi/user/passwd passwd.bak
[root@localhost user]# ln -s /ceshi/user/shadow /sh.link
2、将/etc/ssh/sshd_config文件复制到/ceshi目录中并重命名为sshd。
[root@localhost user]# cp /etc/ssh/ssha_confing /ceshi/sshd
3、找出根目录下文件名为passwd的文件并将找出的结果写入/passwd.txt文件中。
[root@localhost ceshi]# find / -name passwd |tee passwd.txt
[root@localhost ceshi]# cat passwd.txt
4、在root用户的家目录下面创建一个test目录,将/ceshi/sshd文件和/ceshi/suer/passwd.bak移动到test目录中。
[root@localhost ~]# mkdir /root/test
[root@localhost ~]# mv /ceshi/sshd /ceshi/user/passwd.bak /root/test
5、将chshi目录中的user目录和/root/test/sshd文件打包并以gzip程序压缩至test目录中,并将该压缩文件下载至windows客户端。
[root@localhost ~]# tar zcvf /ceshi/test /ceshi/user /root/test/sshd
[root@localhost ~]# sz /root/test
6、将第五题中的压缩文件解压到普通用户的家目录中,从解压文件中找到以b或者c开始的行内容并将其内容写入普通用户家目录下的file文件中。
[root@localhost test]# tar xzvf /root/test/wx -C /home/redhat
ceshi/user/
ceshi/user/passwd
ceshi/user/shadow
root/test/sshd
[root@localhost test]# ls /home/redhat
[root@localhost ~]# cat /home/file
Bin: x :1:1:bin:/bin:/sbin/nologin
colord:x:996:993:User for colord:/var/lib/colord:/sbin/nologin
chrony:x:990:985::/var/lib/chrony:/sbin/nologin
bin:*:16579:6:99999:7:::
colord:!!:18342::::::
chrony:!!:18342::::::