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博客园
  • 相关阅读:
    NSCoder
    OC_NSString、
    OC_内存管理(二)对象复制、循环引用问题、自动释放池
    OC_id类型
    OC_内存管理
    当 IDENTITY_INSERT 设置为 OFF 时,不能向表 '#TT' 中的标识列插入显式值。 sql server 临时表
    c# 访问SQL Server 其他会话正在使用事务的上下文
    EF 中事务的书写
    iis 不能访问json文件
    在开源中国(oschina)git中新建标签(tags)
  • 原文地址:https://www.cnblogs.com/hangj/p/4518643.html
Copyright © 2011-2022 走看看