Ubuntu root 접속 차단.

Ubuntu 서버 새로 만들면 당근 root 접속 차단을 해야하는데 일일이 파일열어 하기 귀찮음 script로 간단하게.

[ Ubuntu ]

printf '\n%s\n' 'PermitRootLogin no' >>/etc/ssh/sshd_config

or

sed -i '/^PermitRootLogin[ \t]\+\w\+$/{ s//PermitRootLogin no/g; }' /etc/ssh/sshd_config

Leave a Reply

Your email address will not be published. Required fields are marked *