Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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 &
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.
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.
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.
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...
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)
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:
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 &" &
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.