• ssh localhost 免登录


     1 [bigdata@localhost ~]$ chmod 700 .ssh
     2 [bigdata@localhost ~]$ cd .ssh/ 
     3 [bigdata@localhost .ssh]$ ssh-keygen -t rsa 
     4 Generating public/private rsa key pair.
     5 一路回车 
     6 Enter file in which to save the key (/home/bigdata/.ssh/id_rsa): 
     7 Enter passphrase (empty for no passphrase): 
     8 Enter same passphrase again:
     9 Your identification has been saved in /home/bigdata/.ssh/id_rsa.
    10 Your public key has been saved in /home/bigdata/.ssh/id_rsa.pub.
    11 The key fingerprint is:
    12 51:c6:8b:54:45:09:cf:47:c0:89:0a:80:44:73:2e:df bigdata@localhost.localdomain
    13 The key's randomart image is:
    14 +--[ RSA 2048]----+
    15 | o+.o. o=*++. |
    16 | .+ . .ooo+. |
    17 | . . o.o .o . |
    18 | o . o.. . |
    19 | . E S |
    20 | |
    21 | |
    22 | |
    23 | |
    24 +-----------------+
    25 [bigdata@localhost .ssh]$ ls -l
    26 total 8
    27 -rw-------. 1 bigdata bigdata 1675 Jan 24 15:54 id_rsa
    28 -rw-r--r--. 1 bigdata bigdata 411 Jan 24 15:54 id_rsa.pub
    29 [bigdata@localhost .ssh]$ cp id_rsa.pub authorized_keys
    30 [bigdata@localhost .ssh]$ chmod 644 authorized_keys
    31 [bigdata@localhost ~]$ ssh localhost
    32  Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.13.0-36-generic x86_64)
    33 
    34  * Documentation:  https://help.ubuntu.com
    35  * Management:     https://landscape.canonical.com
    36  * Support:        https://ubuntu.com/advantage
    37 
    38 $vi /etc/ssh/sshd_config
    39 RSAAuthentication yes # 启用 RSA 认证
    40 PubkeyAuthentication yes # 启用公钥私钥配对认证方式
    41 AuthorizedKeysFile .ssh/authorized_keys # 公钥文件路径(和上面生成的文件同)
    42 
    43 service sshd restart
    44  
  • 相关阅读:
    C# 托管内存与非托管内存之间的转换
    A*算法详解链接
    【转】使用minizip解压缩多个文件(基于zlib)
    lua中table的遍历,以及删除
    clientHeight scrollHeight offsetHeight
    消息中间件(转)
    js 原型链和继承(转)
    session 和 cookie (转)
    java servlet
    redis 命令
  • 原文地址:https://www.cnblogs.com/tianqianlan/p/11342680.html
Copyright © 2020-2023  润新知