I want to have something like this:
#!/bin/bash
ssh 10.0.0.1
vncviewer
However, I want "vncviewer" command to be launched at the same time, and so that it does not interrupt with SSH asking me for password.
I want to have something like this:
#!/bin/bash
ssh 10.0.0.1
vncviewer
However, I want "vncviewer" command to be launched at the same time, and so that it does not interrupt with SSH asking me for password.
If your goal is to run vncviewer on the local machine, but only after you have entered your password for ssh, you can make a conditional link between the two commands
ssh 10.0.0.1 && vncviewer
vncviewer &
ssh 10.0.0.1
– Don Simon
Oct 10 '18 at 19:35
ssh 10.0.0.1 && vncviewer
Now, ssh will initiate, request your password while it still has control of the tty, and only IF your ssh connection is established, pass the screen on to vncviewer.
– Don Simon Oct 10 '18 at 19:50&& will not run vncviewer until ssh has exited, i.e. after the connection has opened and closed. See "Execution of a command locally after ssh tunneling" (thanks @KamilMaciorowski) for a better answer.
– Gordon Davisson
Oct 11 '18 at 00:14
vncvieweron the remote server or locally? – Arkadiusz Drabczyk Oct 10 '18 at 17:59