zoukankan      html  css  js  c++  java
  • 折腾开源WRT的AC无线路由之路-5

    -在Mac上设置无password连接SSH

    1. 生成SSH密钥对

    <pre name="code" class="html">ssh-keygen -t rsa -b 1024 -C "$(whoami)@$(hostname),$(date '+%F %T')" -f ~/.ssh/tomato

    
    或者简单的:
    

    ssh-keygen -t rsa -f ~/.ssh/tomato
    

    它会询问设置密语(passphrase)。为了安全起见最好给他设定一个密语;假设不要,就回车继续。

    然后它生成两个密钥对文件:tomato和tomato.pub

    把tomato.pub中的内容复制,或者执行以下命令拷贝到剪贴板中

    LC_CTYPE=UTF-8 pbcopy <~/.ssh/tomato.pub

    2. 到Tomato的管理界面:Administration->Admin Access->Authorized Keys

    粘贴到Authorized Keys里面:



    假设有多个,能够在以下继续粘贴,并保存。


    3. 在Mac上设定使用哪个密钥文件.

    编辑/生成新的~/.ssh/config文件,内容写入:

    Host 192.168.1.1
      IdentityFile ~/.ssh/tomato
      User root
    或者执行命令:

    cat <<EOF >> ~/.ssh/config
    Host 192.168.1.1
      IdentityFile /Users/toliu/.ssh/tomato
      User root
    EOF

    把192.168.1.1替换成你的无限路由的地址。


    4. 设定正确的用户和权限,在10.81之后,假设权限和用户不对。它不会连接成功:

    chmod 400 ~/.ssh/tomato;chmod 700 ~/.ssh/


    5. 尝试:ssh 192.168.1.1


    欧了



  • 相关阅读:
    学Linux从编译命令开始——arm-linux-gcc常用参数讲解
    暑假计划
    汇编语言
    “&”详解
    密码和密钥的区别
    有关动态库找不到的问题解决方案
    gdb调试基本命令(常用)
    Makefile相关知识
    有关宏定义的bug
    Linux安装时内存如何分区的相关问题
  • 原文地址:https://www.cnblogs.com/mthoutai/p/6931892.html
Copyright © 2011-2022 走看看