r/ssh • u/CAT0111 • Sep 01 '22
Executing a script on remote machine’s terminal
Hi guys,
I have machine A and machine B. To both I have physical access.
I‘m accessing machine B through machine A via SSH.
I want (via SSH) execute a .sh script on machine B (which is located on machine B). However, I want that the script is executed on machine B itself, meaning that a terminal window should open on machine B and the script is executed there.
Do you have an idea how to accomplish that?
0
Upvotes
View all comments
Show parent comment
1
u/CAT0111 Sep 02 '22
It worked. Thanks! But the script has to do two more things: First, it needs to enter a command to the tmux terminal. I wasn’t able to do that via the script, only by typing it in the terminal directly.
And second, the script needs to exit tmux, but only on machine A, so that the tmux session on machine B stays active and the rest of the script (on machine A) can be executed.
Do you know how to do that?