LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 10-19-2005, 09:46 AM   #1
stork
LQ Newbie
 
Registered: Oct 2005
Posts: 25

Rep: Reputation: 15
VNC newbie help


Hi, i want help with setting up my VNC server om my Mandriva 2006 system.
Is there a graphical inteface to do this, if not, how do it manually?

I want it to work like this:

When i access my mandriva computer from a vnc window on another machine i want the option to log in as any user.
I want the resoluton in my VNC window to be 1280x1024 even though the screen om my mandriva computer only has 1024x768 (old laptop)
I want the vnc server to start at startup.

Can anyone help me with this?

And remember - Im a newbie!
 
Old 10-19-2005, 11:26 AM   #2
conn-fused
Member
 
Registered: Jun 2004
Posts: 124

Rep: Reputation: 15
I use 10.1, and I like the command line, so I'm afraid I can't help on the GUI side. I have set up vnc before, however, and I might be able to help.

First you need to make sure you have the right packages installed. I would type the following at the command line:
rpm -qa | grep vnc

If that looks unfamiliar, I'm asking the rpm command to (q)uery (a)ll installed packages (try just "rpm -qa" sometime and you'll see), then piping the output to grep. Grep is a great text searching tool, and it looks through the text (in this case the text from the rpm command ... but you can give grep a file or files to look at) for all references to vnc. (by default, grep is case sensitive).

Anyway, you should see a vncserver package. If not, you'll have to begin by installing it (you can use a GUI for this ... if you need help, let me know).

Your vncserver is probably set up in a default configuration ... test it out to see if it works. First, make sure it is started with (as root):
service vnc start
(it might be service vncserver start ... I don't recall, and am not at a VNC enabled machine now ... but now that I think about it you could check with (as root) "chkconfig --list | grep vnc" <--- the pipe to grep trick again, this time with data from chkconfig. Chkconfig shows you what services are setup to run at boot time in various runlevels. Right now you're just looking for the proper name of the vnc service (so you can use it in your "service whatever start" command, but later we'll use chkconfig to get VNC started at boot.))

So, if "service vnc start" worked (and there are no firewall problems), you can now vnc into your laptop. Start a vncviewer session on a remote machine. You should get your login prompt.

If so, we now just need to ensure that it starts on boot and offers the right resolution. Starting on boot is easy. I think the command is:
chkconfig --level 35 vnc on
Which means, when booting in run levels 3 (to a command prompt) or 5 (straight into X), the vnc service should be turned on.

Now the resolution. I might leave this for now. Let's make sure you get to this point - we may have to go back and revisit some of these steps - first. And like I said, I don't have a vnc machine to hand. Basically, there will be a config file somewhere, almost certainly in /etc or a subdirectory thereof, which you'll edit to set the default resolution to whatever you desire. If everything goes smoothly, you could look for it yourself with a command like (as root):
locate vnc
If it says you need to update your database, run:
updatedb
Then:
locate vnc

Best of luck!

Last edited by conn-fused; 10-19-2005 at 12:48 PM.
 
Old 10-19-2005, 02:37 PM   #3
stork
LQ Newbie
 
Registered: Oct 2005
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Your vncserver is probably set up in a default configuration ... test it out to see if it works. First, make sure it is started with (as root):
service vnc start
I get to this point, and it's "service vncserver start". After that i have to type "vncserver" and choose a password to be able to access my desktop from another computer.
The problem is that i dont get the login screen but i get logged in as root.

Quote:
If so, we now just need to ensure that it starts on boot and offers the right resolution. Starting on boot is easy. I think the command is:
chkconfig --level 35 vnc on
When i type this with "vncserver" instead of "vnc" i just get a new command line with no confirmation that something has happend, is this what is supposed to happen?

Thanx for the detailed explenation, it really helps and i'm learning alot!!!
 
Old 10-19-2005, 06:35 PM   #4
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
1) Using urpmi or the GUI in the Mandrake Control Centre install tightvnc-server
2) Edit the file /etc/sysconfig/vncservers and add a line like this:
Code:
VNCSERVERS="1:yourusername"
3) Logged in as yourself run 'vncpasswd' and set a password for your vnc desktop
4) Create the file .wmrc in your home directory and add a single line with either KDE or GNOME
5) Start the vncserver service with 'service vncserver start' OR in the Mandrake Control Centre->System->Services

Now you should be able to login to a vncserver on <ip of machine>:1
 
Old 10-20-2005, 05:05 AM   #5
conn-fused
Member
 
Registered: Jun 2004
Posts: 124

Rep: Reputation: 15
Glad you enjoyed my (rather long-winded) post.

Quote:
When i type this with "vncserver" instead of "vnc" i just get a new command line with no confirmation that something has happend, is this what is supposed to happen?
It is almost certainly ok that you've been returned to the command prompt. If it hadn't worked, you'd have received an error message. Nonetheless, you can check with (as root):
chkconfig --list
Looking through the list, you should see that vncserver is now set to "on" under columns 3 & 5. Of course, if you don't want to look for the vncserver entry among a whole page of text, you can pipe the output to grep, as we've done before, with (as root):
chkconfig --list | grep vncserver

Quote:
I get to this point, and it's "service vncserver start". After that i have to type "vncserver" and choose a password to be able to access my desktop from another computer.
The problem is that i dont get the login screen but i get logged in as root.
The password problem is unfortunate, because I don't have a quick answer for it, and I'm still not at a VNC machine. In fact, I'm not even sure if I've encountered that problem before. When I connect to the vncservers on my networks, a window immediately appears with a login and password window.

--- Idea #1

It may (emphasis on may) be that I don't have a vncserver password set, but do have password authentication enabled for X. Perhaps your situation is the reverse: you've set a vncserver password, but auto-authenticate when you log into X? A few questions will help us clear this up:

When you boot up your machine, does it log you straight into X - without user intervention - like many peoples' Windows computers do? (This would be runlevel 5 with auto-authentication) Or does it ask for a username and password after bringing up some sort of GUI? (runlevel 5 with normal authentication). Or does it ask for a username and password from a text console, after which you start X manually with the "startx" command? (runlevel 3). If the first is the case, it's probably something to do with your X settings. If the second or third, it'll be to do with your vnc configuration.

--- Wait a second ... here's a new idea:

If you're requesting a VNC session with "vncserver" it's not to surprising if something a bit odd happens. Instead, try this:

On your laptop, open a terminal within X and type (as your normal user):
vncviewer localhost
Now do you get a normal login prompt? Hopefully the answer is yes. In that case, go to another machine on your network, open a terminal within X and type:
vncviewer hostname (where hostname is the name of your laptop)
If you don't know the name of your laptop, you can do one of two things.
1) Use the laptops IP address like so:
vncviewer 192.168.0.3 (using whatever the IP actually is, of course). If you don't know what the IP of the laptop is, ask the laptop by opening a terminal on the laptop and typing:
ifconfig
This will output a whole lot of data about your network devices. You're looking for the data on eth0 (your first ethernet card). Possibly eth1 if you have two network cards and eth0 is being used by something like a cable modem, but that's pretty unlikely. Anyway, there should be an IP address given there. It'll be either 192.168.x.y, 172.16-32.x.y, or 10.x.y.z (since those are the IP ranges for LANs).
2) Find out the hostname by looking in your /etc/hosts file. At the command line, type the following (as root):
cat /etc/hosts

--- Here's a bit about "cat" that you can skip if you want to stay on topic
"cat" is like "type" was in dos ... it outputs a file to standard output, which is almost always your monitor. You can of course, redirect cat's output with a pipe, or with some other operators. For instance, if you're bored, you can join two textfiles like this:
cat a.txt >> b.txt
Now when you "cat b.txt" you'll find the contents of a.txt appended to the end. This may seem pretty useless, but it is also a fast and easy way to join up .mpg movies. By the way, had you typed "cat a.txt > b.txt", the contents of b.txt would have been overwritten instead of a.txt being appended, so be careful with the single operator.
Also note, if there's too much text, so cat is not useful for reading it, you can try "more a.txt" or "less a.txt"

--- Anyway, back to the point. /etc/hosts
When you "cat /etc/hosts" you should see a line that says something like
127.0.0.1 localhost lo mydesktop
There may be another line that reads like this:
192.168.0.3 mylaptop
What you can gather from this, is that - as far as your desktop is concerned - your laptop's hostname is "mylaptop", so you can use this command to talk to it:
vncviewer mylaptop

Phew, that's probably plenty for now. Especially since most of it is off-topic. One parting thought ... we know you've installed the vncserver package but you may still need to do the vncviewer package. But you already know how to do that. Good luck!

Last edited by conn-fused; 10-20-2005 at 05:06 AM.
 
Old 11-04-2005, 03:16 AM   #6
stork
LQ Newbie
 
Registered: Oct 2005
Posts: 25

Original Poster
Rep: Reputation: 15
I finally got it to work with only one flaw.
The flaw is that i cannot access my program-meny, i can run programs from shortcuts on my desktop and panel though anyone has any ideas about this?

This is how i got it to work with help of many people:

First, as root open /etc/sysconfig/vncservers
Add line: VNCSERVERS="1:your_username"
Save and exit.

Then open /home/your_username/.vnc/xstartup
Uncomment the #!/bin/sh (remove the #-sign)
Save and exit.

Then open /etc/rc.d/rc.local
Add line at end: su your_username -c "vncserver -depth 16 -geometry 1280x1024"
This is to set the colordepth and geometry, you can set them as you want

Then start terminal.
As root: chkconfig --level 35 vncserver on

This will start the vnc sever at boot

The first time you restart your computer you will have to set a vnc password.
Start terminal:
As your_username: vncpasswd
then set a password and it should work.

Please correct me if im wrong!
 
Old 11-05-2005, 08:55 PM   #7
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Quote:
Then open /home/your_username/.vnc/xstartup
Uncomment the #!/bin/sh (remove the #-sign)
Save and exit.
Its not suprising that nothing starts up because you've just broken the xstartup script

That isn't actually just a comment - the #! is the magic character sequence that tells Linux that that file is a script to be executed using the program /bin/sh (it would be /usr/bin/perl for a perl script for example). Put the # back in and create a .wmrc file in your home directory to specify which desktop you want to load.

Quote:
Then open /etc/rc.d/rc.local
Add line at end: su your_username -c "vncserver -depth 16 -geometry 1280x1024"
This is to set the colordepth and geometry, you can set them as you want
This is unnecessary if you want to start vnc as a service and running it from there will probably stop the vncserver service from starting up. Comment it out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need VNC to allow 'logout/login' from Gnome (gnome & VNC runs fine) spudler Linux - Networking 3 11-14-2004 10:02 AM
Newbie help RE VNC viewer/server indespair Linux - Networking 3 08-25-2004 06:27 PM
newbie linux question - VNC laclac01 Linux - Networking 3 08-09-2004 03:01 PM
Newbie - VNC failing pm02368 Linux - Networking 3 03-25-2004 04:31 PM
VNC - Selecting different WindowManagers with VNC cmfarley19 Linux - Software 0 04-16-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration