AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[ssh-tunneling](unix)

Martin Hope
bs-
Asked: 2023-09-16 21:37:10 +0800 CST

配置 AWS E2 代理以通过 Web 浏览器建立 SSH 隧道

  • 4

(本地)Web 浏览器如何通过 AWS E2 进行 SSH 隧道流量?

ssh-tunneling
  • 1 个回答
  • 11 Views
Martin Hope
Noah
Asked: 2023-03-28 21:58:39 +0800 CST

我有一个树莓派,我可以使用 minecraft 和 localhost.run 隧道吗

  • 4

嘿,我有一个安装了 raspbian 的 raspberry pi 我想知道我是否可以使用 localhost.run,这是一个允许使用 ssh 进行隧道传输的网站,我可以将它与希望运行 java 版本的 mc 服务器一起使用吗,如果它安全且可靠?

ssh-tunneling
  • 1 个回答
  • 45 Views
Martin Hope
Benjamin H
Asked: 2022-10-25 10:44:27 +0800 CST

如何公开应用程序仅允许本地连接的端口?

  • 5

基于 linux 的“headless-box-1”上的一个应用程序正在监听http://127.0.0.1:7860上的 HTTP 连接。这限制了与自我的联系。

但我希望它正在侦听来自 LAN 上任何计算机的连接。

有没有我可以在 headless-box-1 (192.168.1.100) 上运行的命令,它可以让我在笔记本电脑 1 上浏览到http://192.168.1.100 :7861,它会双向路由所有从局域网公共端口:7861 到仅本地主机:7860 的通信?

在此设置中,安全性和 HTTPS 不是问题。我找到的所有答案都是针对 ssh-tunneling 的,这与笔记本电脑端的 ssh over 有关,这似乎过分了。

ssh-tunneling
  • 1 个回答
  • 28 Views
Martin Hope
Rami Hassan
Asked: 2022-09-25 14:59:10 +0800 CST

将远程 tcp 端口转发到本地端口

  • 1



我有以下设置: 设置图

该设备不断尝试连接到特定已知端口上的远程服务器。
在远程服务器上,除了打开的 TCP 端口之外什么都没有。
我想将远程服务器的端口转发到我的电脑并打开一个 TCP 服务器来读取数据。

最终,我想使用 Python 来实现这一点,
但与此同时,我正在尝试使用 ssh 来执行此操作:ssh -N -R 10000:localhost:10000 username@hostname,
并且在我这边(我的电脑),我试图打开一个套接字(使用 python)来收听10000端口,尝试打开Hercules模拟TCP服务器,但没有收到任何数据。

显然,缺少了什么,它是什么?
ps 在远程服务器上打开 TCP 服务器将获取数据,
但我需要控制来自 My Pc 的连接。

ssh ssh-tunneling
  • 1 个回答
  • 28 Views
Martin Hope
Francisco Ossian
Asked: 2022-06-16 14:52:43 +0800 CST

webServer 上的 SSH 隧道,localhost:80 -> localhost:81,但我收到 Permission denied (publickey)

  • -1

我尝试创建一个 SSH 隧道,localhost:80 -> localhost:81 我在本地生成我的密钥并在云中的授权密钥上添加 .pub。但我收到了,权限被拒绝(公钥)。好的,使用 root 访问的密钥不同(我输入了 user@ip )并且服务器上已经有一个密钥来授权“用户”访问终端

据我了解,如果我不想使用相同的密钥,我需要创建一个新用户。即便如此,我也无法使用相同的现有密钥。

我也不知道它是远程端口转发还是动态端口转发

编辑:

/etc/ssh/sshd_config来自服务器的文件

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

# The strategy used for options in the default sshd_config 
shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options 
override the
# default value.

Include /etc/ssh/sshd_config.d/*.conf

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in 
future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in 
/etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware 
issues with
# some PAM modules and threads)
KbdInteractiveAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account 
processing,
# and session processing. If this is enabled, PAM authentication 
will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run 
without
# PAM authentication, then enable this but set 
PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

我尝试将此命令用于隧道:ssh -R 81:localhost:80 ubuntu@localhost 加密端口 80 的数据并传递到端口 81

终端响应:ubuntu@localhost: Permission denied (publickey).

ssh ssh-tunneling
  • 1 个回答
  • 151 Views
Martin Hope
Mathias Sven
Asked: 2022-06-09 07:23:15 +0800 CST

当且仅当 SSH 隧道在端口 X 上处于活动状态时运行应用程序

  • 0

我在我的远程 Ubuntu 机器上运行一个代码服务器,现在我启动它的方法是

  1. ssh -t -t user@server "code-server"在一个终端上(-t -t我从这里得到的)
  2. ssh -N -L 8443:127.0.0.1:8443 user@server在第二个终端上
  3. 在浏览器上打开应用程序

然后当我想关闭它时,我只需关闭两个终端。我的问题是是否可以仅使用一个连接来执行此操作,目前我必须进行两次身份验证,因为这需要两个 ssh 会话,一个用于启动应用程序并在关闭时发送 KILL,另一个用于隧道。

ssh ssh-tunneling
  • 1 个回答
  • 24 Views
Martin Hope
terdon
Asked: 2021-11-21 05:58:05 +0800 CST

使用 server1 上的凭据通过 server1 SSH 到 server2

  • 1

我有两台服务器,server1并且server2,我可以通过以下方式server2连接server1:

localUser@localMachine $ ssh user1@server1
user1@server1 $ ssh user2@server2
user2@server2 $

我可以使用以下方法一步完成:

localUser@localMachine $ ssh -t user1@server1 ssh user2@server2
user2@server2 $

我希望能够简单地ssh server2从我的本地机器运行并直接连接。我可以将上面的命令设置为别名,但我更愿意通过~/.ssh/config. 问题是我需要在连接到 server2 时使用 server1 上存在的 ssh 凭据,并且我不想将它们复制到我的本地计算机上。这意味着我通过将以下内容添加到我的 local 来设置它的“正常”方式~/.ssh/config失败:

Host server1
    Hostname  server1.example.com
    User      user1

Host server2
    Hostname  server2.example.com
    User      user2
    ProxyJump server1

如果我现在尝试连接,我会得到:

$ ssh server2
[email protected]: Permission denied (publickey).

这是因为我需要使用~/.ssh/id_rsa_pub密钥,server1而不是我本地机器上的密钥。那么,如何设置我的本地~/.ssh/config以便它连接到server2、通过server1和使用中存在的凭据server1?

所有机器都是 Linux 机器,遥控器运行 Ubuntu Server 18.04.4,我的本地机器运行 Arch Linux。


我尝试了 Hauke's answer 中给出的解决方案,并将以下内容添加到我的~/.ssh/config:

Host server1server2
    Hostname server1
    User     user1
    RemoteCommand ssh [email protected]

这几乎可以工作!我现在可以连接到server2using ssh server1server2,但没有收到提示:

localUser@localMachine $ ssh server1server2 
Pseudo-terminal will not be allocated because stdin is not a terminal.

hostname
server2

正如您在上面看到的,我已连接到server2甚至可以在那里运行命令,但我没有得到提示。然后我尝试在配置文件中添加-t -t命令ssh:

Host server1server2
    Hostname server1
    User     user1
    RemoteCommand ssh -t -t [email protected]

这给了我一个提示,但是我的 shell 的初始化文件没有被读取,并且按Ctrl+C会终止ssh连接。ssh user2@server1我需要它的行为方式与我已经完成然后从 server1完全相同ssh user2@server2。这意味着应该读取我的正常 shell 初始化文件并且 Ctrl+C 不应该终止会话。

ssh ssh-tunneling
  • 2 个回答
  • 133 Views
Martin Hope
vincenzogianfelice
Asked: 2020-02-18 07:41:33 +0800 CST

通过 HTTP(或 HTTPS)的 SSH 隧道的说明

  • 0

我注意到,当我在本地创建从我的 PC 到远程的隧道时,对于某些设备(通常是路由器),通过 http 或 https 的连接不会发生。我得到一个弹出窗口,上面写着:

The 'Host' field contained in Http header is invalid

如果在文件文件中设置以下内容hosts:

127.0.0.1 modemtim

我使用modemtim连接,而不仅仅是127.0.0.1,一切正常。

SSH 命令:

ssh -L 8080:<IP_REMOTE_ROUTER>:80 <USER>@<REMOTE_TUNNEL>

为什么?

ssh ssh-tunneling
  • 1 个回答
  • 467 Views
Martin Hope
DeshBhakt
Asked: 2020-02-15 06:51:23 +0800 CST

SSH 权限被拒绝(公钥)

  • 2

我正在尝试第一次连接到 SSH。但它说

The authenticity of host '[<host>]:<port>' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[<host>]:<port>' (ECDSA) to the list of known hosts.
root@<host>: Permission denied (publickey).

是不是有违章之类的?

ssh ssh-tunneling
  • 1 个回答
  • 4306 Views
Martin Hope
Aero Wang
Asked: 2020-02-12 17:06:11 +0800 CST

如何在后台保持 sshpass 进程?

  • 1

sshpass -p '1234567*' ssh -L 1080:192.168.0.1:2222 [email protected] -p 4422 -f -C -N

上述代码适用于 macOS(通过 gateway.com:4422 使用用户名 admin 和密码 1234567* 创建到 192.168.0.1:2222 的 1080 隧道)。\

它在 Linux 上不起作用 - 该进程似乎立即运行并终止。

ssh ssh-tunneling
  • 1 个回答
  • 590 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve