Blogger Information
Blog 143
fans 1
comment 0
visits 439800
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
配置SSH密码登录
弘德誉曦的博客
Original
4639 people have browsed it

配置SSH密码登录                

           

           

  1. 在客户端生成公钥:

     ssh-keygen –t rsa

    生成的公钥默认位置在~/.ssh/目录
  2. 把公钥上传到服务器端:

     scp id_rsa.pub root@ip地址:文件保存路径   
     cat id_rsa.pub >> /root/.ssh/authorized_keys 追加到文件中   
     chmod 600 /root/.ssh/authorized_keys  为了安全把文件修改权限
  3. 修改服务器端ssh配置文件sshd_config:

     vim /etc/ssh/sshd_config   
     #具体修改如下   
     RSAAuthentication yes 开启RSA验证   
     PubkeyAuthentication yes 是否使用公钥验证   
     AuthorizedKeysFile     .ssh/authorized_keys 公钥的保存位置   
     PasswordAuthentication no 禁止使用密码验证登录
  4. 服务器端关闭SElinux服务:(此步骤可以忽略跳过)

     vim  /etc/selinux/config   SELINUX=enforcing 改成SELINUX=disabled   shutdown -r now  重启系统
  5. 服务器端重启ssh服务:

     service sshd restart (如有报错:有些linux版本需要执行 /bin/systemctl start httpd.service)

引用:ssh配置文件区别;ssh公私钥配置

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post