小编fir*_*ank的帖子

为什么我不能在远程主机上执行 SSH 命令?

我正在通过 jumpbox 访问远程主机。如果我通过 ssh shell 访问远程主机,我可以轻松访问它:

ssh remoteHost

Last login: Tue Feb 16 12:56:26 2016 from xx.xxx.xx.xx

remoteHost:user:~$ ls

<shows all the stuff>
Run Code Online (Sandbox Code Playgroud)

但是当我尝试通过 SSH 命令行选项执行命令时,我总是得到:

ssh remoteHost ls

"ls" isn't allowed to be executed.

Killed by signal 1.
Run Code Online (Sandbox Code Playgroud)

我可以在某些主机上成功执行 ssh 命令,但不能在其他主机上成功执行。

这是一个可以在服务器上配置的设置,即“允许远程 ssh 命令”或类似的东西吗?

FWIW,我确实看过如何在没有密码的情况下使用 ssh 在远程主机上启用使用命令?,但我很确定我的问题与引用无关,因为该问题的唯一答案似乎表明。

更新:

在远程主机上,我有一个 authorized_keys2 文件,其中包含如下内容:

ssh-rsa <encrypted stuff> jumpbox_user@jumpbox
ssh-rsa <encrypted stuff> jumpbox_user@mydesktop
Run Code Online (Sandbox Code Playgroud)

我的 ssh/.config 文件如下所示:

Host remoteHost
  HostName remoteHost
  User user
  ProxyCommand ssh -W %h:%p jumpbox_user@jumpbox_host
  ServerAliveInterval 60
Run Code Online (Sandbox Code Playgroud)

ssh ssh-tunneling

7
推荐指数
1
解决办法
1836
查看次数

标签 统计

ssh ×1

ssh-tunneling ×1