View previous topic :: View next topic |
Author |
Message |
nivw Apprentice
Joined: 09 Nov 2005 Posts: 261
|
Posted: Sun Apr 09, 2006 11:53 pm Post subject: wish there was a wiki: how to ssh then vnc in a script? |
|
|
Hay all and happy upcoming holiday,
I wanted to write a script that will extablish a ssh connection to a remote windows pc then vnc to it.
but if I go:
Code: | #!/bin/bash
ssh -L5900:localhost:5900 <remote pc> &
rsh "vncviewer localhost"
|
I go in to ssh , and only when I quit rsh, runs.
I allready got passwordless ssh to the remote pc.
Thanks,
Niv |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Mon Apr 10, 2006 2:05 am Post subject: |
|
|
Try:
Code: | #!/bin/bash
ssh -f -L5900:localhost:5900 <remote pc>
rsh "vncviewer localhost" |
Or:
Code: | #!/bin/bash
ssh -n -L5900:localhost:5900 <remote pc>
rsh "vncviewer localhost" |
|
|
Back to top |
|
|
nivw Apprentice
Joined: 09 Nov 2005 Posts: 261
|
Posted: Mon Apr 10, 2006 10:46 am Post subject: |
|
|
sorry :
Quote: | Pseudo-terminal will not be allocated because stdin is not a terminal.
vncviewer localhost: Unknown host |
|
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Tue Apr 11, 2006 4:00 am Post subject: |
|
|
Try:
Code: | #!/bin/bash
ssh -T -f -L5900:localhost:5900 <remote pc>
rsh "vncviewer localhost" |
Or:
Code: | #!/bin/bash
ssh -T -n -L5900:localhost:5900 <remote pc>
rsh "vncviewer localhost" |
|
|
Back to top |
|
|
nielchiano Veteran
Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Tue Apr 11, 2006 1:04 pm Post subject: |
|
|
I also had this problem. My workaround is this: Code: |
#!/bin/bash
vncviewer -encodings "copyrect tight zrle hextile zlib corre rre raw" -listen $1 &
pid=$!
ssh -R5500:localhost:5500 remote.ip sudo x11vnc -display :0 -auth /home/blabla/.Xauthority -connect localhost
kill $pid
|
WARNING: this (tries to) take over the CURRENT RUNNING session, and doesn't start a new one. |
|
Back to top |
|
|
|