DevOps Challenge
๐ฅ ๋ค์ด๊ฐ๋ฉฐ
DevOps๋ก ๋์๊ฐ๊ธฐ ์ํด ์ฑ๋ฆฐ์ง๋ฅผ ์์ํ๋ค. ์ด ๊ณณ์์ ์งํ์ค์ด๋ค. 100์ผ ์ฑ๋ฆฐ์ง์ธ๋ฐ ๋งค์ผ ์ด ๊ธ์ ๊ธฐ๋กํ๋ ค ํ๋ค.
Day1 - Linux User Setup with Non-Interactive Shell
Overview
| Item | Description |
|---|---|
| Date | 2026-05-30 Sat. |
| Category | Linux / User Management |
| Difficulty | Easy |
| Environment | KodeKloud / Nautilus |
| Keywords | useradd, nologin, non-interactive shell |
Problem
To accommodate the backup agent toolโs specifications, the system admin team at
xFusionCorp Industriesrequires the creation of a user with a non-interactive shell. Hereโs your task:Create a user named
mariyamwith a non-interactive shell onApp Server1.
Explanation
๋ฌธ์ ์ ์๊ตฌ์ฌํญ์
App Server 1์ mariyam ์ด๋ผ๋ ์ฌ์ฉ์๋ฅผ ์์ฑํ๋๋ฐ, ๋ก๊ทธ์ธ ๊ฐ๋ฅํ ์ผ๋ฐ ์์ด ์๋๋ผ
๋น๋ํํ(non-interactive) shell๋ก ์ค์ ํ๋ผ
๋ ๋ป์ด๋ค.
๋ณดํต ๋ฆฌ๋ ์ค์์ ๋ก๊ทธ์ธ ๋ชป ํ๋ ๊ณ์ ์ ๋ง๋ค ๋ ์ฌ์ฉํ๋ค. ์๋ฅผ ๋ค์ด, ๋ฐฑ์ ์์ด์ ํธ, ์์คํ ์๋น์ค, ๋ฐ๋ชฌ ๊ณ์ ๊ณผ ๊ฐ์ ๊ฒ๋ค์ ํ์ผ ๊ถํ๋ง ํ์ํ์ง ์ฌ๋์ด SSH ๋ก๊ทธ์ธํ ํ์๋ ์๊ธฐ ๋๋ฌธ์ด๋ค. ์ผ๋ฐ์ ์ผ๋ก ์๋์ ์์ ์ฌ์ฉํ๋ค.
/sbin/nologin/usr/sbin/nologin/bin/false
์ผ๋ฐ์ ์ผ๋ก nologin์ ๋ง์ด ์ฌ์ฉํ๋ค๊ณ ํ๋ค.
์ถ๊ฐ๋ก non-interactive shell์ ๋จ์ํ โ๋ก๊ทธ์ธ์ ๋ง๋ ๊ฒโ ์ด์์ ์๋ฏธ๋ฅผ ๊ฐ์ง๋ค.
Linux์์๋ ์๋น์ค ์คํ์ฉ ๊ณ์ ์ด๋ ์์คํ
๊ณ์ ์ ์์ฑํ ๋ ๋ณด์์ ์ํด ๋ก๊ทธ์ธ ๊ธฐ๋ฅ์ ์ ํํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค. ๋ง์ฝ ์ผ๋ฐ shell(/bin/bash ๋ฑ)์ ๋ถ์ฌํ๋ฉด ํด๋น ๊ณ์ ์ผ๋ก SSH ๋ก๊ทธ์ธ์ด๋ shell ์ ๊ทผ์ด ๊ฐ๋ฅํด์ง ์ ์๊ธฐ ๋๋ฌธ์ด๋ค.
๋ฐ๋ฉด nologin์ด๋ false๋ฅผ ์ฌ์ฉํ๋ฉด ๊ณ์ ์์ฒด๋ ์กด์ฌํ์ง๋ง interactive shell ์ธ์
์ ์์ํ ์ ์๊ฒ ๋๋ค. ์ฆ, ํ๋ก์ธ์ค ์คํ์ด๋ ํ์ผ ๊ถํ ๊ด๋ฆฌ ์ฉ๋๋ก๋ ์ฌ์ฉํ ์ ์์ง๋ง ์ฌ๋์ด ์ง์ ๋ก๊ทธ์ธํ ์๋ ์๋ค.
ํนํ /sbin/nologin์ ๋ก๊ทธ์ธ ์๋ ์ ์๋ด ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ ๋ค ์ข
๋ฃํ๋ฉฐ, /bin/false๋ ์๋ฌด ๋ฉ์์ง ์์ด ์ฆ์ ์ข
๋ฃ๋๋ค๋ ์ฐจ์ด๊ฐ ์๋ค.
์ค์ ์ด์ ํ๊ฒฝ์์๋ ๋ค์๊ณผ ๊ฐ์ ๊ณ์ ๋ค์ ๋๋ถ๋ถ non-interactive shell์ ์ฌ์ฉํ๋ค.
- nginx
- mysql
- postgres
- redis
- ftp ์๋น์ค ๊ณ์
- backup agent ๊ณ์
๋ฐ๋ผ์ ์ด๋ฒ ๋ฌธ์ ๋ ๋จ์ ์ฌ์ฉ์ ์์ฑ๋ณด๋ค๋ โ์๋น์ค ๊ณ์ ์ ์์ ํ๊ฒ ์์ฑํ๋ ๋ฐฉ๋ฒโ์ ์ดํดํ๋ ๊ฒ์ด ํต์ฌ์ด๋ผ๊ณ ๋ณผ ์ ์๋ค.
Answer
1
2
3
4
$ ssh tony@stapp01
$ sudo useradd -s /sbin/nologin mariyam
$ grep mariyam /etc/passwd
mariyam:x:1001:1001::/home/mariyam:/sbin/nologin
Day2 - Temporary User Setup with Expiry
Problem
As part of the temporary assignment to the Nautilus project, a developer named
ravirequires access for a limited duration. To ensure smooth access management, a temporary user account with an expiry date is needed. Hereโs what you need to do:Create a user named ravi on App Server 3 in Stratos Datacenter. Set the expiry date to
2027-04-15, ensuring the user is created in lowercase as per standard protocol.Note: You can find the infrastructure details by clicking on the Details of all Users and Servers button on the top-right section of the page.
Explanation
์ด ๋ฌธ์ ๋
ํน์ ๋ ์ง๊น์ง๋ง ์ฌ์ฉํ ์ ์๋ ์์ Linux ๊ณ์ ์ ์์ฑํ๋ผ
๋ผ๋ ๋ป์ด๋ค. ์ง์ ๋ ๋ ์ง ์ดํ์๋ ๊ณ์ ์ด ์๋ ๋ง๋ฃ๋๋๋ก ์ค์ ํด์ผ ํ๋ค.
Linux์์ ์ธ์ฃผ ์ธ๋ ฅ, ๋จ๊ธฐ ํ๋ก์ ํธ ์ธ์, ์์ ์ ๊ทผ ๊ณ์ ๊ฐ์ ์ํฉ์์ ์์ฃผ ์ฌ์ฉํ๋ค.
Answer
-e๋ฅผ ์ฌ์ฉํ๋ฉด ๋ง๋ฃ ๋ ์ง๋ฅผ ์ง์ ํ ์ ์๋ค.
-e: expiry date ์ง์ ์ต์
1
2
3
4
5
6
7
8
9
10
11
$ ssh banner@stapp03
$ sudo useradd -e 2027-04-15 ravi
$ sudo chage -l ravi
Last password change : May 31, 2026
Password expires : never
Password inactive : never
Account expires : Apr 15, 2027
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7