Sunday, May 15, 2016

如何配置的Linode VPS ?

之前我公司的VPS被黑客攻破了!被别人当肉鸡的感觉真的很不爽的!


所以,我们应该怎么做呢?
1  使用ssh 登陆, 验证 id_rsa.pub key

自己的电脑
在mac 生成key
ssh-keygen -t rsa
然后查看:
cat  ~/.ssh/id_rsa.pub

你可以查看到你的Key



在服务器上:
登陆你的服务器
然后:  mkdir .ssh
cd .ssh
touch authorized_keys

vim authorized_keys

You just paste your key in the file !

Now your key have add to VPS!


2  配置服务器 只允许 验证ssh key.  不使用密码登陆

cd /etc/ssh/
ls
vim sshd_config

you just find:


you add # in the line!

Now ok!

如何重启SSHD:
CentOS / RHEL / Fedora / Redhat Linux Restart SSH

# /etc/init.d/sshd restart

OR
# service sshd restart

Debian / Ubuntu Linux Restart SSH

# /etc/init.d/ssh restart

OR
# service ssh restart

FreeBSD Restart SSH

# /etc/rc.d/sshd restart

UNIX Restart SSH

# kill -HUP `cat /var/run/sshd.pid`



3  如果你想更安全一点,可以开启防火墙!




ThanksTo:

http://www.cyberciti.biz/faq/howto-restart-ssh/






No comments:

Post a Comment