使用SSH安全登陆服务器
2017-08-07 22:16
218 查看
使用SSH安全登陆服务器
在服务器新建用户
Unbentu中adduser biyongyao
usermod -a -G sudo biyongyao
Centos中
adduser biyongyao
passwd biyongyao
usermod -a -G wheel biyongyao
在本机
ssh-keygen -t rsa -C “your name@mail.com”
ssh-keygen生成SSH
scp ~/.ssh/id_rsa.pub biyongyao@123.456.78.90:将SSH生成的公钥发送到服务器用户名为biyongyao用户的根目录
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.142.84将本机的id_rsa.pub加入到远程的的可访问列表里面
在服务器中
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
设置权限
chown -R biyongyao:biyongyao ~/.ssh
chmod 700 ~/.ssh
hmod 600 ~/.ssh/authorized_keys
禁用密码,禁止根用户登陆
找到 /etc/ssh/sshd_config找到 PasswordAuthentication 注释掉
找到 PermitRootLogin 注释掉
重启 Ubuntu sudo service ssh restart
Centos sudo systemctl restart sshd.service
原文:http://biyongyao.com/archives/170
相关文章推荐
- 使用ssh private key 免密码登陆服务器的流程(Amazon 的EMR 采用了此方式登陆服务器)
- 使用acs服务器实现客户端的telnet和ssh登陆
- SecureCRT 密钥生成 SSH 使用密钥登陆 服务器
- Linux服务器登陆安全设置,并使用ssh keys登陆
- 使用SSH证书登陆远程服务器
- SSH使用秘钥和别名登陆服务器
- 使用SSH实现服务器之间的免登陆
- 使用putty(ssh)密匙安全登录服务器
- 批量检测服务器是否可以使用ssh登陆
- 在Mac OSX下使用ssh登陆到远程服务器
- 使用SSH证书(不要密码)登陆远程服务器
- 使用ssh安全地远程登录服务器----视频下载
- 使用SSH证书(不要密码)登陆远程服务器
- 使用putty(ssh)密匙安全登录服务器
- 在shell中使用expect+ssh登陆远程服务器
- Linux VPS及服务器更加安全之设置Putty SSH使用密钥登录
- SSH Secure Shell 使用 Public Key 登陆腾讯云服务器
- 使用ssh登陆服务器
- SecureCRT 密钥生成 SSH 使用密钥登陆 服务器
- Nginx服务器基础的安全配置与一些安全使用提示