Tải bản đầy đủ - 0 (trang)
10 Enabling File and Printer Sharing, and Multimedia in Nxclient

10 Enabling File and Printer Sharing, and Multimedia in Nxclient

Tải bản đầy đủ - 0trang

Discussion

If you have chronically roaming users, or users sharing Windows PCs, or generic

public terminals, it is wise to disable login and password saving.

Obviously, you must make sure that the nopasswd file is read-only by the user. On

Linux, this is easy:

# chown root:root nopasswd

# chmod 644 nopasswd



On Windows, it isn’t so easy. Windows NT, 2000, 2003, and XP Pro running the

NTFS filesystem let you tweak individual file permissions; just right-click on the file

icon, and go to the Security tab to set ownership and access permissions.

However, any Windows running the FAT32 filesystem does not have ACLs. Windows XP Home does not include an ACL-capable filesystem, nor does Windows XP

Pro in Simple File Sharing mode.

Simple File Sharing is on in XP Pro by default; to turn it off, open My Computer

➝ Tools ➝ Folder Options ➝ View ➝ Advanced Settings, and uncheck “Use simple

file sharing (Recommended).”

You should do this as Administrator because Simple File Sharing is enabled/disabled

per user. So, make sure the boss has control, however feeble. You can also make

nopasswd a hidden file, for a wee bit of extra obscurity.



See Also

• Run /usr/bin/nxserver --help as root to see all server commands

• NoMachine’s Support Center:

http://www.nomachine.com/support.php

• NX Server System Administrator’s Guide:

http://www.nomachine.com/documentation/admin-guide.php



8.12 Troubleshooting FreeNX

Problem

You cannot connect—help!



Solution

Check the server logfile first, /var/log/nxserver.log. If the logfile is not detailed

enough, go into /etc/nxserver/node.conf, and bump up the logging level. Available levels are 0–7. Level 6 is usually sufficient:

NX_LOG_LEVEL=6



8.12



Troubleshooting FreeNX |



247



Nxclient has its own log viewer in the NX Session Administrator, at Session ➝ View

session log.

The logfiles don’t always tell you what you need to know. Here are a number of

common problems that are easy to remedy:

• Make sure TCP port 3389 is not blocked on the clients.

• Make sure TCP port 22 is not blocked on the server.

• Make sure you are using the correct hostname or IP address of your FreeNX

server.

• Make sure that you have distributed the correct client keys—probably the most

common error is creating a new key pair when installing the server, and forgetting to distribute the client key.

• Check filepaths in /etc/nxserver/node.conf and in the NX Clients.



See Also

• NoMachine’s Support Center:

http://www.nomachine.com/support.php

• NX Server System Administrator’s Guide:

http://www.nomachine.com/documentation/admin-guide.php



8.13 Using VNC to Control Windows from Linux

Problem

You want to control your Windows workstation or server remotely from your Linux

box. Or, you want to be able to remotely control user’s Windows PCs for helpdesk

chores or remote administration.



Solution

Virtual Network Computing (VNC) is just what you need. There are several variants

of VNC; in these recipes, we’ll use TightVNC. VNC has two parts: the server and the

client (which is called the viewer).

Install the TightVNC server and the DFMirage driver on Windows (see TightVNC,

http://www.tightvnc.com/).

Install any VNC viewer on Linux. Chances are, one is already installed by default.

The TightVNC viewer includes a Java viewer, so any Java-enabled web browser can

be a VNC viewer.

The Windows installer will take you through a number of steps. The main question

is, do you want TightVNC to run as a service or in application mode? You can



248



|



Chapter 8: Using Cross-Platform Remote Graphical Desktops



change this at any time with the “Install VNC Service” or “Remove VNC Service”

commands. Use application mode for occasional use, and run it as a service for frequent use.

These configuration options are important:

• On the Server tab, be sure to enable Accept Socket Connections.

• Make sure there are passwords for Primary Password and View-Only Password.

Passwords may not be more than eight characters.

• On the Administration tab, check Disable Empty Passwords.

• To enable using a web browser as a client, check Enable built-in HTTP server.

• Enable logging; it’s not necessary to turn on debugging unless you’re having

problems.

Now, you can connect from any VNC viewer on any operating system by entering

the IP address or hostname of the Windows box. Figure 8-6 shows the Xvnc4viewer

login screen.



Figure 8-6. Xvnc4viewer login screen



You may use any VNC-capable viewer, like the KDE Remote Desktop Connection,

the Gnome remote desktop, jtightvncviewer, vncviewer, or xvnc4viewer.

To close out your remote session, just close the window.

To open a VNC session in a web browser, type http://[hostname-or-IP-address]:5800

in the address bar.

Please note that all transmissions are sent in the clear, and authentication is weakly

protected, so you do not want to use this over untrusted networks.



Discussion

On Debian, the TightVNC Java viewer is a separate package, tightvnc-java.

You can encrypt a VNC session by tunneling VNC over SSH (see Recipe 8.21). This

works on any platforms that support SSH and VNC.



8.13



Using VNC to Control Windows from Linux |



249



Unlike rdesktop, VNC works for any version of Windows.

Because the TightVNC server has its own password, you can log in to any active

Windows session; it doesn’t matter which Windows user is logged in.

In application mode, you need a Windows user already logged in on the Windows

PC to enable remote logins. When it’s running as a service, you don’t.

Only Windows users with administrative privileges can make any changes to the

TightVNC server configuration when it runs as a service. This prevents remote users

from shutting down the VNC server or changing its settings.

When the TightVNC server runs in application mode, then any Windows user can

run it as they please, and remote users can change VNC settings, and even shut it

down. This is a nice convenience for users, and also a potential security hole.



See Also

• RealVNC:

http://www.realvnc.com/

• TightVNC:

http://www.tightvnc.com/

• UltraVNC for Windows-to-Windows remote administration:

http://ultravnc.sourceforge.net/



8.14 Using VNC to Control Windows and Linux at the

Same Time

Problem

You need to use a Windows PC and a Linux PC a lot. Sure, you get some exercise

hopping back and forth from chair to chair, or scooting your chair about, but it

would be nice to control both from a single keyboard and mouse, and you would

rather not spend money on a hardware switch.



Solution

As usual, the Linux world provides an abundance of useful goodies. In addition to a

Windows VNC server (see the previous recipe), you’ll need the x2vnc program.

Of course, Linux must be in charge, and will control both computers. First, install

x2vnc on Linux.

Make sure the Windows VNC server is running and accepting connections.



250



|



Chapter 8: Using Cross-Platform Remote Graphical Desktops



Then, fire up x2vnc:

$ x2vnc 192.168.1.28:0 -west

x2vnc: VNC server supports protocol version 3.7 (viewer 3.3)

Password:

x2vnc: VNC authentication succeeded

x2vnc: Desktop name "powerpc-w2k"

x2vnc: Connected to VNC server, using protocol version 3.3

x2vnc: VNC server default format:



And there you are. -west means left, so you can move your cursor to the left off the

edge of your Linux screen, and it will reappear on your Windows screen. Now, you

control both computers with the same keyboard and mouse.



Discussion

You’ll notice that this is quite a bit peppier than a regular VNC session because you

are running native sessions on each computer, rather than creating virtual graphics

servers.

This can only be used to control Windows from Linux. If you want to run your primary session from a Windows PC, use Win2VNC on Windows, and the VNC server

of your choice on Linux.

Running two Linux PCs requires x11vnc for the VNC server.

x2vnc works by creating a one-pixel-wide trigger window at the edge of the screen,

which causes x2vnc to take control and send mouse movements and keystrokes to

the Windows PC.

Here are some useful options:

-resurface



This keeps the trigger window on top, so it can’t be covered by another window.

-edgewidth 3



If you have problems with the trigger window, you can try making it wider. Setting it to 0 disables it entirely, if you would rather use the hotkey to switch back

and forth.

-debug



If you are having problems, crank up the verbosity.

-hotkey



A common error message is “Warning: Failed to bind x2vnc hotkey, hotkey disabled.” Use the -hotkey option to specify which hotkey you want, like this:

$ x2vnc -hotkey F12 192.168.1.28:0 -west



Hitting F12 switches the cursor back and forth between your two screens. The

default is Ctrl-F12; you may use any combination of meta keys that you like.



See Also

• man 1 x2vnc

8.14



Using VNC to Control Windows and Linux at the Same Time |



251



8.15 Using VNC for Remote Linux-to-Linux

Administration

Problem

You want to use VNC to control other Linux PCs from your Linux box.



Solution

Install the VNC server and viewers of your choice on both Linux PCs. In this recipe,

we’ll use TightVNC. Fire up the VNC server on the first PC. This example shows a

first-time startup that creates the server’s configuration files and password:

carla@windbag:~$ tightvncserver

You will require a password to access your desktops.

Password:

Verify:

New 'X' desktop is windbag:1

Creating default startup script /home/carla/.vnc/xstartup

Starting applications specified in /home/carla/.vnc/xstartup

Log file is /home/carla/.vnc/windbag:1.log



Then, it exits. Start it up again:

carla@windbag:~$ tightvncserver

New 'X' desktop is windbag:2

Starting applications specified in /home/carla/.vnc/xstartup

Log file is /home/carla/.vnc/windbag:2.log



Notice that it helpfully tells you everything you need to know: the connection

parameters, configuration file, and logfile locations.

Now, run over to Linux PC number two, open a VNC viewer, and connect with the

hostname:

windbag:2



Or, use the IP address:

192.168.1.28:2



It will ask for a password, and there you are.

You can shutdown tightvncserver sessions on the server like this, specifiying the session number:

$ tightvncserver -kill :2

Killing Xtightvnc process ID 24306



Note that you must append a session number because Linux supports running multiple VNC servers at the same time.



252



|



Chapter 8: Using Cross-Platform Remote Graphical Desktops



Discussion

If you configured the server to use a different port number than the default 5800 (for

HTTP) or 5900 (VNC viewer), you’ll need to specify the port number in the client,

like this for port 6000:

windbag:6002



VNC adds the session number to the port number, so session 3 is 6003, and so forth.

You’ll notice this is quite a bit faster than using VNC to run Windows from Linux.

This is because VNC only needs to handle X Windows, which was designed from the

start to support networking. So, all VNC needs to do is transmit keyboard and

mouse input over TCP/IP, rather than replicating the entire screen like it does with

Windows, which uses an entirely different graphical subsystem. In effect, VNC must

repeatedly screen scrape and transmit a copy of the Windows display.

You may run as many VNC servers on a single Linux PC as you like. Just open new

instances of the VNC server, and it will automatically assign a new display:

$ tightvncserver

New 'X' desktop is windbag:3

Starting applications specified in /home/carla/.vnc/xstartup

Log file is /home/carla/.vnc/windbag:3.log



You can go nuts and connect back and forth as much as you like, or daisy-chain several VNC sessions by connecting to other PCs from inside the remote sessions.

Run ps ax | grep vnc to see how many servers you have running locally:

18737 pts/1

S

0:00 Xtightvnc :1 -desktop X -httpd /usr/share/tightvnc-java auth /home/carla/.Xauthority -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /

home/carla/.vnc/passwd -rfbport 5901 -fp /usr/share/X11/fonts/misc,/usr/share/X11/

fonts/cyrillic,/usr/share/X11/fonts/100dpi/:unscaled,/usr/share/X11/fonts/75dpi/:

unscaled,/usr/share/X11/fonts/Type1,/usr/share/X11/fonts/CID,/usr/share/X11/fonts/

100dpi,/usr/share/X11/fonts/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,/

var/lib/defoma/x-ttcidfont-conf.d/dirs/CID -co /usr/X11R6/lib/X11/rgb

19479 pts/5

S

0:00 Xtightvnc :2 -desktop X -httpd /usr/share/tightvnc-java auth /home/carla/.Xauthority -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /

home/carla/.vnc/passwd -rfbport 5902 -fp /usr/share/X11/fonts/misc,/usr/share/X11/

fonts/cyrillic,/usr/share/X11/fonts/100dpi/:unscaled,/usr/share/X11/fonts/75dpi/:

unscaled,/usr/share/X11/fonts/Type1,/usr/share/X11/fonts/CID,/usr/share/X11/fonts/

100dpi,/usr/share/X11/fonts/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,/

var/lib/defoma/x-ttcidfont-conf.d/dirs/CID -co /usr/X11R6/lib/X11/rgb



Run killall Xtightvnc to stop all of them.

Don’t run Xtightvnc directly, because tightvncserver is a wrapper script that performs sanity checks and emits useful error messages.



8.15



Using VNC for Remote Linux-to-Linux Administration |



253



See Also

• RealVNC:

http://www.realvnc.com/

• TightVNC:

http://www.tightvnc.com/

• UltraVNC for Windows-to-Windows remote administration:

http://ultravnc.sourceforge.net/



8.16 Displaying the Same Windows Desktop to

Multiple Remote Users

Problem

You want to run a remote demo to several of your users, or conduct a class, or otherwise set it up so that several people can share the same remote Windows desktop.



Solution

TightVNC supports multiple concurrent users. Anyone with a VNC viewer can

connect: Linux, Mac, or other Windows users.

First, configure the TightVNC server on Windows to accept multiple connections.

Double-click the systray VNC icon, or open Start ➝ TightVNC ➝ Show User Settings. Go to the Administration tab, and check “Automatic shared sessions.”

Now, your users can log in to Windows in the usual manner by entering the hostname

or IP of the Windows PC in their VNC clients. In VNC viewers, the port number is

5900. In the KDE Remote Desktop Connection (KRDC) viewer, it looks like Figures

8-7 and 8-8.

Now, imagine what happens when all of your users are connected—do you want

them to have control of the mouse and keyboard, or do you wish to lock them out?

Do you want to allow remote control only when the local Windows user is idle?

Configure these options on the Server tab under Input handling.



Discussion

TightVNC does not have any sort of user-monitoring tools—the only way it shows

client connections is that the systray icon changes color. There are a couple of useful

client-management options when you right-click the systray icon. You can block new

users from connecting, or kick off the entire lot of connected clients.



254



|



Chapter 8: Using Cross-Platform Remote Graphical Desktops



Figure 8-7. Login screen



Figure 8-8. Back home at the ranch



8.16



Displaying the Same Windows Desktop to Multiple Remote Users |



255



You may also view the session in a Java-enabled web browser. Enter the connection

parameters in standard URL form, plus the port number:

http://powerpc:5800



Or, use the IP address:

http://192.168.1.28:5800



On Debian, you need the tightvnc-java package installed on the server. The TightVNC

server RPMs and source tarballs include the Java component.



See Also

• RealVNC:

http://www.realvnc.com/

• TightVNC:

http://www.tightvnc.com/

• UltraVNC for Windows-to-Windows remote administration:

http://ultravnc.sourceforge.net/



8.17 Changing the Linux VNC Server Password

Problem

How do you change the Linux VNC server password?



Solution

Use the vncpasswd command:

$ vncpasswd

Password:

Verify:



Discussion

Remember to inform users when you change the password. You may do without

passwords entirely, if you really really want to.



See Also

• man 1 vncpasswd

• RealVNC: http://www.realvnc.com/

• TightVNC: http://www.tightvnc.com/

• UltraVNC for Windows-to-Windows remote administration:

http://ultravnc.sourceforge.net/



256



|



Chapter 8: Using Cross-Platform Remote Graphical Desktops



8.18 Customizing the Remote VNC Desktop

Problem

The default VNC remote desktop on Linux is little better than a plain vanilla SSH

session—all you get is some barebones window manager like TWM or Metacity, and

an Xterm. How do you get the window manager or desktop of your choice?



Solution

Edit your ~/.vnc/xstartup file on the server. This is the default:

#!/bin/sh

xrdb $HOME/.Xresources

xsetroot -solid grey

x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

x-window-manager &



If there is no ~/.Xresources file, comment that line out.

Simply replace -window-manager with the startup command for the window manager

of your choice, like this:

icewm &



Whenever you make changes in this file, you need to stop and restart the server:

$ tightvncserver -kill :1

$ tightvncserver



Then, log in again from your remote PC.

Table 8-2 lists some startup commands for various window managers, which must

be installed on the server if you want to use them.

Table 8-2. Startup commands for popular window managers

Window manager



Startup command



Afterstep



afterstep



Enlightenment



enlightenment



FVWM



fvwm2



Gnome



gnome-session



IceWM



icewm



KDE



startkde



TWM



twm



Xfce



startxfce4



8.18



Customizing the Remote VNC Desktop |



257



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

10 Enabling File and Printer Sharing, and Multimedia in Nxclient

Tải bản đầy đủ ngay(0 tr)

×