Bash 랜덤 패스워드 생성

1 개요[ | ]

random complex password generator
랜덤 패스워드 생성

2 base 16[ | ]

head /dev/urandom | md5sum
head /dev/urandom | sha1sum
$ head /dev/urandom | md5sum
295a3aa99c41bbe8cad13c86d1cd3b5b  -
$ head /dev/urandom | sha1sum
7e8578e965b45bd000439bb36eb40de31b8133b8  -

3 base 62 (alnum)[ | ]

testuser@localhost:~$ cat /dev/urandom | tr -cd "[:alnum:]" | head -c 16; echo
hdjOc1gjcaOGUE2G
testuser@localhost:~$ cat /dev/urandom | tr -cd "[:alnum:]" | head -c 32; echo
88PUO0LiJNSYhmkxhGQzRTmUlQwNMEWz

4 base 64[ | ]

base64 /dev/urandom | head -c32
base64 /dev/urandom | head -1
$ base64 /dev/urandom | head -c32
M5WB9OTY0fiydZkoBZVhLw07s1O8tRw
$ base64 /dev/urandom | head -c32
9+0SO/FD9r+v7YM1o3juS9573hojBxwK
$ base64 /dev/urandom | head -1
g0THG3/uSMumZvREof+Bo99ZZqYtRtDjxsNgAwYuDOt0EsBJZ+vD9LUe3CUefkI1zusKQfvar8EL

5 기타[ | ]

testuser@localhost:~$ cat /dev/urandom | tr -cd "[:alnum:][:graph:]" | head -c 16
N~#:+?sf}`J8Q)O5
testuser@localhost:~$ cat /dev/urandom | tr -cd "[:alnum:][:graph:]" | head -c 32
~MlO~{rMH-Q>~KN}L&f$FzH!PP];&Jl$

6 관리자도 알 수 없는 랜덤 패스워드 지정[ | ]

명령어
echo "계정명:$(base64 /dev/urandom | head -1)" | chpasswd
실행예시
root@localhost:~$ cat /etc/shadow | grep testuser
testuser:$6$ayXX4iHhNIGvybNF$sQJkmLNuIZ/7OX0ctYed2XpnvcUG27XrMSwI//K6pPva0DsW6VlcFXeUlUExO92IWDbtdSSPpEDAVXX1wBU6j0:18786:0:99999:7:::
root@localhost:~$ echo "testuser:$(base64 /dev/urandom | head -1)" | chpasswd
root@localhost:~$ cat /etc/shadow | grep testuser
testuser:$6$xO5jdedzcPwS8qsC$JopOEbelAiM7FPjBPsXsQkhnS64V1Z9gE1IYjcZyazK8xHNRO8DF.TPDQqE5/pQDqGwwnZYDxbU1WJg4yTTkK/:18786:0:99999:7:::

7 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}