简体   繁体   中英

How to run a command on a remote host from a Linux terminal

The situation is like this:

There's a public shared folder containing command file on a remote server saying ServerRemoteA. From my laptop's Win10 cmd terminal I can run \\ServerRemoteA\sharedfolder\Windows\SomeCommand.exe successfully.

Now I ssh-logged to another LinuxHost and I should run its Linux version sharedfolder/Linux/SomeCommand on the same host ServerRemoteA, from the Linux terminal

I was refused to use "ssh user@host "command" " by the server. But I can run the exe version from Windows machine.

How can I do?

If you are connected to a remote host the program will run in the remote host, so the client does not matter if it is Linux or Windows. Thus, If you connect from:

Linux/Windows -> Windows: \\ServerRemoteA\sharedfolder\Windows\SomeCommand.exe
Linux/Windows -> Linux: sharedfolder/Linux/SomeCommand

if the SSH is in Linux if you just want to run one command you can use the following command:

ssh -l <username> ServerRemoteA "sharedfolder/Linux/SomeCommand"

Or if the server is in Windows from Linux ssh client:

ssh -l <username> ServerRemoteA "C:\\sharedfolder\Windows\SomeCommand.exe"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM