LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2004, 01:04 PM   #1
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Rep: Reputation: 16
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?
 
Old 05-03-2004, 01:30 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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 &
 
Old 05-03-2004, 01:46 PM   #3
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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.
 
Old 05-03-2004, 01:51 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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.
 
Old 05-03-2004, 02:14 PM   #5
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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.
 
Old 05-03-2004, 02:51 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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.
 
Old 05-03-2004, 04:45 PM   #7
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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...
 
1 members found this post helpful.
Old 05-03-2004, 06:52 PM   #8
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
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)
 
Old 05-04-2004, 08:53 PM   #9
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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...
 
Old 05-10-2004, 10:22 PM   #10
GibsonAndrew
LQ Newbie
 
Registered: Jul 2003
Posts: 3

Rep: Reputation: 0
Thumbs up

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.
 
Old 05-10-2004, 10:34 PM   #11
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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...
 
Old 05-12-2004, 08:26 PM   #12
Grizzenbeorn
LQ Newbie
 
Registered: May 2004
Location: Sydney, Aus
Distribution: Slackware 9.1
Posts: 5

Rep: Reputation: 0
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
 
Old 05-13-2004, 04:01 AM   #13
sw413
LQ Newbie
 
Registered: May 2004
Posts: 1

Rep: Reputation: 0
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
 
Old 05-16-2004, 04:20 PM   #14
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
That looks promising!

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

Thanks anyway
 
Old 05-16-2004, 05:53 PM   #15
florian_mrt
Member
 
Registered: Mar 2004
Location: Bristol, UK
Distribution: Linux Red Hat 9
Posts: 37

Original Poster
Rep: Reputation: 16
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
start vncserver. bruse Linux - Networking 1 09-10-2005 12:21 PM
Robust vncserver startup file (rc.vncserver) arobinson74 Slackware 4 05-14-2005 05:33 AM
how to start the vncserver ust Linux - Software 1 05-11-2005 02:23 AM
vncserver won't start from rc.local GD_19 Linux - Software 5 03-13-2004 12:27 AM
Slackware vncserver start/boot script luegner Slackware 1 03-12-2004 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration