zoukankan      html  css  js  c++  java
  • Mac使用ssh登录远程linux系统查看jetty日志及同时使用github工具

    转载请注明出处:http://www.houxiurong.com/?post=27

    Mac默认是安装了ssh工具软件的。

    先用mac的 终端工具生成 id_rsa 和id_rsa.pub 秘钥,生成方式如下:

    1、当前用户目录下,检查SSH公钥
     cd ~/.ssh

    看看存不存在.ssh,如果存在的话,掠过下一步;不存在的请看下一步

    2、生成SSH公钥,一路next,密码设为空
    $ ssh-keygen -t rsa -C "your_email@youremail.com" 
    # Creates a new ssh key using the provided email Generating public/private rsa key pair. 
    Enter file in which to save the key (/home/you/.ssh/id_rsa):

    现在你可以看到,在自己的目录下,有一个.ssh目录,说明成功了

    3、然后在.ssh中可以看到
     

    xxx-MacBook-Pro:.ssh xxx$ cd .ssh

    xxx-MacBook-Pro:.ssh xxx$ ls

    config id_rsa id_rsa.pub known_hosts

    xxx-MacBook-Pro:.ssh xxx$ pwd

    /Users/xxx/.ssh

     
    4、添加SSH公钥到github

    打开github,找到账户里面添加SSH,把id_rsa.pub内容复制到key里面(注意使用cat id_rsa.pub查看,以防有空格)。

    5 测试是否生效

    使用下面的命令测试

    ssh -T git@github.com

    当你看到这些内容放入时候,直接yes

    The authenticity of host 'github.com (207.97.227.239)' can't be established. 
    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. 
    Are you sure you want to continue connecting (yes/no)?

    看到这个内容放入时候,说明就成功了。

    Hi username! 
    You've successfully authenticated, but GitHub does not provide shell access.
     
    6、下面是使用代理的方式登录linux远程服务器:ssh loguser@192.168.x.x 
    如果报错,说明id_rsa.pub没有同步到远程linux服务器,linux服务器检查是否有"your_email@youremail.com"
    的id_rsa.pub秘钥(cat看到的内容)。有的话就可以登录。
    7.如果还是登录不了,在.ssh目录下创建config文件。输入如下内容:
    xxx-MacBook-Pro:.ssh xxx$vim config

     

    Host *

     

      ForwardAgent yes 

      PasswordAuthentication yes 

      StrictHostKeyChecking no

      HashKnownHosts yes 

      Compression yes 

      ServerAliveInterval 60

     

    保存退出,重新登录即可。。。

     
  • 相关阅读:
    websphere安装及部署
    ant的安装及使用
    JAVA多线程线程阻塞与唤醒
    Win2008 404 找不到文件或目录。
    cmd命令大全和IIS服务命令
    phpcgi.exe上传大量数据
    phpcgi.exe多个进程 ,cpu跑满
    php shopex显示乱码
    ie中td空值不显示边框解决办法
    Win2003服务器主机下无法/不能播放FLV视频的设置方法!
  • 原文地址:https://www.cnblogs.com/xrhou12326/p/7063320.html
Copyright © 2011-2022 走看看