[root@localhost ~]# cp -R /etc/skel /home/tuser1[root@localhost ~]# ls -ld /home/tuser1drwxr-xr-x. 4 root root 4096 5月 21 05:09 /home/tuser1[root@localhost ~]# chmod -R go=— /home/tuser1[root@localhost ~]# ls -ld /home/tuser1drwx——. 4 root root 4096 5月 21 05:09 /home/tuser1
[root@localhost ~]# vim /etc/group在最后一行添加: hadoop:x:2008:[root@localhost ~]# grep “hadoop” /etc/grouphadoop:x:2008:
[root@localhost ~]# vim /etc/passwd[root@localhost ~]# tail -1 /etc/passwdhadoop:x:2008:2008::/home/hadoop:
[root@localhost ~]# cp -r /etc/skel /home/hadoop[root@localhost ~]# ls -ld /home/hadoopdrwxr-xr-x. 4 root root 4096 5月 21 05:24 /home/hadoop[root@localhost ~]# chmod -R go=— /home/hadoop[root@localhost ~]# ls -ld /home/hadoopdrwx——. 4 root root 4096 5月 21 05:24 /home/hadoop[root@localhost ~]# id hadoopuid=2008(hadoop) gid=2008(hadoop) 组=2008(hadoop)
[root@localhost ~]# ls -ld /home/hadoopdrwx——. 4 root root 4096 5月 21 05:24 /home/hadoop[root@localhost ~]# chown -R hadoop:hadoop /home/hadoop[root@localhost ~]# ls -la /home/hadoop总用量 28drwx——. 4 hadoop hadoop 4096 5月 21 05:24 .drwxr-xr-x. 14 root root 4096 5月 21 05:24 ..-rw——-. 1 hadoop hadoop 18 5月 21 05:24 .bash_logout-rw——-. 1 hadoop hadoop 176 5月 21 05:24 .bash_profile-rw——-. 1 hadoop hadoop 124 5月 21 05:24 .bashrcdrwx——. 2 hadoop hadoop 4096 5月 21 05:24 .gnome2drwx——. 4 hadoop hadoop 4096 5月 21 05:24 .mozilla
[root@localhost ~]# grep -i “^s.*” /proc/meminfoSwapCached: 8 kBSwapTotal: 3157400 kBSwapFree: 3157392 kBShmem: 4604 kBSlab: 110976 kBSReclaimable: 41000 kBSUnreclaim: 69976 kB
[root@localhost ~]# grep “^[sS].*” /proc/meminfoSwapCached: 8 kBSwapTotal: 3157400 kBSwapFree: 3157392 kBShmem: 4604 kBSlab: 110940 kBSReclaimable: 41004 kBSUnreclaim: 69936 kB
[root@localhost ~]# grep -E “^(s|S).*” /proc/meminfoSwapCached: 8 kBSwapTotal: 3157400 kBSwapFree: 3157392 kBShmem: 4604 kBSlab: 110916 kBSReclaimable: 40996 kBSUnreclaim: 69920 kB
[root@localhost ~]# grep -v “/sbin/nologin$” /etc/passwdroot:x:0:0:root:/root:/bin/bashsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltcentos:x:500:500::/home/centos:/bin/bashfedora:x:501:501::/home/fedora:/bin/bashmageia:x:1100:1100::/home/linux:/bin/bashslackware:x:2002:2016::/home/slackware:/bin/tcshuser1:x:2003:2003::/home/user1:/bin/bashuser2:x:2004:2004::/home/user2:/bin/bashuser3:x:2005:2005::/home/user3:/bin/basha1:x:2006:2006::/home/a1:/bin/basha2:x:2007:2007::/home/a2:/bin/bashhadoop:x:2008:2008::/home/hadoop:[root@localhost ~]# grep -v “/sbin/nologin$” /etc/passwd | cut -d: -f1
root
sync
shutdown
halt
centos
fedora
mageia
slackware
user1
user2
user3
a1
a2
hadoop
bash
testbash
basher
[root@localhost ~]#[root@localhost ~]# grep “/bin/bash$” /etc/passwdroot:x:0:0:root:/root:/bin/bashcentos:x:500:500::/home/centos:/bin/bashfedora:x:501:501::/home/fedora:/bin/bashmageia:x:1100:1100::/home/linux:/bin/bashuser1:x:2003:2003::/home/user1:/bin/bashuser2:x:2004:2004::/home/user2:/bin/bashuser3:x:2005:2005::/home/user3:/bin/basha1:x:2006:2006::/home/a1:/bin/basha2:x:2007:2007::/home/a2:/bin/bash[root@localhost ~]# grep “/bin/bash$” /etc/passwd | cut -d: -f1rootcentosfedoramageiauser1user2user3a1a2
[root@localhost ~]# grep -E “\<[0-9]{1,2}\>” /etc/passwd –color=autoroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:FTP User:/var/ftp:/sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinrpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinhaldaemon:x:68:68:HAL daemon:/:/sbin/nologinntp:x:38:38::/etc/ntp:/sbin/nologinapache:x:48:48:Apache:/var/www:/sbin/nologinsaslauth:x:498:76:Saslauthd user:/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologintcpdump:x:72:72::/:/sbin/nologin
[root@localhost ~]# grep -E “^[[:space:]]+” /boot/grub/grub.conf
[root@localhost ~]# grep -E “^#[[:space:]]+[^[:space:]]+” /etc/rc.d/rc.sysinit
[root@localhost ~]# netstat -tan | grep “LISTEN[[:space:]]*$”
[root@localhost ~]# useradd bash[root@localhost ~]# useradd testbash[root@localhost ~]# useradd basher[root@localhost ~]# useradd nologin -s /sbin/nologin[root@localhost ~]# tail -4 /etc/passwdbash:x:2009:2009::/home/bash:/bin/bashtestbash:x:2010:2010::/home/testbash:/bin/bashbasher:x:2011:2011::/home/basher:/bin/bashnologin:x:2012:2012::/home/nologin:/sbin/nologin[root@localhost ~]# grep -E “(^[^:]+).*\1$” /etc/passwd -osync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltnobody:x:99:99:Nobody:/:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinntp:x:38:38::/etc/ntp:/sbin/nologinbash:x:2009:2009::/home/bash:/bin/bashbasher:x:2011:2011::/home/basher:/bin/bashnologin:x:2012:2012::/home/nologin:/sbin/nologin
本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/99938
评论列表(1条)
写的很好,可以用来当范文展示了