"Bash 랜덤 패스워드 생성"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
26번째 줄: 26번째 줄:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
base64 /dev/urandom | head -c32
base64 /dev/urandom | head -c32
base64 /dev/urandom | head -1
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
32번째 줄: 33번째 줄:
$ base64 /dev/urandom | head -c32
$ base64 /dev/urandom | head -c32
9+0SO/FD9r+v7YM1o3juS9573hojBxwK
9+0SO/FD9r+v7YM1o3juS9573hojBxwK
$ base64 /dev/urandom | head -1
g0THG3/uSMumZvREof+Bo99ZZqYtRtDjxsNgAwYuDOt0EsBJZ+vD9LUe3CUefkI1zusKQfvar8EL
</syntaxhighlight>
</syntaxhighlight>


48번째 줄: 51번째 줄:
{{소스헤더|명령어}}
{{소스헤더|명령어}}
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
echo "계정명:$(head /dev/urandom | md5sum)" | chpasswd
echo "계정명:$(base64 /dev/urandom | head -1)" | chpasswd
</syntaxhighlight>
</syntaxhighlight>


{{소스헤더|실행예시}}
{{소스헤더|실행예시}}
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# echo "testuser:$(head /dev/urandom | md5sum)" | chpasswd
root@localhost:~$ cat /etc/shadow | grep testuser
Changing password for user testuser.
testuser:$6$ayXX4iHhNIGvybNF$sQJkmLNuIZ/7OX0ctYed2XpnvcUG27XrMSwI//K6pPva0DsW6VlcFXeUlUExO92IWDbtdSSPpEDAVXX1wBU6j0:18786:0:99999:7:::
passwd: all authentication tokens updated successfully.
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:::
</syntaxhighlight>
</syntaxhighlight>



2021년 6월 9일 (수) 02:08 기준 최신판

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 }}