Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
wish there was a wiki: how to ssh then vnc in a script?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sun Apr 09, 2006 11:53 pm    Post subject: wish there was a wiki: how to ssh then vnc in a script? Reply with quote

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
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Mon Apr 10, 2006 2:05 am    Post subject: Reply with quote

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
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Mon Apr 10, 2006 10:46 am    Post subject: Reply with quote

sorry :
Quote:
Pseudo-terminal will not be allocated because stdin is not a terminal.
vncviewer localhost: Unknown host
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Tue Apr 11, 2006 4:00 am    Post subject: Reply with quote

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
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Tue Apr 11, 2006 1:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum