Trying to run a command on Lish remotely through SSH

On my desktop I'd like to run a script on my Linode using SSH. The script is called mydesktopscript, which contains the following:

ssh linode******@london***.linode.com "/usr/local/bin/mylinodescript arg1 arg2"

Where linode***@london.linode.com is the SSH command to enter Lish on the Linode. So basically I want to run mylinodescript on my Linode. I don't need to enter a password when I run the above command, because I use Lish via SSH Keys, so the SSH login happens automatically.

However, when I run it on my desktop I get the following error:

Unknown command '/usr/local/bin/mylinodescript arg1 arg2'

Even if I replace the command with "echo hi", I get:

Unknown command 'echo hi'

What am I doing wrong? Also, I need to log in via Lish and not via regular SSH into the Linode, because this script has to do with recovery situations where we cannot log in via regular SSH. Any help you could provide would be great, thanks.

4 Replies

You would have to do this in two separate operations. When you log in to LiSH, it's a limited shell that opens up the "screen" software to your virtual console. You can't use LiSH in the exact same manner as you would with an SSH connection.

Thanks for the response. Could you by any chance provide an example of how I could do it from my remote system, even if with 2 separate operations? Thanks.

I haven't tried this (and I can't until I get to a computer), but one idea is to connect to lish normally via ssh, then from there log into your Linode, and close your terminal. Since lish is basically screen, your login to your Linode will stay open. From there, you can try passing your command via < and >, e.g. "./script > ssh …".

It would be easier to place your public key directly on your Linode and execute the command that way. Unless you corrupt you Linode's ssh server, there shouldn't be a need to go through lish since it's intended as a backup for ssh.

you don't need to do it via lish.

if you have ssh server running on your node, just establish ssh session directly to the node and not to the console.

The very first link in google search : ~~[https://hkn.eecs.berkeley.edu/~dhsu/sshpublickeyhowto.html" target="blank">](https://hkn.eecs.berkeley.edu/~dhsu/ssh … howto.html">https://hkn.eecs.berkeley.edu/~dhsu/sshpublickey_howto.html](

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct