OS/Rocky
[Linux/Rocky] SSH Root 로그인하는 방법 (root 접속 허용)
scii
2023. 9. 10. 00:42
/etc/ssh/sshd_config 파일이다. ssh_config에 "PermitRootLogin yes" 라인을 추가했다가 지웠다하면서... sshd 서비스 재시작을 계속하면서... 도대체 왜 안될까? 삽질을 했다.
방법 1) sshd_config파일에 추가하는 방법
/etc/ssh/sshd_config 파일 마지막에 다음과 같은 라인을 추가하고 ssh 데몬을 재시작하면 root 계정으로 ssh 접속이 가능해진다.
# /etc/ssh/sshd_config 파일의 마지막 라인에 추가.
...
PermitRootLogin yes
# 그 후, ssh 데몬 재시작
systemctl restart sshd
방법 2) sshd_config.d 디렉토리에 conf파일을 추가하는 방법
vim /etc/ssh/sshd_config.d/01-permitrootlogin.conf
# 해당 파일 내용에 다음과 같은 라인 추가
PermitRootLogin yes
# ssh 데몬 재시작
systemctl restart sshd
참고 사이트
https://www.centlinux.com/2023/05/disable-ssh-root-login-in-rocky-linux-9.html
Disable SSH Root Login in Rocky Linux 9
© 2023 CentLinux. All Rights Reserved.
www.centlinux.com