1、在根下创建一个目录ceshi,在测试目录下创建一个user目录,
mkdir -p /ceshi/user
将/etc/passwd和/etc/shadow文件复制到/ceshi/user目录中
cp -r /etc/passwd /ceshi/user
cp -r /etc/shadow /ceshi/user
给/ceshi//user/passwd文件创建一个硬链接文件为passwd.bak
ln /ceshi/user/passwd /passwd.bak
给/ceshi/user/shadow文件创建一个软链接为sh.link
ln -s /ceshi/user/ shadow /sh.link
2、将/etc/ssh/sshd_config文件复制到/ceshi目录中并重命名为sshd。
cp /etc/ssh/sshd_config /ceshi/sshd
3、找出文件名为passwd的文件并将找出的结果写入/passwd.txt文件中。
[root@localhost user]# find / -name passwd -type f > /passwd.txt
[root@localhost user]# cat /passwd.txt
/sys/fs/selinux/class/passwd/perms/passwd
/etc/pam.d/passwd
/etc/passwd
/var/lib/sss/mc/passwd
/usr/bin/passwd
/tmp/passwd
/tmp/etc/pam.d/passwd
/tmp/etc/passwd
/ceshi/user/passwd
[root@localhost user]#
4、在root用户的家目录下面创建一个test目录,将/ceshi/sshd文件和/ceshi/user/passwd.bak移动到test目录中。
[root@localhost ~]# mkdir test
[root@localhost user]# mv /ceshi/sshd /ceshi/user/passwd.bak ./test/
5、将cehsi目录中的user目录和/root/test/sshd文件打包并以gzip程序压缩至test目录中,并将该压缩文件下载至windows客户端。
[root@localhost ~]# tar -czvf 111111.tar.gz /ceshi/user /root/test/ssh
[root@localhost ~]# sz 111111.tar.gz
6、将第五题中的压缩文件解压到普通用户的家目录中,从解压文件中找到以b或者c开始的行内容并将其内容写入普通用户家目录下的file文件中
[root@localhost ~]# tar 11111.tar.gz -C /home/monkey/
[root@localhost ~]# grep ^c ceshi/user/passwd ceshi/user/shadow root/test/ssh > file
[root@localhost ~]# grep ^b ceshi/user/passwd ceshi/user/shadow root/test/ssh > file