1、在根下创建一个目录ceshi,在测试目录下创建一个user目录,将/etc/passwd和/etc/shadow文件复制到/ceshi/user目录中,给/ceshi//user/passwd文件创建一个硬链接文件为passwd.bak,给/ceshi/user/shadow文件创建一个软链接为sh.link。
[root@localhost ~]# mkdir /ceshi/user -p
[root@localhost ~]# cp /etc/{passwd,shadow} /ceshi/user
[root@localhost ~]# ln -s /ceshi/user/passwd /ceshi/user/passwd.bak
[root@localhost ~]# ln /ceshi/user/shadow /ceshi/user/sh.link

2、将/etc/ssh/sshd_config文件复制到/ceshi目录中并重命名为sshd。
[root@localhost ~]# cp /etc/ssh/sshd_config /ceshi/sshd

3、找出文件名为passwd的文件并将找出的结果写入/passwd.txt文件中。
[root@localhost ~]# find / -name passwd >> /passwd.txt
[root@localhost ~]# cat /passwd.txt

4、在root用户的家目录下面创建一个test目录,将/ceshi/sshd文件和/ceshi/user/passwd.bak移动到test目录中。
[root@localhost ~]# mkdir /root/test
[root@localhost ~]# mv -t /root/test /ceshi/sshd /ceshi/user/passwd.bak
[root@localhost ~]# ll /root/test

5、将cehsi目录中的user目录和/root/test/sshd文件打包并以gzip程序压缩至test目录中,并将该压缩文件下载至windows客户端。
[root@localhost ~]# cd /root/test
[root@localhost test]# tar -czvf ys.tar.gz /ceshi/user /root/test/sshd
[root@localhost test]# ll
[root@localhost test]# tar tf ys.tar.gz


6、将第五题中的压缩文件解压到普通用户的家目录中,从解压文件中找到以b或者c开始的行内容并将其内容写入普通用户家目录下的file文件中。
[root@localhost ~]# mkdir /home/jy
[root@localhost ~]# tar -xf /root/test/ys.tar.gz -C /home/jy
[root@localhost ~]# grep -rh ^[bc] /home/jy > /home/file
[root@localhost ~]# cat /home/file

427

被折叠的 条评论
为什么被折叠?



