1. Create a user Mandriva with an ID number of 2002, a base group of distro (group ID 3003), and an additional group of Linux
[[email protected] ~]# groupadd-g 3003 distro[[email protected] ~]# tail-1/etc/groupdistro:x:3003:[[email protected] ~] # Groupadd Linux[[email protected] ~]# tail-1/etc/grouplinux:x:3004: |
[[email protected] ~]# useradd-u 2002-g distro-g linux mandriva[[email protected] ~]# ID mandrivauid=2002 (Mandriva) GID =3003 (distro) groups=3003 (distro), 3004 (Linux) Context=root:system_r:unconfined_t:systemlow-systemhigh |
2. Create a user fedora with the full name of Fedora Community, the default shell is tcsh
[[email protected] ~]# useradd-c "Fedora commnuity"-s/bin/tcsh fedora[[email protected] ~]# ID fedorauid=2003 (Fedora) G id=2003 (Fedora) groups=2003 (Fedora) context=root:system_r:unconfined_t:systemlow-systemhigh[[email protected] ~]# Finger Fedoralogin:fedora name:fedora commnuitydirectory:/home/fedora Shell:/bin/tcshnever logged in. No Mail. No Plan. [Email protected] ~]# |
3. Modify Mandriva with ID number 4004, Basic Group Linux, additional group distro and Fedora
[[email protected] ~]# usermod-u 4004-g linux-g distro,fedora mandriva[[email protected] ~]# ID mandrivauid=4004 (Mandri VA) gid=3004 (Linux) groups=3004 (Linux), 3003 (Distro), 2003 (Fedora) context=root:system_r:unconfined_t: Systemlow-systemhigh |
4. Add a password to Fedora and set its minimum password period of 2 days, up to 50 days.
[Email protected] ~]# passwd fedorachanging password for user fedora. New Unix Password:bad password:it is the too Shortretype new UNIX Password:passwd:all authentication tokens updated SUCC Essfully. [Email protected] ~]# passwd-n 2-x fedoraadjusting Aging data for user Fedora.passwd:success[[email protected] ~]# |
5. Change the default shell of Mandriva to/bin/bash
[[email protected] ~]# usermod-s/bin/bash mandriva[[email protected] ~]# ID mandrivauid=4004 (mandriva) gid=3004 (Linux) G roups=3004 (Linux), 3003 (Distro), 2003 (Fedora) Context=root:system_r:unconfined_t:systemlow-systemhigh[[email Protected] ~]# finger Mandrivalogin:mandriva Name: (null) Directory:/home/mandriva Shell:/bin/bashnever Logged in. No Mail. No Plan. [Email protected] ~]# |
6. Add the system user HBase and do not allow it to log on to the system.
[Email protected] ~]# useradd-r-s/bin/nologin hbase[[email protected] ~]# tail-1/ETC/PASSWDHBASE:X:102:103::/HOME/HB Ase:/bin/nologin[[email protected] ~]# su-hbasesu:warning:cannot change directory to/home/hbase:no such file or dire CTORYSU:/bin/nologin:no Such file or Directory[[email protected] ~]# |
This article is from the "I want to surpass myself" blog, please be sure to keep this source http://zhangfengzhe.blog.51cto.com/8855103/1412871