μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- SQL
- λ§₯μΌμ΄λΈ
- μ λ ¬
- μκ³ λ¦¬μ¦
- Linux
- 리λ μ€
- ROS2
- λ€νΈμν¬ μΆ©λ
- 3dof
- homogenous
- ν΄μ± ν¨μ
- CentOS
- Computer
- μ μ²κΈ°
- νμ 볡μ‘λ
- μ 보μ²λ¦¬κΈ°μ¬
- Java
- sort
- 기ꡬν
- μ»΄ν¨ν°κ΅¬μ‘°
- segmentation
- homogeinous
- sam2
- AI
- λͺ λ Ήμ΄
- ν©λ³
- robotics
- Coding
- μμ€ μ½λ νμ§ λΆμ
- MIPS
- Today
- Total
UTF-404
su μ λν΄ μμ보μ!!π§π»π» λ³Έλ¬Έ
π‘ suλ ?
β‘οΈ su(substitute userμ μ€μλ§)λ μ λμ€ λͺ λ Ήμ λ‘κ·Έμμνμ§ μκ³ λ€λ₯Έ μ¬μ©μμ κΆνμΌλ‘ μ Έμ μ€ννλλ° μ¬μ©λλ€. μΌλ°μ μΌλ‘ κ΄λ¦¬ μμ μ μν΄ λ€μ λ‘κ·Έμ€ννμ§ μκ³ μ¬μ©μμ κΆνμ 루νΈλ‘ λ³κ²½νλλ° μ¬μ©λλ€. κ°μ λ°©λ²μΌλ‘ λ€λ₯Έ μ¬μ©μλ‘ μ ννλ λ° μ¬μ©λλ€.
https://ko.wikipedia.org/wiki/Su_(%EC%9C%A0%EB%8B%89%EC%8A%A4)
su (μ λμ€) - μν€λ°±κ³Ό, μ°λ¦¬ λͺ¨λμ λ°±κ³Όμ¬μ
μν€λ°±κ³Ό, μ°λ¦¬ λͺ¨λμ λ°±κ³Όμ¬μ . su(substitute user[1]μ μ€μλ§)λ μ λμ€ λͺ λ Ήμ λ‘κ·Έμμνμ§ μκ³ λ€λ₯Έ μ¬μ©μμ κΆνμΌλ‘ μ Έμ μ€ννλ λ° μ¬μ©λλ€. μΌλ°μ μΌλ‘ κ΄λ¦¬ μμ μ μν΄ λ€μ λ‘κ·Έ
ko.wikipedia.org
π‘ /su λͺ λ Ή μ¬μ©λ°©λ²!!
- κ³μ μ μ ννκΈ° μν΄μ suλ₯Ό μ€ννλ€.
- su λͺ λ Ήμ λμ κ³μ μ νμΈνκ³ ν¨μ€μλλ₯Ό μ λ ₯λ°λλ€.
- μ¬μ©μκ° μ λ ₯ν ν¨μ€μλλ₯Ό /etc/shadow μ λΉκ΅ν΄μΌ νλ€.
- /etc/shadowλ 000 νΌλ―Έμ μ΄λ―λ‘, rootκ° μλλ©΄ μ΄λμ΄ λΆκ°νλ€.
- λ°λΌμ, suλ₯Ό μ€ννλλ°μλ λ¬Έμ κ° μμ΄λ λΉλ°λ²νΈ μΌμΉλ₯Ό νμΈν μ μλ€.
π su 보μ μ€μ λ° root μ격 μ μ μ°¨λ¨!!
[root@localhost ~]# useradd admin
[root@localhost ~]# usermod admin -G wheel
[root@localhost ~]# echo 1 | passwd --stdin admin
admin μ¬μ©μμ λΉλ° λ²νΈ λ³κ²½ μ€
passwd: λͺ¨λ μΈμ¦ ν ν°μ΄ μ±κ³΅μ μΌλ‘ μ λ°μ΄νΈ λμμ΅λλ€.
[root@localhost ~]# ls -l /bin/su
-rwsr-xr-x. 1 root root 34904 2016-05-11 17:59 /bin/su
[root@localhost ~]# chown .wheel /bin/su
[root@localhost ~]# chmod 4750 /bin/su
[root@localhost ~]# ls -l /bin/su
-rwsr-x---. 1 root wheel 34904 2016-05-11 17:59 /bin/su
[root@localhost ~]# vi /etc/ssh/sshd_config
[root@localhost ~]# cat -n /etc/ssh/sshd_config | grep 42
42 PermitRootLogin no
[root@localhost ~]# service sshd restart
sshd λ₯Ό μ μ§ μ€: [ OK ]
sshd (μ)λ₯Ό μμ μ€: [ OK ]
- su λͺ λ Ήμ΄λ λμμ μ§μ νμ§ μμΌλ©΄ root κ³μ μΌλ‘ μ νμ μλνλ€.
- su λͺ λ Ήμ΄λ κ³μ λ§ μ ννκ³ , νκ²½μμλ₯Ό λΆλ¬μ€μ§ μλλ€.
- su - λ‘ μ€ννλ©΄ κ³μ μ μ ννλ©΄μ, λμ κΌμ μ νκ²½μμκΉμ§ λͺ¨λ λΆλ¬μ¨λ€.
π wheel κ·Έλ£Ή μ¬μ©μμκ² sudo λͺ
λ Ήμ΄ νμ©νκΈ°!!
β‘οΈ sudo λ κ³μ μ μ ννμ§ μκ³ μλ, κ΄λ¦¬μ λͺ
λ Ήμ μ€νν μ μλλ‘ νλ€.
root@localhost ~]# visudo
[root@localhost ~]# cat -n /etc/sudoers | head -101 | tail -5
97 ## Allows people in group wheel to run all commands
98 %wheel ALL=(ALL) ALL
99
100 ## Same thing without a password
101 %wheel ALL=(ALL) NOPASSWD: ALL
[root@localhost ~]#
[admin@localhost ~]$ sudo service network restart
μΈν°νμ΄μ€ eth0 (μ)λ₯Ό μ’ λ£ μ€: μ₯μΉ μν: 3 (μ°κ²° λκ²Όμ)
[ OK ]
loopback μΈν°νμ΄μ€ μ’ λ£ μ€: [ OK ]
loopback μΈν°νμ΄μ€ νμ±νμ€ μ λλ€: [ OK ]
eth0 μΈν°νμ΄μ€ νμ±νμ€ μ λλ€: νμ±νλ μ°κ²° μν: νμ±νλ¨
νμ±νλ μ°κ²° κ²½λ‘: /org/freedesktop/NetworkManager/ActiveConnection/1
[ OK ]
πsudo μμ μ΄ν, λͺ¨λ root κ³μ μ μ κ·Όμ μ°¨λ¨ (κΈ°λ³Έμμ nologinμΌλ‘ λ³κ²½)
[admin@localhost ~]$ usermod root -s /sbin/nologin
-bash: /usr/sbin/usermod: νκ° κ±°λΆ
[admin@localhost ~]$ sudo usermod root -s /sbin/nologin
[admin@localhost ~]$ cat /etc/passwd | head -1
root:x:0:0:root:/root:/sbin/nologin
[admin@localhost ~]$ su -
μνΈ:
This account is currently not available.
'리λ μ€' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
λ§μ΄νΈ κ°λ μμ보기(1) (0) | 2024.02.03 |
---|---|
리λ μ€ κΆν μ¬ν(2)!! π§π»βπ» (0) | 2024.02.03 |
리λ μ€ κΆν μ¬ν(1)!! π§π»βπ» (0) | 2024.01.24 |
리λ μ€ κΆνμ λν΄ μμ보μ!! (2) | 2024.01.22 |
리λ μ€ κ³μ (2) (0) | 2024.01.21 |