SSH 접속자가 사용할 명령어를 제한한다.
(Red Hat 계열)
vi /etc/ssh/sshd_config
AuthorizedKeysFile %h/.ssh/id_rsa.pub #.ssh/authorized_keys 주석
PermitEmptyPasswords no
systemctl restart sshd.service
adduser xxxxxx
su xxxxxx
ssh-keygen -t rsa
exit
vi /home/xxxxxx/.ssh/id_rsa.pub
command="/etc/allowed-commands.sh" #ssh-rsa ~ 앞에 붙힘
vi /etc/allowed-command.sh #예
#!/bin/sh
/bin/echo "Welcome!
Your choices are:
1 : View server time
2 : View login time
q : Quit"
/bin/echo "Your choice:"
read ans
while [ "$ans" != "q" ]
do
case "$ans" in
1)
/bin/date
;;
2)
/usr/bin/who am i
;;
q)
/bin/echo "Goodbye!"
exit 0
;;
*)
/bin/echo "Invalid choice '$ans': Please try again"
;;
esac
/bin/echo "Your choice:"
read ans
done
exit 0
개인키 id_rsa를 다운로드 또는 복사, Putty에서는 ppk로 변환해서 사용
'보안' 카테고리의 다른 글
| MS Sql Server 서비스 Windows 방화벽 허용 (0) | 2026.08.14 |
|---|---|
| 사용자 암호변경 제한 (0) | 2026.08.07 |
| MS SQL Server 랜섬웨어 감염 사례 (0) | 2026.08.04 |
| 공유폴더 랜섬웨어 피해 대비 (0) | 2026.08.04 |
| ESXi에서 root 비활성 (0) | 2026.08.03 |