zoukankan      html  css  js  c++  java
  • linux之ssh方式登录

    1.生成ssh秘钥文件
    1、[root@localhost ~]# ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): 
    Created directory '/root/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    87:83:55:c7:db:0a:df:93:7d:c5:c5:2d:06:59:25:b6 root@localhost.localdomain
    The key's randomart image is:
    +--[ RSA 2048]----+
    |          ..o++oo|
    |         . .o.oo+|
    |        .    +Eo.|
    |       o .. . . o|
    |      . S .o o o.|
    |         o  o + o|
    |               ..|
    |                 |
    |                 |
    +-----------------+
    
    2、[root@localhost .ssh]# ls
    id_rsa  id_rsa.pub
    
    
    2. 安装登录用户的公钥
    [root@localhost .ssh]# touch authorized_keys
    [root@localhost .ssh]# cat /root/qqc_id_rsa.pub >> authorized_keys
    
    3.设置文件执行权限
    [root@host .ssh]$ chmod 600 authorized_keys
    [root@host .ssh]$ chmod 700 ~/.ssh
    
    4.重启ssh服务
    [root@localhost .ssh]# service sshd restart
    Redirecting to /bin/systemctl restart  sshd.service
    
    5.ssh配置文件
    [root@localhost .ssh]# vim /etc/ssh/sshd_config
    
    允许root用户登录:
    PermitRootLogin yes
    
    注:禁用密码登录 PasswordAuthentication no
    
  • 相关阅读:
    贫血模型和充血模型
    DES加密解密
    DDD讀書筆記(四)
    HTTP Caching
    ASP.NET 取得 Request URL 的各个部分和通过ASP.NET获取URL地址的方法
    datalist用aspnetpager分页
    visual studio.net 快捷键[转]
    DataList分页方法
    C#连接各类数据库 [转]
    C#日期函数[转]
  • 原文地址:https://www.cnblogs.com/quqinchao/p/13441768.html
Copyright © 2011-2022 走看看