Setting up VNC for friends
Q I have been trying to set up a Linux box running Fedora for my friends to play with. They're mostly Windows guys and don't have a lot of command-line experience, so I'm trying to help them into the wonderful world of open source by setting up VNC on the Linux box so they can log in and play around on separate X session. I have created a script called vnclogon to start a VNC server session but am having a lot of trouble making it work. The script is as follows:
echo "Hello There "$USER
echo "You are about to run the VNC server service."
echo --n "Do you want to continue...(Y/N)"
if [ "$Decision" = "Y" ]; then
echo "Starting your VNC Session."
echo "Please wait..."
vncserver :1 -name
$USER >/dev/null 2&>1
echo "VNC Session Loaded!"
echo "Then why did you run the script?"
The strange thing is that the script seems to execute correctly but when someone tries to connect using a VNC viewer they get the following error: 'Unable to connect to host: Connection refused (10061)'. Even stranger is the fact that when I try to kill the VNC session by using the vncserver -kill:1 command, I get the following error: 'Killing Xvnc process ID 4790, Kill 4790: No such process'. The strange thing is that when I run the VNC server service manually, I manage to connect. Please help me make this work.
A You seem to have a nice script going and I admit that I was a bit puzzled by the error you got when you tried to kill the VNC session generated by the script. It appears that you've tried to suppress the output generated by VNC when a VNC server session is launched by redirecting the output to dev/nul using I/O redirection. The mistake is in the syntax of the command - instead of >/dev/null 2&>1, you should have typed >/dev/null 2&>1. The 2&>1 is actually a neat piece of code which is used to send standard error to the same place as the standard output. You've sent your standard output (1) to /dev/null, and so standard error (2) also goes to /dev/null. The & in 2&>1 is simply to put the job in the background so that you get your shell prompt back. All in all the script seems quite good and I believe that this correction should help solve your problem and allow your friends to make better acquaintance with Fedora's X front-end.
Follow us on Identi.ca or Twitter