习题练习03
修改 tom 的家目录为 /home/tomcat,且其基本组为 mail,uid号为 1111,密码为 '123456'
[root@localhost home]# mkdir /home/tomcat [root@localhost ~]# useradd tom [root@localhost ~]# id tom uid=1001(tom) gid=1001(tom) groups=1001(tom) [root@localhost ~]# usermod -g mail -d /home/tomcat -u 1111 tom [root@localhost ~]# id tom uid=1111(tom) gid=12(mail) groups=12(mail) [root@localhost tomcat]# echo '123456' | passwd --stdin tom Changing password for user tom. passwd: all authentication tokens updated successfully.
创建系统账号名称为 admin,全名为 administrator,账户的家目录为 /home/admin, 账户的有效时间为 2022年12月24日,账户基本组为root,附加组为 bin,adm,mail
[root@localhost tomcat]# useradd -c administrator -d /home/admin -e 2022-12-24 -g root -G bin,adm,mail admin [root@localhost tomcat]# id admin uid=1112(admin) gid=0(root) groups=0(root),1(bin),4(adm),12(mail)
压缩系统的 /home 目录,使用zip格式压缩,并且命名为student.tar.gz, 此文件要放在 /tmp/rhel7 目录下
[root@localhost tomcat]# mkdir /tmp/rhel7 [root@localhost tomcat]# tar -czvf /tmp/rhel7/student.tar.gz /home/
gzip 与 bzip2 压缩与解压缩(-d) 这两个指令压缩文件,不能压缩目录
[root@localhost rhel7]# touch aa.txt [root@localhost rhel7]# gzip aa.txt [root@localhost rhel7]# ls aa.txt.gz student.tar [root@localhost rhel7]# gzip -d aa.txt.gz [root@localhost rhel7]# ls aa.txt student.tar [root@localhost rhel7]# bzip2 aa.txt [root@localhost rhel7]# ls aa.txt.bz2 home student.tar.gz [root@localhost rhel7]# tar -xjvf aa.txt.bz2 [root@localhost rhel7]# ls aa.txt.bz2 home student.tar.gz [root@localhost rhel7]# bzip2 -d aa.txt.bz2 [root@localhost rhel7]# ls aa.txt home student.tar.gz
查看 init* 文件末尾2KB 的内容
[root@localhost ~]# tail -c 2K /root/initial-setup-ks.cfg
创建以下几个目录(teach,office,finance,admin,market)
[root@localhost ~]# mkdir -p /share/{teach,office,finance,admin,market} [root@localhost ~]# cd /share/ [root@localhost share]# ls admin finance market office teach
配置 yum 源
[root@localhost share]# mkdir /mnt/cdrom [root@localhost share]# mount /dev/cdrom /mnt/cdrom/ [root@localhost share]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# vim dvd.repo [dvd] name = dvd baseurl = file:///mnt/cdrom gpgcheck = 0 enabled = 1 [root@localhost yum.repos.d]# yum clean all [root@localhost yum.repos.d]# yum repolist all