Occasionally it is useful allow connections between desktop sessions running on different computers. This can be very handy when troubleshooting a problem as both users will be able to see the error on the problematic system and either user can take control of the mouse and keyboard in order to fix the problem. Typically this is a temporary situation as providing access to one's computer allows a remote user the ability to both view and modify its settings.
This section will demonstrate three remote desktop scenarios: how to configure X to allow remote connections, how to configure an RDP connection from PC-BSD, and how to invite another computer to connect to your desktop session.
Configure X for Remote Connections
It may seem reversed that the user's terminal is the server and the applications are clients, due to X taking the perspective of the application, rather than the end user. It is because of this that since X provides display and I/O services to applications, it is a server; applications use these services, making them clients.
In order to make things easier to relate to and avoid possible confusion, this page will adopt simpler alternative definitions: Host - The machine running X that is providing access. Guest - The machine or entity requesting access.
- For security reasons, the default setting is to not allow a machine to remotely open a window.
- To enable this feature, issue the command in a terminal:
% startx -listen_tcp
- Mac (OS X)
- It seems that it would be a simple matter to start X, though would the entire desktop automatically be available, or would it be an X within a window.
- Probably not accessible except through samba or other methods, though if an instance of X is begun with xming or cygwin, then that should be accessible.
- Could be as straightforward as FreeBSD but there may be some minor differences or preference to certain related programs.
- xhost and/or xauth are used.
On the local machine, open a terminal window use telnet or ssh to connect to the remote machine then request local display/input service.
ssh 192.168.1.200 export DISPLAY=[user's machine]:0
- Mac (OS X)
- From a Mac the setup is similar to FreeBSD, however, to enable this capability other software may need to be installed. X11 is included on your OS X (10.6) install discs but is not a part of your default system. Install X11 and you should be able to start up an X server so you can display apps running on your PC-BSD/FreeBSD machine on your Mac.
- Windows (XP, Vista, 7)
- Download and install xming. It should have created a start menu item (folder) xming. Go into the folder and click 'XLaunch' to bring up the wizard that will let you create a shortcut to launch the remote terminal. Within the wizard, select the default 'Multiple windows' On the next screen, select 'Start a program' Next, type 'gnome-terminal' as the program to start. Then select 'Using PuTTY (plink.exe)'. Enter 'the.hostname.net' as the computer to connect. The next screen should look like the picture below. Just click next (tick clipboard) On the next screen, click 'Save Configuration'. In the window that pops up navigate to your desktop and type the filename 'hostname.xlaunch' as shown in the picture. Then click save and finish the XLaunch wizard. Notice that it has placed a shortcut to launch the remote terminal on your desktop.
- Aside from program preference, it should be identical to FreeBSD.
Connecting to Another Desktop Using Remote Desktop
If the other computer you are connecting to is a Windows system, the connection can be made using the remote desktop protocol (RDP). While remote desktop has been available since Windows XP, not every edition of Windows provides a fully functional version--for example, it may not be fully supported in a home edition of Windows. If the full version of RDP is included, remote access may or may not be enabled by default. If you have trouble connecting using RDP, do a Google search for "remote desktop" and the name of the version of Windows you are using to find out how to configure its remote desktop settings. If you still can't connect, you will need to download, install and configure VNC server software on the system.
If the other computer you are connecting to is a Mac, Linux, or BSD system, you will have to first install either rdesktop or a VNC server on the other system. Depending upon the operating system, either software may or may not already be installed. If it is not, check the software repository for the operating system or use Google to find out how to install and configure one of these applications on that operating system. If you are connecting to another PC-BSD system, rdesktop is already installed for you.
If the remote system is protected by a firewall, you will need to check that it allows connections to the TCP port required by the type of connection that you will be using:
RDP: uses port 3389
VNC: uses port 5900 (for the first connection, 5901 for the second connection, etc.)
If you need to manually add a firewall rule, it is best to only allow the IP address of the computer that will be connecting. It is also more secure to remove or disable this firewall rule after the connection is finished so that other computers don't try to connect to the computer. Since your PC-BSD system is considered to be the client and will be initiating the connection, you do not have to modify the firewall on the PC-BSD system.
Once the other computer has the software it needs for the connection, you can initiate a connection request using KRDC. To launch this application, go to Application Launcher -> Internet -> Remote Desktop Client. You can also launch this application by typing krdc at the command line. If you click F1 while in KRDC you can access the Remote Connection Desktop Handbook to learn more about how to use this application.
Figure 5.9a shows the initial KRDC screen which allows you to specify which system you wish to connect to.
Figure 5.9a: Creating a Connection Using KRDC
Use the drop down menu to indicate whether the remote system is using RDP or VNC for the connection. Then type in the IP address of the system you wish to connect to. If you are connecting to a VNC system, the IP address needs to be followed by a colon and a number indicating the number of the session. Typically, the number will be 1 unless the VNC server is hosting multiple simultaneous connections. Once you press enter, the connection will be initiated and you will see the screen shown in Figure 5.9b:
Figure 5.9b: Settings for the Connection
Here is a quick overview of the settings:
Desktop resolution: since the contents of the screen are sent over the network, select the lowest resolution that still allows you to see what is happening on the other system. If you have a very fast network connection, you can choose a higher resolution; if you find that the other system is very slow to refresh its screen, try choosing a lower resolution.
Color depth: choose the lowest color depth that allows you to see the other system; you can choose a higher color depth if the network connection is fast.
Keyboard layout: this drop down menu allows you to select the desired keyboard layout.
Sound: this drop down menu allows you to choose whether any sounds heard during the connection are produced on this system, the remote system, or to disable sound during the connection.
Console login: if you are connecting to a Unix-like system, you can check this box if you wish to have access to the other system's command line console.
Extra options: allows you to specify rdesktop switches that aren't covered by the other options in this screen.
Show this dialog again for this host: if you plan on using the same settings every time you connect to this computer, you can uncheck this box. If you need to change the settings at a later time, you can right-click the connection (which will appear in a list as a past connection) and choose Settings from the right-click menu.
Remember password: KWallet is KDE's password storage system. If this box stays checked, you will only need to input the password the first time you make this connection as it will be saved for you. If this is the first time you have stored a password using KWallet, it will prompt you for some information to set up your wallet.
Once you press OK, a connection will be initiated and you will receive pop-up messages asking for a username then a password; the details you provide must match a user account on the system you are connecting to. Once your authentication details are confirmed, you should see the desktop of the other system. If you move your mouse, it will move on the other desktop as well. Click the "View Only" button in the top toolbar whenever you wish to disable this mouse behaviour. When you are finished your session, you can click the "Disconnect" button in the top toolbar.
Allowing Another Computer to Connect Using Desktop Sharing
If you wish another user to connect to your computer, you can use the Krfb desktop sharing application to generate a connection invitation. To launch this application go to Application Launcher -> Internet -> Desktop Sharing or type krfb from the command prompt. If you press F1 while in this application, it will open the Desktop Sharing Handbook where you can learn more about using this utility. Figure 5.9c shows the initial screen for this application:
Figure 5.9c: Initiating a Connection Request Using Krfb
There are two types of invitations that you can create:
Personal Invitation: if you click this button it will display the hostname that the other person will use to connect, a temporary password to use for the connection, and an connection request expiration time of one hour. It will include a warning reminding you to only give this information to the person you wish to connect as anyone can connect using that information. The connection itself can be made from any VNC client. If the person is using PC-BSD, they can use KRDC as described above. On other operating systems, they will need to check if VNC is installed and download a VNC client if it is not. Once you press the Close button, the invitation expiry date will be listed in the main screen.
Email Invitation: if you click this button it will display a warning that anyone who reads the email containing the invitation can connect. Once you click the Continue button, the default email program will open up containing the invitation so that you can input the email address of the recipient and send the email.
It should be noted that the most secure way to convey the invitation information is through an alternate communications channel such as a phone call. Ideally, you are speaking to the other person as they connect so you can walk them through the problem you are experiencing and they can let you know what they are doing to your system as you watch them do it.
Figure 5.9d shows an example of a personal invitation:
Figure 5.9d: Connection Invitation Created Using Krfb
Once the other person has the invitation, they should input the information in the invitation into their VNC client (also called a VNC viewer) in order to start a connection. You will know when they try to connect as a pop-up message will appear on your screen similar to Figure 5.9e:
Figure 5.9e: The Other User is Trying to Connect Using the Invitation
In this example, a computer with an IP address of 192.168.1.111 is trying to connect. Buttons are provided to either accept or refuse the connection. You can also check or uncheck the box to "allow remote user to control keyboard and mouse". If you accept the connection, the other user will be prompted to input the invitation password. Once the password is accepted, they will see your desktop.
- error no magic cookie
- cannot connect to host