修改SSH警告:不允许root登录

时间:2014-07-15 15:35:37

标签: linux ssh amazon-ec2 rhel

我正在尝试修改以root用户身份登录时由Amazon实例抛出的SSH警告。

这就是我得到的: “请以用户”ec2-user“而不是用户”root“登录。”

此文件位置存储在RHEL 6.5中的哪个位置?

谢谢!

1 个答案:

答案 0 :(得分:0)

# this will create file sshd_banner
echo -e "You are not allowed to login using root." >> /etc/ssh/sshd_banner
echo "Please, use 'ec2-user' instead." >> /etc/ssh/sshd_banner

之后手动编辑sshd_config文件,编辑您之前创建的横幅文件的路径:

Banner /etc/ssh/sshd-banner

当然,不要忘记重启sshd。

尝试使用grep:

搜索此警告字符串
grep -rn ec2.user /etc/ssh