zoukankan      html  css  js  c++  java
  • ssh 登陆 端口转发

    man ssh

    ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]

      [-D [bind_address:]port] [-e escape_char] [-F configfile] [-I pkcs11]

      [-i identity_file] [-L [bind_address:]port:host:hostport] [-l login_name]

      [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]

      [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]

      [-w local_tun[:remote_tun]] [user@]hostname [command]

    -1 Forces ssh to try protocol version 1 only.
    -2 Forces ssh to try protocol version 2 only.
    -4 Forces ssh to use IPv4 addresses only.
    -6 Forces ssh to use IPv6 addresses only.

    -b bind_address

      当系统中有多个ip时,可以用这个参数来指定一个ip,来跟远程主机连接。只有1个ip时无效。

    -D [bind_address:]port

      本地创建一个socks代理服务,绑定bind_address,监听port端口。在本机网络配置里修改 socks 代理服务器为 bind_address:port,就可以以远程主机的身份访玩耍啦。

    -i identity_file

      指定你的私钥文件。

      ssh-add identity_file 之后,可以不用再指定私钥文件就能登陆。

      密钥文件生成命令 ssh-keygen

    -L [bind_address:]port:host:hostport

      本地有个 socket 绑定 bind_address,监听 port 端口,所有发到本地主机 port 端口的数据,都被通过远程主机发到 host 的 hostport 端口。

    -R [bind_address:]port:host:hostport

      远程主机有个 socket 绑定 bind_address,监听 port 端口,所有发到远程主机 port 端口的数据,都被通过本地主机发到 host 的 hostport 端口。

      -L 和 -R 中的 [bind_addres:]port 总是相对于被转发数据的机器的。也就是会开启一个 socket 的那个机器。host:hostport 相对于另一端。

    -p port

      指定要连接的远程端口

    如果想给朋友访问自己电脑的资源,需要配置 sshd_config

    sudo vim /etc/ssh/sshd_config

    设置 GatewayPorts yes

    +V d2h5X251bGw= 请备注:from博客园
  • 相关阅读:
    分布式框架服务调用超时设计与实现
    分布式框架灰度发布实现
    写给自己的 SOA 和 RPC 理解
    Java 基础【19】代理
    Java 基础【18】 反射与内省
    Spring HttpInvoker 从实战到源码追溯
    Lombok 使用攻略
    Guava Preconditions 工具参数前置校验
    CAS 单点登录【2】自定义用户验证
    Hibernate 离线对象构建通用查询
  • 原文地址:https://www.cnblogs.com/hangj/p/4518643.html
Copyright © 2011-2022 走看看