LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Howto start VNCServer before LogIn? (https://www.linuxquestions.org/questions/linux-networking-3/howto-start-vncserver-before-login-177406/)

florian_mrt 05-03-2004 01:04 PM

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?

david_ross 05-03-2004 01:30 PM

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 &

florian_mrt 05-03-2004 01:46 PM

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.

david_ross 05-03-2004 01:51 PM

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.

florian_mrt 05-03-2004 02:14 PM

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.

david_ross 05-03-2004 02:51 PM

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.

florian_mrt 05-03-2004 04:45 PM

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...

TheOneAndOnlySM 05-03-2004 06:52 PM

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)

florian_mrt 05-04-2004 08:53 PM

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...

GibsonAndrew 05-10-2004 10:22 PM

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.

florian_mrt 05-10-2004 10:34 PM

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...

Grizzenbeorn 05-12-2004 08:26 PM

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

sw413 05-13-2004 04:01 AM

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

florian_mrt 05-16-2004 04:20 PM

That looks promising!

Can you tell us too how you installed it and how it is runned from boot?

Thanks anyway

florian_mrt 05-16-2004 05:53 PM

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.