Remote access to Windows XP from Linux

July 2008


We have a user who wants to access her Windows computer while sitting behind her Linux computer.

Procedure 32.  Enabling remote desktop on a Windows computer and accessing it from Linux.

  1. Gathering basic data

    1. Figuring out the IP number and/or FQDN of the Linux computer.

      Log in on the Linux computer, open a shell, and type hostname -f. The answer is the FQDN of the Linux computer. Write it down for later reference.

      Also type hostname -i. This is the IP number of the Linux computer. Write it down, too

    2. Figuring out the IP number and/or FQDN of the Windows computer

      Log in on the Windows computer, open a shell (click Start, Run..., type cmd, click Ok), and type ipconfig. The IP number of the Windows computer is now listed behind IP Address.... Write it down.

      To translate the IP number of the Windows computer to its FQDN, log in on the Linux computer, and type host ip-number-of-windows-machine, with ip-number-of-windows-machine replaced by the actual IP number you wrote down.

  2. Enabling the Remote Desktop service on the Windows computer.

    Start the Windows computer, log in, and do the following:

    1. Right-click the My Computer icon on the desktop, click Properties, and then click the Remote tab.

    2. Turn on Remote Desktop by selecting the check box Allow users to remotely connect to this computer.

    3. Designate users by clicking the Select Remote Users... button. (In my case, I didn't need to add any users, as the account I logged on with was already enabled.)

    4. Click Ok

  3. Actually starting the Remote Desktop service

    1. Log in on the Windows computer

    2. Right-click the My Computer icon, click services

    3. (Scroll down and) right-click Terminal Services, click properties.

    4. Set Startup type to automatic, and click the Start button.

    5. Click Ok.

  4. Allowing Remote Desktop connection through the Windows firewall

    Log in on the Windows computer and do the following:

    1. Click Start, Settings, Control Panel.

    2. Doubleclick the Windows Firewall icon, then the Exceptions tab.

    3. Select the Remote Desktop checkbox.

    4. Now click the Edit... button, then click Change scope....

    5. Choose the Custom list: option, and fill in the IP number of the Linux computer.

    6. Click Ok thrice.

  5. Preparing the Windows computer for remote use

    Leave the Windows computer running, but do log off.

  6. Connecting to the Windows machine from Linux

    1. Have your systems administrator install the rdesktop program for you.

    2. Log in on the Linux computer and start a shell.

    3. Type rdesktop -g 1024x786 ip-number-of-windows-computer, with ip-number-of-windows-computer replaced by the actual IP number of the Windows computer you wrote down. The -g 1024x786 sets the resolution rdesktop shows Windows in. You may want to fiddle with it a bit.

    4. Log in and use your Windows PC from behind your Linux PC.

[Warning]Warning

It appears that Windows on some machines will not serve rdesktop without trouble, stating that rdpdd.dll failed to load in the Event Viewer.

[Note]Note

There exists a nice description of how to tunnel rdesktop through ssh.

[Note]Note

There is also a description of remotely executing scripts. It amounts to this:


rdesktop 10.0.3.15 -P -a 16 -g 1280x1024 -u username  -p VerySecretPassword -r disk:home=/home/username/ -s 'c:\WINNT\cmd.exe'
      

[Warning]Warning

If you still have another session active on the target computer, the -s option will not be honoured, and you will be dropped into that session instead. This may not apply if you have a real terminal server (with multiple desktops) instead of a single-session Windows box.

[Warning]Warning

As an aside to the above note, be aware that if you run one application. e.g. notepad remotely, and then terminate the X windows in which the rdesktop resided, the next time you run rdesktop with the -s option to start another application (say, cmd.exe), you will get the first application, i.e. notepad instead of the one you specified! This will not occur if you finish the first application from within, i.e. by clicking file-<exit and let Windows/rdesktop do the cleanup.