e837
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, Shell, Perl, Sed & Awk |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello everyone,
I'm really a newbie to FreeBSD. I'm trying to make vncserver able to automatic start up on boot with a user that's not root. So, I spent 3 nights reading everywhere about my issues and I was able to get vnc working with xfce4. The server I used is tightvnc. Now, the last step for now is to make it start up on boot. I made a script, tightvnc, and I put it into /usr/local/etc/rc.d Code:
#!/bin/sh
#
# REQUIRE: DAEMON
# PROVIDE: tightvnc
. /etc/rc.subr
USER=Lorenzo
HOME=/usr/home/Lorenzo
export USER HOME
PATH=$PATH:/usr/local/bin/ && export PATH
echo $PATH
echo $USER
echo $HOME
name="tightvnc"
rcvar=`set_rcvar`
load_rc_config $name
command="/usr/local/bin/vncserver"
tightvnc_enable=${tightvnc_enable-"NO"}
tightvnc_pidfile=${tightvnc_pidfile-"/var/run/tightvnc.pid"}
pidfile="${tightvnc_pidfile}"
run_rc_command "$1"
Code:
tightvnc_enable="YES" Code:
[...] /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin Lorenzo /usr/home/Lorenzo Starting tightvnc. vncserver: Wrong type or access mode of /usr/home/Lorenzo/.vnc. /etc/rc: WARNING: failed to start tightvnc [...] Code:
# pwd /usr/home/Lorenzo # ls -l | grep vnc drwxrwxrwx 2 Lorenzo wheel 512 Aug 2 21:36 .vnc Code:
# pwd /usr/home/Lorenzo/.vnc # ls -l total 4932 -rw------- 1 Lorenzo wheel 8 Aug 2 00:04 passwd -rw------- 1 Lorenzo wheel 5025792 Aug 2 00:08 xfce4-settings-help.core -rwxr-xr-x 1 Lorenzo wheel 204 Aug 2 00:07 xstartup Code:
#!/bin/sh /usr/local/bin/startxfce4 #[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources #xsetroot -solid grey #vncconfig -iconic & #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #twm & Thanks in advice. Last edited by DutchDaemon; August 2nd, 2011 at 21:41. |
|
#2
|
||||
|
||||
|
It doesn't work that way. Use su(1).
__________________
Senior UNIX Engineer at Unix Support Nederland Experience is something you don't get until just after you need it. |
| The Following User Says Thank You to SirDice For This Useful Post: | ||
hannibal80 (August 4th, 2011) | ||
|
#3
|
|||
|
|||
|
Hi Sir, thanks for your replay.
But, as I'm a real newbie, how can I use "su" directive in my script? How can I change it? Something like this? Code:
#!/bin/sh
#
# REQUIRE: DAEMON
# PROVIDE: tightvnc
. /etc/rc.subr
#USER=Lorenzo
#HOME=/usr/home/Lorenzo
#export USER HOME
PATH=$PATH:/usr/local/bin/ && export PATH
echo $PATH
#echo $USER
#echo $HOME
name="tightvnc"
rcvar=`set_rcvar`
load_rc_config $name
command="su /usr/local/bin/vncserver"
tightvnc_enable=${tightvnc_enable-"NO"}
tightvnc_pidfile=${tightvnc_pidfile-"/var/run/tightvnc.pid"}
pidfile="${tightvnc_pidfile}"
run_rc_command "$1"
|
|
#4
|
|||
|
|||
|
Code:
command="su - Lorenzo -c /usr/local/bin/vncserver" |
| The Following User Says Thank You to pbd For This Useful Post: | ||
hannibal80 (August 4th, 2011) | ||
|
#5
|
|||
|
|||
|
Ok, tonight I'll try with that and I'll give you a feedback,
thank you! |
|
#6
|
|||
|
|||
|
Yes, finally it works! Thank you!
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| headless vnc | particleman | Web & Network Services | 6 | April 13th, 2010 11:03 |
| Installed vnc but there's only vncviewer and no vncserver | aurora72 | Installation and Maintenance of FreeBSD Ports or Packages | 4 | October 4th, 2009 23:38 |
| [Solved] vncserver, change the port | gripek | Web & Network Services | 2 | August 11th, 2009 13:28 |
| start vncserver at boot? | cipher | Installation and Maintenance of FreeBSD Ports or Packages | 4 | June 4th, 2009 20:42 |
| vnc and keyboard problems | cipher | Installation and Maintenance of FreeBSD Ports or Packages | 3 | May 13th, 2009 11:25 |