Howto start VNCServer before LogIn?
I have downloaded realVNC so I can control my RedHat9 box (which acts like a server) through my WinXP laptop. It works... fantastic! A real recommendation for anybody who wants to work with a linux box without a screen or keyboard necesary, on a simple and user friendly manner.
I want to take it a step further now. I want to load vncserver automatically during the linux boot. Even before the login screen comes, so I can LogIn from my winXP Laptop as any user I like in the linux box. Why? Currently I need a screen, a keyboard and a mouse to log in, and it takes up much unnecessary space when the box simply acts like a file-storage box. Anybody who can help me? |
You can run any commands you like on boot by adding them to the end of your "rc.local" file. This is a standard file on all distros that will be executed last in the boot process. If you want to background the tasks so that the script completes (you'll most likely want to do this for a vnc server) just stick an ampersand on the end - ie:
/path/to/application -args & |
that's what I thought
Adding the command at the end of your rc.local file is what I thought would solve the problem. However, it didn't boot the file before or after the LogIn screen, I had to do it all manually after logIn.
My /etc/rc.d/rc.local file looks now: touch /var/lock/subsys/local /usr/local/bin/noip2 /usr/local/bin/vncserver :1 & Thanks already for the help. |
Are you really trying to start it as root and not a user? To start as a user:
su - user -c "/usr/local/bin/vncserver :1 &" & You may also want to create a log file: su - user -c "/usr/local/bin/vncserver :1 > /tmp/vncserver.log 2>&1 &" & I assume that /usr/local/bin/noip2 runs and then exits? You haven't set it to run in the background so if it does not exit then vncserver will not be run. |
Yes, I log in as root all the time. But that shouldn't make a difference? I thought rc.local is runned before the login is runned?
I assume the log file is only for vncserver and security? Again, thanks very much for the help. |
Logging in as root all the time is very insecure and is the reason I questioned that you were doing it it shouldn't make a difference to it working though.
yes - the log file will record any output that the vncserver program makes - if it is failing for some reason it should tell you why. |
I agree with your point about root-security.
Last time I rebooted, the rc.local was like this: touch /var/lock/subsys/local su - user -c "/usr/local/bin/vncserver :1 > /tmp/vncserver.log 2>&1 &" & /usr/local/bin/noip2 I, again, wasn't able to connect to the box until I manually logged in, and started the vncserver myself. There was no vncserver.log file either? What else can I do within rc.local? Are there other config files that need to be changed? Or is there another solution to go round the problem? Thanks again in advance for your help. I really appreciate your patience... |
just skimming the post
first make sure rc.local is executable chmod +x rc.local then, reboot your linux box; if it still doesn't work, login, cd /etc/rc.d and do ./rc.local if doing ./rc.local turns on your vnc server, then your file is just fine; you need to find the file that will tell redhat to execute this file at bootup (i believe it would be in init.d since redhat uses sysv init) |
It gets a bit strange now...
noip2 is a program that runs once, and then it continues running in the background, i think this is called a daemon. The same thing with vncserver, normally. Both 'programs' dont need to be runned as background as they already do, right? Also, if you login as su before the command, you will have to go through manually by entering the password or enter or something. If you run ./rc.local manually, the noip2 says its already runned, so rc.local seems to run. All in all, this is what I think it should be, logically seen: touch /var/lock/subsys/local /usr/local/bin/vncserver /usr/local/bin/noip2 But it still doesn't work? I did the chmod +x rc.local command before. Also, init.d is a folder. Does this mean that I should place a 'hard' link to rc.local or to /usr/local/bin/vncserver? What does the touch stand for? And is rc.local launched before or after the LogIn screen of RedHat9? Thanks so much guys for the help you've given me till here... |
Thanks david_ross, you may not have solved florian_mrt's problem but you solved my identical problem. vncserver is starting up on boot perfectly thanks to your suggestion:
su - user -c "/usr/local/bin/vncserver :1 > /tmp/vncserver.log 2>&1 &" & Works great, thanks. |
your rc.local and vnc login
Ok, well I might try out your suggestion without my no-ip2 daemon then. Can you please copy me your entire rc.local file?
Also, can you tell me whether vncserver starts up before the login screen appears, and whether you can type in your login name and password all remotely? Apologies for my passivism at the moment, I am in the middle of my exams... Thanks to everybody here that have helped me (us) so far already... |
I have been having similar problems. I run Slackware 9.1 and have tried all of the suggestions above but end up with the same error message on boot: "vncserver: could not find "xauth" on your PATH." vnc works very well after I have logged in but for the same reasons above would love to have it run on boot.
Thanks in advance |
Your answer is xf4vnc.
This is a vnc server wich is integrated into XFree86. This vnc server will run as soon as XFree86 runs. check this site for more info and download: http://xf4vnc.sourceforge.net/ check this screendump i made just now of my own server: http://home.hccnet.nl/semvd.wal/vnc_screen.JPG |
That looks promising!
Can you tell us too how you installed it and how it is runned from boot? Thanks anyway |
It worked ! I installed xf4vnc, made a startup link in rc.local (xf4vnc :1), and I had a contact with it though my old vnc viewer from my laptop after I booted up the redhat box, even before I logged in.
But... The contact was nothing more but an empty screen. Isn't there a possibility to start a shelf or even see the bottom task bar in this window, right with it from the start of the xf4 vncserver? Or do I have to set the rc.local to xf4vnc :0 instead of :1 ? Big gratitude to sw413 (spreek je nederlands?) ! Big thanks too for any further advice. |
All times are GMT -5. The time now is 12:46 AM. |