• 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博客园
  • 相关阅读:
    数值的整数次方
    二进制中1的个数
    SpingBoot 启动自动给MongoDB建库
    Java 依赖冲突的解决办法
    Http协议
    你被限流了吗?
    LeetCode 783. 二叉搜索树节点最小距离
    Leetcode 687. 最长同值路径
    LeetCode 784. 字母大小写全排列
    LeetCode 面试题 08.06. 汉诺塔问题
  • 原文地址:https://www.cnblogs.com/hangj/p/4518643.html
Copyright © 2020-2023  润新知