Reply to topic  [ 14 posts ] 
Adding option to command line 
Author Message
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
I need to implement this (add -forever option) to my x11vnc under latest Ubuntu:
http://ubuntuforums.org/showpost.php?p= ... ostcount=5

I have set up x11vnc to run at the startup so I assume I need to modify the "exe" file for it. I just don't know how...

_________________
Image
Free Sim with £5 credit


Thu Jun 03, 2010 8:16 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
How have you specified x11vnc to be run on startup? Can you not specify the flag then?

Modifying the binary file could be impossible, and even if it is possible it would be not be advisable (what happens when one day you don't want to use the flag?).


Thu Jun 03, 2010 8:29 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
I presume you did this:
Code:
sudo nano /etc/inetd.conf

And added this to that file:
Code:
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh


I would say you could probably do this:
Code:
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever


If that doesn't work, try quoting it with double quotes or back ticks like this:
Code:
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd `/usr/local/bin/x11vnc.sh -forever`

Code:
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd "/usr/local/bin/x11vnc.sh -forever"


Ben


Thu Jun 03, 2010 8:34 am
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
I have set up start-up by going admin-sessions in the menus and added the x11vnc file to the list. I haven't done any command lines except for setting a password for vnc sessions.

Those command lines you have suggest seem very complicated. Do I need them all? Right now I need to add -forever and -password options (vnc is not asking for a password when I connect even though password was specified by a command line I have done).

I could probably do with -localhost option too so nobody from outside can connect to it. I am behind a firewall so port forwarding is better left out as well, just to be safe.

_________________
Image
Free Sim with £5 credit


Thu Jun 03, 2010 10:11 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
I looked at this site here:
http://wiki.linuxquestions.org/wiki/X11vnc

koli wrote:
Those command lines you have suggest seem very complicated. Do I need them all? Right now I need to add -forever and -password options (vnc is not asking for a password when I connect even though password was specified by a command line I have done).

I could probably do with -localhost option too so nobody from outside can connect to it. I am behind a firewall so port forwarding is better left out as well, just to be safe.


I you would only need to do one of them, probably the following:
Code:
sudo nano /etc/inetd.conf
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever -localhost -password


I'm not sure of using the Linux service framework as Solaris works quite differently. But out of the reading I've done on from the link above, I think that's right...


Thu Jun 03, 2010 10:36 am
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
Ok, I will run that in the console tonight and will report my findings. Thanks.

_________________
Image
Free Sim with £5 credit


Thu Jun 03, 2010 11:01 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
Just a bit of explanation around Ben's advice, so you understand what you're doing. I'm not sure what the inetd.conf file is for, or what the line in the file means, but I guess Google will explain if you're curious/it doesn't work.
forquare1 wrote:
Code:
sudo nano /etc/inetd.conf
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever -localhost -password

sudo - Run as Super User (Super User DO)
nano - A text editor
/etc/inetd.conf - The file you want to edit

Then you just need to add or edit the second line into text file from within the nano editor.

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Thu Jun 03, 2010 2:56 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
EddArmitage wrote:
Just a bit of explanation around Ben's advice, so you understand what you're doing. I'm not sure what the inetd.conf file is for, or what the line in the file means, but I guess Google will explain if you're curious/it doesn't work.
forquare1 wrote:
Code:
sudo nano /etc/inetd.conf
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever -localhost -password

sudo - Run as Super User (Super User DO)
nano - A text editor
/etc/inetd.conf - The file you want to edit

Then you just need to add or edit the second line into text file from within the nano editor.


Sorry, I tend to forget that people switch to Linux and don't necessarily dive into the command line...
If you'd rather use a nice graphical editor to edit the file, do something like this:

Code:
sudo gedit /etc/inetd.conf


It is exactly as Edd explained, but will use GNOMEs graphical editor (like notepad) to edit the file.

After looking here:
http://www.faqs.org/docs/securing/chap5sec36.html

I've found this much out about the file:
Quote:
inetd, called also the super server, will load a network program based upon a request from the network. The inetd.conf file tells inetd which ports to listen to and what server to start for each port.


In my mind, that is exactly what you want to do. You may not even need the -forever option, though I'm not sure...


Thu Jun 03, 2010 3:05 pm
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
In that file I had:
Code:
#<off># sane-port   stream   tcp   nowait   saned:saned   /usr/sbin/saned saned

I added this:
Code:
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever -localhost -password

And this is what it looks like now:
Code:
#<off># sane-port   stream   tcp   nowait   saned:saned   /usr/sbin/saned saned
5900    stream  tcp4     nowait  root    /usr/sbin/tcpd /usr/local/bin/x11vnc.sh -forever -localhost -password


But I don't think the this is correct as it is not having any effect. Is the syntax correct? I am not sure whether to replace stuff or just add it.
Also, when I change the file, do I need to reboot for it come into effect or is it gonna work on the fly?

_________________
Image
Free Sim with £5 credit


Thu Jun 03, 2010 6:45 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
koli wrote:
But I don't think the this is correct as it is not having any effect. Is the syntax correct? I am not sure whether to replace stuff or just add it.
Also, when I change the file, do I need to reboot for it come into effect or is it gonna work on the fly?

I don't know about the rebooting, but try putting the last bit in back-ticks or double quotes, as Ben suggested would be my first thing.

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Thu Jun 03, 2010 7:10 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
You may need to alert the daemon that reads that file that the file has changed...
There may be several ways to do this, but the most universal is to do a reboot (you might be able to just restart the service, or even pass something to the service to tell it to check the file, but I don't know that much about Linux I'm afraid)


Thu Jun 03, 2010 8:05 pm
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
Ok, I have done some googling and this is what I've found:

Quote:
Run the terminal command: x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800


If I run that in terminal it does exactly what I need:
1. It asks me for a password
2. When I disconnect I can connect again without having to terminate the session and reboot

So the question is: How do I get that command to run in terminal at startup?

_________________
Image
Free Sim with £5 credit


Last edited by koli on Fri Jun 04, 2010 7:35 pm, edited 1 time in total.



Thu Jun 03, 2010 8:13 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
OK, I've done more googling too.

I think this will work:
Code:
sudo echo "x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800" > "/etc/init.d/x11vnc.sh"
sudo chmod +x /etc/init.d/x11vnc.sh
sudo ln -s /etc/init.d/x11vnc.sh /etc/rc2.d/S99x11vnc


After doing this you will have to do a single reboot, then the service is active. It should be available every time you boot your machine.

From here:
http://ubuntuforums.org/showthread.php?t=673126


Thu Jun 03, 2010 8:22 pm
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
Thanks Ben,

that code created the file with the text I wanted and made it executable but after reboot it didn't work. I think it might have something to do with the third line of code.

However this worked from that link you gave me:
Quote:
To make x11vnc run after you login go to System/Preferences/Sessions/Startup Programs and add your command


And it is working as it should. After reboot it starts x11vnc, when I try to connect it asks for a password and after I disconnect I can connect again.

Thank you very much guys for your help. I will write (very simple) "How to" for this when I have some time couple of weeks. It might save somebody the hassle I've had with it.

_________________
Image
Free Sim with £5 credit


Thu Jun 03, 2010 9:18 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.