8

I'm accessing a remote host via a jumpbox. I can easily access the remote host if I access it via an 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>

but when I try to execute a command via the SSH command line option, I always get:

ssh remoteHost ls

"ls" isn't allowed to be executed.

Killed by signal 1.

I can successfully execute the ssh command on some hosts, but not others.

Is this a setting that can be configured on the server, i.e. "allow remote ssh commands" or something similar?

FWIW, I did have a look at How to enable using commands on remote host using ssh without password?, but I'm pretty sure my problem is not related to quoting as the only answer on that question seems to indicate.

Update:

On the remote host, I have an authorized_keys2 file that contains something like this:

ssh-rsa <encrypted stuff> jumpbox_user@jumpbox
ssh-rsa <encrypted stuff> jumpbox_user@mydesktop

My ssh/.config file looks like this:

Host remoteHost
  HostName remoteHost
  User user
  ProxyCommand ssh -W %h:%p jumpbox_user@jumpbox_host
  ServerAliveInterval 60
12
  • The hosts behind the jumpbox all run Red Hat, if that makes a difference.
    – firtydank
    Commented Feb 16, 2016 at 13:16
  • On the remoteHost, can you show us the content of the /home/user/.ssh/authorized_keys file? Commented Feb 16, 2016 at 13:24
  • @EightBitTony - added in the question, thanks.
    – firtydank
    Commented Feb 16, 2016 at 13:36
  • 1
    What kind of ssh daemon has that jumpfox? Dropbear does not execute ssh arguments... Commented Feb 16, 2016 at 13:48
  • 3
    Judging from that error message, you're probably running sudosh as your shell on the remotes. Talk to the admins there to expand the allowable set of commands. Commented Feb 16, 2016 at 16:04

1 Answer 1

1

Try running your ssh line with the -t option and make sure your remote command is delimited by ' as that tells ssh to run the command on the remote host, making your line much more error-proof.

ssh user@remoteHost -t 'ls'

FYI: The -t option enables pseudo-terminal allocation which actually simulates opening an SSH terminal then typing the command, then outputting STDOUT and exiting - which is exactly what you did manually as you mentioned.

According to the SSH man-page:

-t Force pseudo-terminal allocation. This can be used to exe‐ cute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu ser‐ vices. Multiple -t options force tty allocation, even if ssh has no local tty.

References:

SSH man page

What is Pseudo TTY-Allocation?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .