I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
Cheers, BJ
On Ubuntu, possibly on other Gnome (2) distros, there's a Remote Desktop setting (in System/Preferences). This will run a VNC server once logged in. I used to run VNC as a server before log-in but after a while I couldn't get it to work any more - I can't remember why.
Remote Desktop should work out of the box if you just enable it with no jobs or scripts and should be OK if you just want it to run after log-in.
HTH. Steve
On 12/09/12 11:18, John Woodard wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
Cheers, BJ
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
No gnome as it's Debian Wheezy running LXDE on a Rasberry PI so really looking for the best place to insert the command. I tried /etc/rc.local but it doesn't seem to want to play ball. I think I'm missing something fundamental here. I'm open to ridicule for this schoolboy question but just want the damn thing to work.
Cheers, BJ
On 12 September 2012 12:29, steve-ALUG@hst.me.uk wrote:
On Ubuntu, possibly on other Gnome (2) distros, there's a Remote Desktop setting (in System/Preferences). This will run a VNC server once logged in. I used to run VNC as a server before log-in but after a while I couldn't get it to work any more - I can't remember why.
Remote Desktop should work out of the box if you just enable it with no jobs or scripts and should be OK if you just want it to run after log-in.
HTH. Steve
On 12/09/12 11:18, John Woodard wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
Cheers, BJ
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
Check whether you have the necessary program 'vncviewer' needed for the command installed. I see I have it installed on a (now mothballed) Ubuntu distribution, but not on any of my Debian installations. (And the Ubuntu installation would have put it in automatically, since I'm sure I didn't make any conscious decision to include it).
Ted.
On 12-Sep-2012 17:41:05 John Woodard wrote:
No gnome as it's Debian Wheezy running LXDE on a Rasberry PI so really looking for the best place to insert the command. I tried /etc/rc.local but it doesn't seem to want to play ball. I think I'm missing something fundamental here. I'm open to ridicule for this schoolboy question but just want the damn thing to work.
Cheers, BJ
On 12 September 2012 12:29, steve-ALUG@hst.me.uk wrote:
On Ubuntu, possibly on other Gnome (2) distros, there's a Remote Desktop setting (in System/Preferences). This will run a VNC server once logged in. I used to run VNC as a server before log-in but after a while I couldn't get it to work any more - I can't remember why.
Remote Desktop should work out of the box if you just enable it with no jobs or scripts and should be OK if you just want it to run after log-in.
HTH. Steve
On 12/09/12 11:18, John Woodard wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
Cheers, BJ
------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@wlandres.net Date: 12-Sep-2012 Time: 19:17:50 This message was sent by XFMail -------------------------------------------------
On 12 September 2012 11:18, John Woodard mail@johnwoodard.co.uk wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
How about putting a file in /etc/rc2.d/ called S99vncservers_up, adding it to init.d with update-rc.d, the file comprising of something along the lines of:
#####
#!/bin/sh
BINFILE=/usr/bin/vncserver
# bail out gracefully if the package has been removed if [ ! -f $BINFILE ]; then exit 0 fi
vncserver_up() { echo "Starting vncserver for $1" if su $1 --command=$BINFILE then echo "vncserver started ok for user $1" fi }
vncserver_up jenny vncserver_up john
####
Works for me! Jenny
On 12 September 2012 19:23, Jenny Hopkins hopkins.jenny@gmail.com wrote:
On 12 September 2012 11:18, John Woodard mail@johnwoodard.co.uk wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
How about putting a file in /etc/rc2.d/ called S99vncservers_up, adding it to init.d with update-rc.d, the file comprising of something along the lines of:
#####
#!/bin/sh
BINFILE=/usr/bin/vncserver
# bail out gracefully if the package has been removed if [ ! -f $BINFILE ]; then exit 0 fi
vncserver_up() { echo "Starting vncserver for $1" if su $1 --command=$BINFILE then echo "vncserver started ok for user $1" fi }
vncserver_up jenny vncserver_up john
####
Works for me! Jenny
I ended up writing this bash script and bunged it in /etc/init.d as tightvncserver
# !/bin/bash # /etc/init.d/tightvncserver
# Carry out specific functions when asked to by the system case "$1" in start) su pi -c '/usr/bin/tightvncserver :1 -geometry 1280x1024 -depth 16 -pix$ echo "Starting VNC server " ;; stop) pkill tightvnc echo "VNC Server has been stopped (didn't double check though)" ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac
I was being lazy my bash scripting ain't that good but it's now working but not as intended as I'm getting roots desktop. I'll give your solution a go Jen will it run as normal user?
Thanks all.
BJ
On 12 September 2012 20:54, John Woodard mail@johnwoodard.co.uk wrote:
On 12 September 2012 19:23, Jenny Hopkins hopkins.jenny@gmail.com wrote:
On 12 September 2012 11:18, John Woodard mail@johnwoodard.co.uk wrote:
I want to run a vnc server on startup as a user rather than root and seek opinion to where the best place to put the command
tightvncserver :1 -geometry 1280x1024 -depth 16 -pixelformat rgb565
etc/rc.local cron job?
Not sure here really if it needs to be before login so thought it prudent to run as a user.
How about putting a file in /etc/rc2.d/ called S99vncservers_up, adding it to init.d with update-rc.d, the file comprising of something along the lines of:
#####
#!/bin/sh
BINFILE=/usr/bin/vncserver
# bail out gracefully if the package has been removed if [ ! -f $BINFILE ]; then exit 0 fi
vncserver_up() { echo "Starting vncserver for $1" if su $1 --command=$BINFILE then echo "vncserver started ok for user $1" fi }
vncserver_up jenny vncserver_up john
####
Works for me! Jenny
I ended up writing this bash script and bunged it in /etc/init.d as tightvncserver
# !/bin/bash # /etc/init.d/tightvncserver # Carry out specific functions when asked to by the system case "$1" in start) su pi -c '/usr/bin/tightvncserver :1 -geometry 1280x1024 -depth 16 -pix$ echo "Starting VNC server " ;; stop) pkill tightvnc echo "VNC Server has been stopped (didn't double check though)" ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac
I was being lazy my bash scripting ain't that good but it's now working but not as intended as I'm getting roots desktop. I'll give your solution a go Jen will it run as normal user?
Thanks all.
BJ
The way round that is to make starting the vnc server part a little function, as in vncserverup() { blah } then underneath it call the function with vncserver_up john
which runs the function, passes the name john to the function as variable $1, and so runs the vnc server command as john. su $1 --command=$BINFILE ($1 is interpreted by the function as john)
Jen
On 12 September 2012 21:45, Jenny Hopkins hopkins.jenny@gmail.com wrote:
On 12 September 2012 20:54, John Woodard mail@johnwoodard.co.uk wrote:
I was being lazy my bash scripting ain't that good but it's now working but not as intended as I'm getting roots desktop. I'll give your solution a go Jen will it run as normal user?
Thanks all.
BJ
The way round that is to make starting the vnc server part a little function, as in vncserverup() { blah } then underneath it call the function with vncserver_up john
which runs the function, passes the name john to the function as variable $1, and so runs the vnc server command as john. su $1 --command=$BINFILE ($1 is interpreted by the function as john)
Jen
I like your little function trick probably neater than what I've ended up with which is this script as /etc/init.d/tightvncserver
#!/bin/sh -e ### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: networking # Default-Start: 2 3 4 5 # Default-Stop: 0 6 ### END INIT INFO
PATH="$PATH:/usr/bin/"
# The Username:Group that will run VNC export USER="pi" #${RUNAS}
# The display that VNC will use DISPLAY="1"
# Color depth (between 8 and 32) DEPTH="16"
# The Desktop geometry to use. #GEOMETRY="<WIDTH>x<HEIGHT>" #GEOMETRY="800x600" #GEOMETRY="1024x768" GEOMETRY="1280x1024"
# The name that the VNC Desktop will have. NAME="my-vnc-server"
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/tightvncserver ${OPTIONS}" ;;
stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/tightvncserver -kill :${DISPLAY}" ;;
restart) $0 stop $0 start ;; esac
exit 0
It runs at any run level as the std user "pi" and does the job. I don't think {NAME} is strictly necessary but the {GEOMETRY}, {DEPTH} are needed and the {DISPLAY} vital. I did try with the options right after the command as you would input in command line [command:display# -option foo -option2 bar] but it didn't work? Is BASH that way inclined?
All working now.
Cheers, BJ