VectorLinux
October 01, 2014, 06:14:33 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1] 2
  Print  
Author Topic: Autostart sshd and vncserver on 5.9 light[SOLVED]  (Read 5825 times)
dukefluke
Member
*
Posts: 31


« on: July 28, 2008, 11:16:43 am »

I would like to have both of these services ssh and tightvnc start on  boot. I am using 5.9 Light.

I have set /etc/rc.d/rc.sshd to be executable. In Slackware thats all I normally do to enable a service
to start on boot. Probably I'm forgetting something though. What is the Vector way of enabling this?
I thought about putting:

Code:
/etc/rc.d/rc.sshd start
In my rc.local but I'm sure there is a more elegant way to achieve this.

I also thought about adding the following to my rc.local to start vnc:

Code:
vncserver :1

Then I realized that I run vncserver as a normal user(not root). Does rc.local run as root? Is it a bad thing to start
vncserver as root? If so how do I go about starting vncserver automatically on boot as my regular user?
« Last Edit: July 29, 2008, 10:12:18 am by dukefluke » Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3180



« Reply #1 on: July 28, 2008, 12:04:37 pm »

for yoru ssh, you can use VASMCC or VASM go to services and there you can enable/disable services for each runlevel
4 = GUI.
as far as vnc goes, you'll have to do that outside of rc.local because that's a system thing... and by the time that's executed, there is no X running (I may be wrong).
The only thing I can think of, is adding it to your xinitrc

here is how to do it
your xinitrc is probabbly a link to somewhere in /etc/X11/xinit.
so you want to
Code:
mv ~/.xinitrc ~/.xinitrc_old
cp /etc/X11/xinit/xinitrc ~/.xinitrc
then edit your file to add yoru vnc line
Code:
mcedit ~/.xinitrc
Add your vnc line at the end of the file

Code:
vncserver :1
save it and make it executable.

Not even sure that will work, but you can give it a try. I think that might only execute when actually log into the box as your username.

HTH
Logged

nightflier
Administrator
Vectorian
*****
Posts: 4024



« Reply #2 on: July 28, 2008, 12:17:29 pm »

It depends which window manager you are using. For example, in Light, using JWM, you can edit the file .jwmrc in your home directory. Find the section which contains "pcmanicons on", and add a line with your vnc command there. For Fluxbox, look in ~/.fluxbox/startup
Logged
dukefluke
Member
*
Posts: 31


« Reply #3 on: July 28, 2008, 12:24:39 pm »

Thanks M0E-lnx that vasm stuff was just what the doctor ordered.

I had too thought about using .xinitrc and would have tried it as well if it wasn't for nightlier's timely reply.

Thanks for the info nightflier. I saw the .jwmrc file in my home dir and suspected it as being helpful to me. Now you have confirmed this. I will try that right away.

« Last Edit: July 28, 2008, 01:41:59 pm by dukefluke » Logged
dukefluke
Member
*
Posts: 31


« Reply #4 on: July 28, 2008, 06:05:08 pm »

I added  "vncserver :1" to startup section of .jwmrc and after booting I see that Xvnc is not running and nmap does not find 5901 on localhost.

A really weird side effect is that after booting when I did 'vncserver :1' from a shell, the hard drive started going crazy and :

Code:
ps -A |grep vnc

shows like 15 different Xvnc processes.

So I killed them with :

Code:
killall Xvnc

But they kept coming! After about 3 or 4 'killall Xvnc' the hard drive quieted down and I removed the 'vncserver :1' from my .jwmrc. After that I ran 'vncserver :1' and no problems.

So in summary editing my .jwmrc did not autostart my vnc and it made my vnc go insane here is the relevant section of my .jwmrc :

Code:
<StartupCommand>

      if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
         dbuslaunch=`which dbus-launch`
         if test x"$dbuslaunch" != x"" -a x"$dbuslaunch" != x"no"; then
            eval `$dbuslaunch --sh-syntax --exit-with-session`
         fi
      fi
      pcmanicons on
      vncserver :1
</StartupCommand>

maybe the ':' character is reserved or something?
Logged
dukefluke
Member
*
Posts: 31


« Reply #5 on: July 28, 2008, 06:38:01 pm »

Ok so it was the ':' after all what I did was to make a small shell script called 'vncstart':

Code:
#!/bin/bash
vncserver :1

then I replaced 'vncserver :1' with 'vncstart' in my .jwmrc.

This fixed the bazillion Xvnc processes from spawning when I manually start vncserver but when I reboot
port 5901 is not open and vnc is not running.

Logged
dukefluke
Member
*
Posts: 31


« Reply #6 on: July 28, 2008, 08:43:12 pm »

As a test I added the following to the StartupCommand section of my ~/.jwmrc file:

Code:
echo 'ftw' > /home/user/test.txt

After rebooting and logging on, I can confirm that nothing that I put in the StartupCommand section of my ~/.jwmrc file is being excecuted.  Huh
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3180



« Reply #7 on: July 29, 2008, 04:00:55 am »

If you are inclusing your own script you have to do it using an absolute path to the script.
/path/to/your/vncstart

Also, I'd make sure that the script is set to executabled (chomd +x <script_name>)
Try that and see if it works
Logged

dukefluke
Member
*
Posts: 31


« Reply #8 on: July 29, 2008, 06:56:54 am »

Thanx M0E-lnx,

I tried putting the absolute path still no luck. Also I made sure my vncstart script
had the absolute path to the vnc command as well.

Logged
nightflier
Administrator
Vectorian
*****
Posts: 4024



« Reply #9 on: July 29, 2008, 07:39:34 am »

You are logging in to JWM, not Fluxbox or LXDE?
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3180



« Reply #10 on: July 29, 2008, 07:48:18 am »

That is weird... but the again I haven't used jwm that much.
I'd also try to put it right after the <StartUpCommand> line and before anything else in that line

Also, another thing thing to consider is this. You're editing your ~/.jwmrc
There is also a /usr/etc/system.jwmrc
is it possible that the distro is following that one instead of yoru ~/.jwmrc?
Try (very carefully) adding your changes to that one instead
Logged

dukefluke
Member
*
Posts: 31


« Reply #11 on: July 29, 2008, 08:00:53 am »

nightflier, well I think I am. Here is a 'ls -l' from my /etc/X11/xinit dir:

Code:
lrwxrwxrwx 1 root root 11 2008-07-27 07:31 xinitrc -> xinitrc.jwm*

Also I made sure that I hade JWM selected from the drop down list when logging on.

M0E-lnx, ok I will try both of your suggestions.


Logged
nightflier
Administrator
Vectorian
*****
Posts: 4024



« Reply #12 on: July 29, 2008, 08:19:01 am »

The window manager in use is evident by the appearance of the desktop. Sounds like you are using JWM, okay  Smiley

Besides making sure that the paths are correct and your script is executable, I can't think of anything else right off the bat. Will try some experiments on my end.
Logged
dukefluke
Member
*
Posts: 31


« Reply #13 on: July 29, 2008, 08:30:35 am »

Ok first I moved '/usr/local/bin/vncstart' to the beginning of 'StartupCommand' in ~/.jwmrc

rebooted, logged on that didn't work.

Then I tried the same with the /usr/etc/system.jwmrc file. Still no go.

I made sure that my vncstart script is set executable and it does work when i type 'vncstart' from a shell.


I think I'll try fluxbox to see what happens there hehe.
Logged
dukefluke
Member
*
Posts: 31


« Reply #14 on: July 29, 2008, 09:21:07 am »

fluxbox works, not perfectly, but works. The vncstart command excecutes when put in ~/.fluxbox/startup

Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!