brunch

4. 리눅스 서버 root ssh 제한 하기

by Master Seo

# ISMS-P 보안 필수 요건.

# 리눅스서버의 경우 root로 로그인 하는 부분의 제한이 필요하다.

# 로키 리눅스에 root로 로그인 하는 부분을 차단하자.

# 일반 계정을 만든후 root로 재 로그인해 사용하자.




<1> 로키 리눅스 8.10 root ssh 차단 설정법

<2> 로키 리눅스 9.4 root ssh 차단 설정법




<1> 로키 리눅스 8.10 root ssh 차단 설정법


1

일반 계정 만든다.

일반계정으로 로그온 한다.


[root@was1 ~]# useradd topasvga

[root@was1 ~]# passwd topasvga

Changing password for user topasvga.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.




2

root 계정 로그온 차단 설정한다.


[root@was1 ~]# cd /etc/ssh/

[root@was1 ssh]# vi sshd_config


# 44번째줄

PermitRootLogin no



3

systemctl restart sshd


4

[root@was1 ~]# ssh -l root 127.0.0.1

The authenticity of host '127.0.0.1 (127.0.0.1)' can't be establish

Permission denied, please try again.



[root@was1 ssh]# ssh -l topasvga 127.0.0.1

topasvga@127.0.0.1's password:


[topasvga@was1 ~]$ su - root

Password:





<2> 로키 리눅스 9.4 root ssh 차단 설정법



1

일반 계정 만든다.

일반계정으로 로그온 한다.


useradd topasvga


passwd topasvga

Changing password for user topasvga.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.




2

root 계정 로그온 차단 설정한다.


more /etc/redhat-release

Rocky Linux release 9.4 (Blue Onyx)



cd /etc/ssh/sshd_config.d/



3

vi 01-permitrootlogin.conf


# This file has been generated by the Anaconda Installer.

# Allow root to log in using ssh. Remove this file to opt-out.

PermitRootLogin no

PasswordAuthentication yes

~

~


4

systemctl restart sshd



5

재 접속


login as: topasvga

topasvga@223.130.138.120's password:

Welcome to Naver Cloud Platform Server!

Authorized access only!

If you are not authorized to access this system, disconnect now!

------------------------------------------------------------------------------------------------------------

Last failed login: Wed Jul 16 12:15:07 KST 2025 from 121.135.135.171 on ssh:notty

There were 4 failed login attempts since the last successful login.



[topasvga@book1 ~]$ su - root

Password:



다음

https://brunch.co.kr/@topasvga/4728


keyword
매거진의 이전글3. 로키 리눅스