cat /etc/passwd cut -f1 -d: /etc/passwd
[root@zetawiki ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin .. (생략) named:x:25:25:Named:/var/named:/sbin/nologin
[root@zetawiki ~]# cut -f1 -d: /etc/passwd root bin daemon .. (생략) named
useradd로 계정을 만들면 기본적으로 /bin/bash 환경이 적용된다. bash 사용자 목록이 의미 있는 경우가 많다.
grep /bin/bash /etc/passwd grep /bin/bash /etc/passwd | cut -f1 -d:
[root@zetawiki ~]# grep /bin/bash /etc/passwd root:x:0:0:root:/root:/bin/bash mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
[root@zetawiki ~]# grep /bin/bash /etc/passwd | cut -f1 -d: root mysql
awk -F':' '{if($3>=500)print $1}' /etc/passwd
[root@zetawiki ~]# tail -6 /etc/passwd saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin devuser:x:500:500::/home/devuser:/bin/bash deployuser:x:501:501::/home/deployuser:/bin/bash testuser:x:502:502::/home/testuser:/bin/bash
[root@zetawiki ~]# awk -F':' '{if($3>=500)print $1}' /etc/passwd devuser deployuser testuser
u1=$(grep "^UID_MIN" /etc/login.defs | awk '{print $2}') u2=$(grep "^UID_MAX" /etc/login.defs | awk '{print $2}') awk -F':' -v "u1=$u1" -v "u2=$u2" '{ if ( $3>=u1 && $3<=u2 ) print $0}' /etc/passwd awk -F':' -v "u1=$u1" -v "u2=$u2" '{ if ( $3>=u1 && $3<=u2 ) print $1}' /etc/passwd
[root@zetawiki ~]# u1=$(grep "^UID_MIN" /etc/login.defs | awk '{print $2}') [root@zetawiki ~]# u2=$(grep "^UID_MAX" /etc/login.defs | awk '{print $2}') [root@zetawiki ~]# awk -F':' -v "u1=$u1" -v "u2=$u2" '{ if ( $3>=u1 && $3<=u2 ) print $0}' /etc/passwd devuser:x:500:500::/home/devuser:/bin/bash deployuser:x:501:501::/home/deployuser:/bin/bash testuser:x:502:502::/home/testuser:/bin/bash
[root@zetawiki ~]# awk -F':' -v "u1=$u1" -v "u2=$u2" '{ if ( $3>=u1 && $3<=u2 ) print $1}' /etc/passwd devuser deployuser testuser
a=$(grep ^UID_MIN /etc/login.defs | awk '{print $2}') b=$(grep ^UID_MAX /etc/login.defs | awk '{print $2}') c=$(grep /bin/bash /etc/passwd | awk -F':' '{print $1}') d=$(awk -F':' -v "a=$a" -v "b=$b" '{ if ( $3>=a && $3<=b ) print $1}' /etc/passwd) echo -e "$c\n$d" | sort | uniq
[root@zetawiki ~]# a=$(grep ^UID_MIN /etc/login.defs | awk '{print $2}') [root@zetawiki ~]# b=$(grep ^UID_MAX /etc/login.defs | awk '{print $2}') [root@zetawiki ~]# c=$(grep /bin/bash /etc/passwd | awk -F':' '{print $1}') [root@zetawiki ~]# d=$(awk -F':' -v "a=$a" -v "b=$b" '{ if ( $3>=a && $3<=b ) print $1}' /etc/passwd) [root@zetawiki ~]# echo -e "$c\n$d" | sort | uniq root devuser deployuser testuser
[root@zetawiki ~]# c=$(grep /bin/bash /etc/passwd | awk -F':' '{print $0}') [root@zetawiki ~]# d=$(awk -F':' -v "a=$a" -v "b=$b" '{ if ( $3>=a && $3<=b ) print $0}' /etc/passwd) [root@zetawiki ~]# echo -e "$c\n$d" | sort | uniq root:x:0:0:root:/root:/bin/bash devuser:x:500:500::/home/devuser:/bin/bash deployuser:x:501:501::/home/deployuser:/bin/bash testuser:x:502:502::/home/testuser:/bin/bash
Designed by sketchbooks.co.kr / sketchbook5 board skin
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5