时间:2020-02-17来源:系统城作者:电脑系统城
[root@centos7 etc]# ls -d /etc/[^[:alpha:]][:alpha:]*
[root@centos7 etc]# mkdir /tmp/mytest1 && cp -a /etc/[p]*[^[:digit:]] /tmp/mytest1/
[root@centos7 etc]# ls /tmp/mytest1/ #查看结果
pam.d passwd- pinforc plymouth pnm2ppa.conf postfix prelink.conf.d profile protocols purple
passwd pbm2ppa.conf pki pm popt.d ppp printcap profile.d pulse python
[root@centos7 etc]# tr 'a-z' 'A-Z' < /etc/issue >/tmp/issue.out
[root@centos7 etc]# cat /tmp/issue.out 查看内容
\S
KERNEL \R ON AN \M
(1)、创建组distro,其GID为2019;
[root@centos7 etc]# groupadd distro -g 2019
[root@centos7 etc]# getent group distro #验证distro的GID
distro:x:2019:
(2)、创建用户mandriva, 其ID号为1005;基本组为distro;
[root@centos7 etc]# useradd mandriva -u 1005 -g distro
[root@centos7 etc]# id mandriva #验证mandriva的UID号和基本组
uid=1005(mandriva) gid=2019(distro) groups=2019(distro)
(3)、创建用户mageia,其ID号为1100,家目录为/home/linux;
[root@centos7 etc]# useradd mageia -u 1100 -d /home/linux
[root@centos7 etc]# getent passwd mageia #验证结果
mageia:x:1100:1100::/home/linux:/bin/bash
(4)、给用户mageia添加密码,密码为mageedu,并设置用户密码7天后过期
[root@centos7 etc]# echo "mageedu" | passwd mageia --stdin -x 7
[root@centos7 etc]# getent shadow mageia #验证结果
mageia:!!:18308:0:7:7:::
(5)、删除mandriva,但保留其家目录;
[root@centos7 etc]# userdel mandriva
[root@centos7 etc]# ls /home/ #验证结果 mandriva目录依旧存在
diyoujia linux mandriva slackware test
(6)、创建用户slackware,其ID号为2002,基本组为distro,附加组peguin;
[root@centos7 etc]# useradd slackware -u 2002 -g distro -G peguin
[root@centos7 etc]# id slackware #验证结果
uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin)
(7)、修改slackware的默认shell为/bin/tcsh;
[root@centos7 etc]# chsh slackware -s /bin/tcsh
[root@centos7 etc]# getent passwd slackware #验证结果
slackware:x:2002:2019::/home/slackware:/bin/tcsh
(8)、为用户slackware新增附加组admins;
[root@centos7 etc]# usermod slackware -aG admins
[root@centos7 etc]# id slackware #验证结果
uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin),2021(admins)
2023-02-28
解决linux不识别nfst格式u盘问题技巧 linux无法识别ntfs格式U盘怎么办?2023-02-28
linux扩容swap分区的技巧 linux怎么调整swap大小?2023-02-26
微软Linux资源库首次加入Edge浏览器稳定版当linux在运作时不能直接关闭电源容易将档案系统损毁,因此需要用shutdown以安全的方式关闭,那么这个操作该怎么实现呢?下面就为大家带来了详细教程。...
2022-11-07
由于linux系统和我们常用的windows系统是不一样的,所以如果是初学者,可能会不知道linux怎么强制删除文件,其实我们只要打开终端,使用命令就可以删除了。...
2022-11-03