Executing remote commands via SSH: "You must specify a subsystem to invoke."

With a staging and a live site at DH I’m attempting to run a script at the staging host to update the live host. Passwordless login has been established for ssh. However, the command ssh name@remotehost -s < local_script.sh returns

You must specify a subsystem to invoke.
usage: 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]

I have the impression you’re mis-interpreting how SSH subsystem works. If all you need is to execute a remote command from another machine, you can do something like:

[local]$ ssh $user@$remote ls

for example, and you’ll get the list of files in the home directory of $user in the @remote server.

If all you need is to execute local_script.sh, I would copy that file over to the remote server and execute it from your local machine, with that syntax above.

You could also setup an SSH subystem on your remote server. If you have an subscription to Safari you can read more about SSH subsystems in the SSH book:

Share the content of your local_script if you can so we can give you some other ideas.

The impression is most accurate! Thanks for setting me straight. Much appreciated.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.