VPS 好比一个 Internet 上的独立服务器,有 root 权限,有独立 IP,完全暴露在 Internet上,所以用 root 登录 VPS 操作时要特别注意安全问题,这年头无聊的人太多了
如果你对安全问题还有犹豫,抱有“我这个小站没人理”的想法,那么打开 /var/log/secure 看看有多少 IP 多少次企图登录你的服务器?
刚开通的一个 VPS 还来不及用,过几天打开 /var/log/secure 一看,发现 n 个 IP 访问了 n 次。一个 IP 地址为 213.115.115.113 的机器1天内2600多次猜测用户名/密码企图登录。
这是 log 文件片段:
Jun 28 13:49:23 blog sshd[3462]: Received disconnect from 213.115.115.113: 11: Bye Bye
Jun 28 13:49:24 blog sshd[3695]: Invalid user radu from 213.115.115.113
Jun 28 13:49:24 blog sshd[3703]: input_userauth_request: invalid user radu
Jun 28 13:49:24 blog sshd[3695]: pam_unix(sshd:auth): check pass; user unknown
Jun 28 13:49:24 blog sshd[3695]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=static-213-115-115-113.sme.bredbandsbolaget.se
Jun 28 13:49:26 blog sshd[3695]: Failed password for invalid user radu from 213.115.115.113 port 51310 ssh2
Jun 28 13:49:26 blog sshd[3703]: Received disconnect from 213.115.115.113: 11: Bye Bye
Jun 28 13:49:27 blog sshd[3910]: Invalid user raducu from 213.115.115.113
Jun 28 13:49:27 blog sshd[3921]: input_userauth_request: invalid user raducu
Jun 28 13:49:27 blog sshd[3910]: pam_unix(sshd:auth): check pass; user unknown
Jun 28 13:49:27 blog sshd[3910]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=static-213-115-115-113.sme.bredbandsbolaget.se
Jun 28 13:49:30 blog sshd[3910]: Failed password for invalid user raducu from 213.115.115.113 port 52740 ssh2
Jun 28 13:49:30 blog sshd[3921]: Received disconnect from 213.115.115.113: 11: Bye Bye
Jun 28 13:49:31 blog sshd[5280]: Invalid user raul from 213.115.115.113
Jun 28 13:49:31 blog sshd[5293]: input_userauth_request: invalid user raul
Jun 28 13:49:31 blog sshd[5280]: pam_unix(sshd:auth): check pass; user unknown
Jun 28 13:49:31 blog sshd[5280]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=static-213-115-115-113.sme.bredbandsbolaget.se
Jun 28 13:49:33 blog sshd[5280]: Failed password for invalid user raul from 213.115.115.113 port 54742 ssh2
Jun 28 13:49:34 blog sshd[5293]: Received disconnect from 213.115.115.113: 11: Bye Bye
Jun 28 13:49:35 blog sshd[5540]: Invalid user robert from 213.115.115.113
Jun 28 13:49:35 blog sshd[5570]: input_userauth_request: invalid user robert
Jun 28 13:49:35 blog sshd[5540]: pam_unix(sshd:auth): check pass; user unknown
Jun 28 13:49:35 blog sshd[5540]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=static-213-115-115-113.sme.bredbandsbolaget.se
Jun 28 13:49:37 blog sshd[5540]: Failed password for invalid user robert from 213.115.115.113 port 56483 ssh2