zoukankan      html  css  js  c++  java
  • Windows 端通过SecureCRT以密钥方式登录linux服务器

    1.登录我们需要免密码的服务器创建密钥对

    root@linux-node1 ~]# ssh-keygen -t dsa         #创建密钥,指定密钥格式为DSA
    Generating public/private dsa key pair.
    Enter file in which to save the key (/root/.ssh/id_dsa):
    Created directory '/root/.ssh'.
    Enter passphrase (empty for no passphrase):     #设置通行短语,不设回车即可
    Enter same passphrase again:                            #重复输入通行短语验证
    Your identification has been saved in /root/.ssh/id_dsa.
    Your public key has been saved in /root/.ssh/id_dsa.pub.
    The key fingerprint is:
    ae:2d:26:c9:18:f9:97:fc:7c:32:75:fd:94:17:73:a5 root@linux-node1.example.com
    The key's randomart image is:
    +--[ DSA 1024]----+
    | |
    | .|
    | ..|
    | Eo.|
    | . S . =|
    | o . . . ..o|
    | = o ... . o.|
    | . = *+o . .|
    | +.o++ |
    +-----------------+
    [root@linux-node1 ~]# ll .ssh
    total 8
    -rw------- 1 root root 668 Aug 22 15:01 id_dsa
    -rw-r--r-- 1 root root 618 Aug 22 15:01 id_dsa.pub
    [root@linux-node1 ~]# ls -ld .ssh
    drwx------ 2 root root 4096 Aug 22 15:01 .ssh
    [root@linux-node1 ~]# cd .ssh
    [root@linux-node1 .ssh]# ll
    total 8
    -rw------- 1 root root 668 Aug 22 15:01 id_dsa
    -rw-r--r-- 1 root root 618 Aug 22 15:01 id_dsa.pub
    [root@linux-node1 .ssh]# cp id_dsa.pub id_dsa.pub.ori        #修改前先备份
    [root@linux-node1 .ssh]# ll
    total 12
    -rw------- 1 root root 668 Aug 22 15:01 id_dsa                      #私钥
    -rw-r--r-- 1 root root 618 Aug 22 15:01 id_dsa.pub              #公钥
    -rw-r--r-- 1 root root 618 Aug 22 15:04 id_dsa.pub.ori
    [root@linux-node1 .ssh]#
    [root@linux-node1 .ssh]#
    [root@linux-node1 .ssh]# mv id_dsa.pub authorized_keys       #公钥改名
    [root@linux-node1 .ssh]# chmod 600 authorized_keys            #改权限
    [root@linux-node1 .ssh]# ll
    total 12
    -rw------- 1 root root 618 Aug 22 15:01 authorized_keys
    -rw------- 1 root root 668 Aug 22 15:01 id_dsa
    -rw-r--r-- 1 root root 618 Aug 22 15:04 id_dsa.pub.ori

    2.下载私钥到电脑上

    [root@linux-node1 .ssh]# sz -y id_dsa
    rz
    开始 zmodem 传输。 按 Ctrl+C 取消。
    100% 668 bytes 668 bytes/s 00:00:01 0 Errors

    [root@linux-node1 .ssh]# exit
    logout

    3.配置SecureCRT客户端

    3.1  选项-->会话选项

     

    3.2  ssh-->选择“公钥”-->属性

    3.3  选择 “使用会话公钥设置”,

           选择使用身份或证书文件位置

    4. 客户端服务器登录

  • 相关阅读:
    检查点学习笔记
    数据驱动-参数化(Parameters)
    loadrunner -vuser
    loadrunner 事务、同步点和思考时间
    loadrunner报错
    java随机数的产生
    Codeforces Round #666 (Div. 2) Power Sequence、Multiples of Length 思维
    Educational Codeforces Round 94 (Rated for Div. 2) String Similarity、RPG Protagonist、Binary String Reconstruction、Zigzags 思维
    Leetcode】周赛203 查找大小为M的最新分组
    HDU 6880 Permutation Counting dp
  • 原文地址:https://www.cnblogs.com/ahtornado/p/9518792.html
Copyright © 2011-2022 走看看