vncserver: Wrong type of access mode of .vnc

C, C++, Python, Perl, Shell, etc.

vncserver: Wrong type of access mode of .vnc

Postby hannibal80 » 02 Aug 2011, 20:30

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, [file]tightvnc[/file], and I put it into [FILE]/usr/local/etc/rc.d[/FILE]

Code: Select all
#!/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"


then I modified my /etc/rc.conf adding
Code: Select all
tightvnc_enable="YES"


Now, when I reboot I have:

Code: Select all
[...]
/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
[...]


I've checked the .vnc permission that are:

Code: Select all
# pwd
/usr/home/Lorenzo
# ls -l | grep vnc
drwxrwxrwx  2 Lorenzo  wheel      512 Aug  2 21:36 .vnc


and

Code: Select all
# 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


this is the content of [FILE]/usr/home/Lorenzo/.vnc/xstartup[/FILE]


Code: Select all
#!/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 &


Can you please help me?

Thanks in advice.
hannibal80
Junior Member
 
Posts: 42
Joined: 02 Aug 2011, 20:05
Location: Rome - Italy

Postby SirDice » 03 Aug 2011, 06:28

hannibal80 wrote:
Code: Select all
USER=Lorenzo
HOME=/usr/home/Lorenzo

export USER HOME

It doesn't work that way. Use [man=1]su[/man].
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16153
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby hannibal80 » 03 Aug 2011, 07:38

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: Select all
#!/bin/sh
#

# REQUIRE: DAEMON
# PROVIDE: tightvnc

. /etc/rc.subr
[color="Red"]
#USER=Lorenzo
#HOME=/usr/home/Lorenzo

#export USER HOME[/color]

PATH=$PATH:/usr/local/bin/ && export PATH
echo $PATH
[color="Red"]#echo $USER
#echo $HOME
[/color]
name="tightvnc"
rcvar=`set_rcvar`
load_rc_config $name
[color="Red"]command="su /usr/local/bin/vncserver"[/color]

tightvnc_enable=${tightvnc_enable-"NO"}
tightvnc_pidfile=${tightvnc_pidfile-"/var/run/tightvnc.pid"}

pidfile="${tightvnc_pidfile}"

run_rc_command "$1"


Thank you.
hannibal80
Junior Member
 
Posts: 42
Joined: 02 Aug 2011, 20:05
Location: Rome - Italy

Postby pbd » 03 Aug 2011, 08:34

Code: Select all
command="su - Lorenzo -c /usr/local/bin/vncserver"


See [man]su[/man].
pbd
Member
 
Posts: 191
Joined: 16 Nov 2008, 16:39
Location: Brno, CZ

Postby hannibal80 » 03 Aug 2011, 10:11

Ok, tonight I'll try with that and I'll give you a feedback,
thank you!
hannibal80
Junior Member
 
Posts: 42
Joined: 02 Aug 2011, 20:05
Location: Rome - Italy

Postby hannibal80 » 03 Aug 2011, 16:28

Yes, finally it works! Thank you!
hannibal80
Junior Member
 
Posts: 42
Joined: 02 Aug 2011, 20:05
Location: Rome - Italy


Return to Userland Programming & Scripting

Who is online

Users browsing this forum: No registered users and 0 guests