/////
Search
๐Ÿ•ถ๏ธ

sudo password

โ†’ Your password has to expire every 30 days.
โ†’ The minimum number of days allowed before the modification of a password will be set to 2.
โ†’ The user has to receive a warning message 7 days before their password expires.
โ†’ Your password must be at least 10 characters long. It must contain an uppercase letter and a number. Also, it must not contain more than 3 consecutive identical characters.
โ†’ The password must not include the name of the user.
โ†’ The following rule does not apply to the root password: The password must have at least 7 characters that are not part of the former password.
โ†’ Of course, your root password has to comply with this policy.
ํ•ด์„ โ†’ ๋‹น์‹ ์˜ ํŒจ์Šค์›Œ๋“œ๋Š” 30์ผ๋งˆ๋‹ค ์†Œ๋ฉธ๋˜์–ด์•ผ ํ•œ๋‹ค. โ†’ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ์„ ์œ„ํ•ด ๊ธฐ๋‹ค๋ ค์•ผ ํ•˜๋Š” ์‹œ๊ฐ„์€ ์ตœ์†Œ ์ดํ‹€๋กœ ์„ค์ • ๋˜์–ด์•ผ ํ•œ๋‹ค. โ†’ user ๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ ์†Œ๋ฉธ 7์ผ ์ „์— ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›์•„์•ผ ํ•œ๋‹ค. โ†’ ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์ตœ์†Œ 10๊ธ€์ž ์ด์ƒ์ด ๋˜์–ด์•ผ ํ•˜๊ณ , ๋Œ€๋ฌธ์ž์™€ ์†Œ๋ฌธ์ž๋ฅผ ํฌํ•จํ•˜์—ฌ์•ผ ํ•˜๋ฉฐ, ๊ฐ™์€ ๊ธ€์ž๊ฐ€ 3๋ฒˆ ์ด์ƒ ์—ฐ์†๋˜๋ฉด ์•ˆ๋œ๋‹ค. โ†’ ๋น„๋ฐ€๋ฒˆํ˜ธ์— ์œ ์ €๋ช…์ด ํฌํ•จ๋˜๋ฉด ์•ˆ๋œ๋‹ค. โ†’ ๋‹ค์Œ ๊ทœ์น™์€ root ๋น„๋ฐ€๋ฒˆํ˜ธ์— ์ ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค. : ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์ด์ „ ๋น„๋ฐ€๋ฒˆํ˜ธ์— ํฌํ•จ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ž๋ฅผ ์ตœ์†Œ 7๊ฐœ ์ด์ƒ ํฌํ•จํ•˜์—ฌ์•ผ ํ•œ๋‹ค. โ†’ ๋‹น์—ฐํžˆ ๋ฃจํŠธ ๊ถŒํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋˜ํ•œ ์ด ๊ทœ์น™์„ ๋”ฐ๋ผ์•ผ ํ•œ๋‹ค.
๋น„๋ฐ€๋ฒˆํ˜ธ ์ •์ฑ… ์„ค์ •์„ ์œ„ํ•ด ์ˆ˜์ •ํ•ด์•ผ ํ•˜๋Š” ํŒŒ์ผ์€ /etc/login.defs์— ์žˆ๋‹ค.
$ sudo apt-get install vim
Shell
๋ณต์‚ฌ
# ๋น„๋ฐ€๋ฒˆํ˜ธ ์ตœ๋Œ€ ์‚ฌ์šฉ ๊ธฐ๊ฐ„ PASS_MAX_DAYS 30 # ๋น„๋ฐ€๋ฒˆํ˜ธ ์ตœ์†Œ ์‚ฌ์šฉ ๊ธฐ๊ฐ„ PASS_MIN_DAYS 2 # ๋น„๋ฐ€๋ฒˆํ˜ธ ๋งŒ๋ฃŒ ๊ฒฝ๊ณ  ๊ธฐ๊ฐ„ ( 7์ผ ์ „๋ถ€ํ„ฐ ) PASS_WARN_AGE 7
Shell
๋ณต์‚ฌ
์ดํ›„ ์ถ”๊ฐ€์ ์ธ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ •์ฑ… ๋ณ€๊ฒฝ์„ ์œ„ํ•ด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ถ”๊ฐ€ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค
$ sudo apt-get install libpam-pwquality
Shell
๋ณต์‚ฌ
์„ค์ •ํŒŒ์ผ ์˜คํ”ˆ
$ sudo vi /etc/pam.d/common-password
Shell
๋ณต์‚ฌ
๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •
Option
Description
value
retry
๋ฐ˜๋ณต ์‹œ๋„ ๊ฐ€๋Šฅ ํšŸ์ˆ˜
3
minlen
๋น„๋ฐ€๋ฒˆํ˜ธ ์ตœ์†Œ ๊ธธ์ด
10
difok
์ด์ „ ๋น„๋ฐ€๋ฒˆํ˜ธ์— ํฌํ•จ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ž ์ตœ์†Œ ๊ฐœ์ˆ˜
7
ucredit
๋Œ€๋ฌธ์ž ํฌํ•จ ๊ทœ์น™
-1 (์ตœ์†Œ ํ•œ ๊ธ€์ž ์ด์ƒ)
dcredit
์ˆซ์ž ํฌํ•จ ๊ทœ์น™
-1 (์ตœ์†Œ ํ•œ ๊ธ€์ž ์ด์ƒ)
reject_username
์œ ์ € ๋ช… ํฌํ•จ ๊ธˆ์ง€
enforce_for_root
root์— ์ ์šฉ
maxrepeat
๊ฐ™์€ ๊ธ€์ž ์—ฐ์† ์ œํ•œ
3
Documentation์˜ ๋‚ด์šฉ ์ค‘ difok ๊ทœ์น™์€ root์— ์ ์šฉํ•˜์ง€ ๋ง์•„์•ผ ํ•œ๋‹ค๊ณ  ๋‚˜์™€์žˆ๋‹ค. ํ•˜์ง€๋งŒ, ๋ณธ ๊ทœ์น™์—์„œ๋Š” difok ๊ทœ์น™์„ enforce_for_root ์˜ต์…˜๊ณผ ํ•จ๊ป˜ ์ž‘์„ฑํ•˜์—ฌ ๋ฃจํŠธ์—๋„ ์ ์šฉ์„ ํ•ด ์ค€ ๊ฒƒ ์ฒ˜๋Ÿผ ๋ณด์ด์ง€๋งŒ, difok ๊ทœ์น™์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์ด์ „ ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ €์žฅ๋˜์–ด์•ผ ํ•œ๋‹ค. ํ•˜์ง€๋งŒ root๋Š” ์ด์ „ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ €์žฅํ•˜์ง€ ์•Š์•„ difok ๊ทœ์น™์ด ๋ฌด์‹œ๋œ๋‹ค. ๊ธฐํƒ€ ๊ทœ์น™์€ ย ์ด ๋งํฌ ์ฐธ๊ณ !
ํŒŒ์ผ ์ €์žฅ ํ›„ ์ ์šฉ์„ ์œ„ํ•ด ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•œ๋‹ค. ๋‹ค์Œ ๋กœ๊ทธ์ธ ์‹œ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๊ทœ์น™์— ๋งž๊ฒŒ ๊ฐ•์ œ ๋ณ€๊ฒฝํ•˜๋„๋ก ํ•œ๋‹ค.
$ passwd -e root $ passwd -e [username] # [username]์€ ์›ํ•˜๋Š” ๊ฐ’ ์ž…๋ ฅ
Shell
๋ณต์‚ฌ
์žฌ ๋กœ๊ทธ์ธ ์‹œ ํŒจ์Šค์›Œ๋“œ ๋ณ€๊ฒฝ ์•Œ๋ฆผ ๋ชจ์Šต
/etc/shadow ๋ฅผ ํ™•์ธํ•ด ๋ณด์•˜์„ ๋•Œ root ์™€ mcha ์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ตœ์†Œ ์‚ฌ์šฉ์ผ, ์†Œ๋ฉธ ์ผ, ๊ฒฝ๊ณ  ์ผ์ด ๋ณ€๊ฒฝ ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค. ๋”ฐ๋ผ์„œ ์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ๊ฐ•์ œ ๋ณ€๊ฒฝ ํ•ด์ค€๋‹ค.
$ chage -m 2 -M 30 -W 7 root $ chage -m 2 -M 30 -W 7 [username]
Shell
๋ณต์‚ฌ
โ†’ ๋ณ€๊ฒฝ ๋œ ๋ชจ์Šต