第三天
1、在根下创建一个目录ceshi,在测试目录下创建一个user目录,将/etc/passwd和/etc/shadow文件复制到/ceshi/user目录中,给/ceshi//user/passwd文件创建一个硬链接文件为passwd.bak,给/ceshi/user/shadow文件创建一个软链接为sh.link。**
1 mkdir ceshi
2 cd ceshi/
3 mkdir user
4 cd
5 cp /etc/passwd /ceshi/user/
6 cp /etc/shadow /ceshi/user/
7 ls /ceshi/user/
8 ln /ceshi/user/passwd passwd.bak
9 ln -s /ceshi/user/shadow sh.link
2、将/etc/ssh/sshd_config文件复制到/ceshi目录中并重命名为sshd。
1 cp /etc/ssh/sshd_config /ceshi/
2 cd /ceshi/
3 ll
4 mv sshd_config sshd
5 ll
3、找出文件名为passwd的文件并将找出的结果写入/passwd.txt文件中。
1 find / -name passwd | tee /passwd.txt
4、在root用户的家目录下面创建一个test目录,将/ceshi/sshd文件和/ceshi/user/passwd.bak移动到test目录中。
1 mkdir test
2 mv /ceshi/sshd test/
3 mv /ceshi/user/passwd test/
5、将cehsi目录中的user目录和/root/test/sshd文件打包并以gzip程序压缩至test目录中,并将该压缩文件下载至windows客户端。
1 tar -zvcf user.tar.gz test/
2 tar -zvcf sshd.tar.gz test/sshd
3 mount /dev/cdrom /mnt
cat <> /etc/yum.repos.d/rhel8-2.repo
[BaseOS]
baseurl=file:///mnt/BaseOS/
enable=1
gpgcheck=0
[AppStream]
baseurl=file:mnt/AppStream/
enable=1
gpgcheck=0
EOF
4 yum provides rz
5 yum -y install lrzsz
6 rz
7 链接可直接进行linux和windos之间的文件传输
6、将第五题中的压缩文件解压到普通用户的家目录中,从解压文件中找到以b或者c开始的行内容并将其内容写入普通用户家目录下的file文件中。
1 tar xzvf /root/test/sshd.tar.gz -C /home/
2 tar xzvf /root/test/user.tar.gz -C /home/
4 cat /home/user | grep “^b” | tee /home/file
5 cat /home/user | grep “^c” | tee /home/file
6 cat /home/sshd | grep “^c” | tee /home/file
7 cat /home/sshd | grep “^b” | tee /home/file
8 cat /home/sshd
9 cat /home/sshd | grep -i “^c” | tee /home/file