Windows Applications in Linux with SeamlessRDP

There are several ways to run Windows applications under Linux. One of the most common ways is through wine, which redirects system calls to effectively emulate windows programs under Linux. Another popular solution is through virtualization products such as VMWare.  In this post, I will describe a method for virtualizing single applications rather than the entire operating system, so you only see the program you’re trying to run rather than the entire OS.

For this process, you will need the following:

  • A Linux host operating system (I used Ubuntu 7.04)
  • rdesktop 1.5 or newer
  • A virtualization product of some sort (I used VMWare Workstation 6)
  • A copy of Windows capable of running an RDP server (I used Windows Server 2003 Enterprise Edition)

I’m assuming you already have your copy of Linux up and running, so I’m not going to bother talking about that. I’m also going to assume that you already have rdesktop installed (it was installed by default on Ubuntu 7.04).

In this case, the first step is going to be to install VMWare. At the time of writing, you can download a free copy of the Release Candidate of VMWare Workstation 6 from VMWare’s webpage. Download the .tar.gz and be sure to copy down the serial number they give you, or you will not be able to use Workstation. Extract the archive you’ve downloaded and install VMWare normally.

After you get VMWare installed and running, the next step is to install Windows inside of a virtual machine. This process is relatively simple, and shouldn’t give you any problems. If you encounter any difficulty installing VMWare or Windows, look elsewhere for support, because that’s not what this guide is about.

Now, start up your virtual machine and log in as Administrator (you specified the password for this account during installation). The first step is to create a limited user account for yourself so you aren’t always running as Administrator. Bring up the Start Menu, then right click on My Computer and go to Manage. When the Computer Management window appears, expand the Local Users and Groups item in the left hand column. Then, right-click on Users and then select New User. The dialog that appears is pretty self explanatory. Enter a user name, actual name, and password. Then be sure to uncheck “User must change password at next logon” and then select “Password never expires.”

Now you need to enable Remote Desktop. From the Start Menu, right-click on My Computer and select Properties.

  • Switch to the “Remote” tab in the System Properties window
  • Check the option “Enable Remote Desktop on this computer”
  • Click on “Select Remote Users”
  • Click “Add”
  • Enter your username
  • Click “Check Names”
  • Click “OK”
  • Click “OK” again to close out of the dialog

Now, Remote Desktop should be enabled and your user should have the proper permission to use it. To test this, open a terminal in your Linux operating system and run the command:

rdesktop servername

Where servername is the IP address of your virtual machine. If all goes well, a window will appear allowing you to login with your username and password, and then give you access to a Windows desktop session. Go ahead and exit out of the remote session for now.

Now we need to install SeamlessRDP onto the virtual machine. Download the SeamlessRDP .zip file from the SeamlessRDP homepage. Extract the contents of that archive somewhere on your server. For the sake of this guide, I’m going to extract it to “C:seamlessrdp”. In Windows Explorer, right-click the newly created directory “C:seamlessrdp” and select Properties. Go to security, click Add, and add the group “Remote Desktop Users” and click OK.

Now, we need to test SeamlessRDP. Again, open a terminal in your Linux OS and run the following command:

rdesktop -A -s “C:seamlessrdpseamlessrdpshell.exe notepad” servername

Just like before, it will ask you for your username and password. However, instead of showing you a new Windows session, it will return only a Notepad window, which will act and behave similarly to your normal application windows. Now, rdesktop supports several commandline options to redirect things like soun, disks, and even clipboard use from the remote session. However, adding all of these flags everytime you want to run a Windows application is tedious, so I’ve created a better solution, which is to use a script.

Start by making a script directory that we’ll add to your path. Open a terminal and do that following:

EDIT 6/18/08: This section of the post originally instructed you to download a small shell script that I had written.  Due to my server having to be reformatted, the file no longer exists, but it can be recreated.  Look at the rdesktop command above and read the rdesktop man page and you should be able to get it working.  Feel free to post a comment if you need additional help.

Now, open the downloaded script in a text editor, and fill in a couple values. Add your username after “LOGIN=” and the address of the server after “SERVER=”. By default, the value of PASSWD is “-”, which will prompt you for your password when running the script. You can replace it with your actual password and it won’t prompt you, but if anyone has access to this text file, they’ll be able to get your password from it.

Now, make the script executable by running “chmod +x seamless”, and then open your ~/.bashrc file for editing. At the end of the file, append the line:

PATH=~/bin:$PATH

You’ll have to open a new terminal window to reload your bashrc file, but once you do, you’ll be able to use seamless as a normal command. To use it, simply run “seamless program” from a terminal.

This script will do the following things: It will connect to the server, start the specified program, then connect your home directory to that program (which can be accessed via My Computer), redirect clipboard use to your clipboard so that you can copy and paste from Linux to Windows programs and vice-versa, and also redirect sound to your Linux OS so that you can play sound in your Windows applications.

Test it out by trying to launch a couple of built-in Windows applications:

  • For Notepad:
    • seamless notepad
  • For Paint:
    • seamless mspaint
  • For Internet Explorer
    • seamless “C:Program FilesInternet Exploreriexplore.exe”
  • For Media Player:
    • seamless “C:Program FilesWindows Media Playerwmplayer.exe”
  • For Outlook Express:
    • seamless “C:Program FilesOutlook Expressmsimn.exe”

Now, here’s what’s nice about VMWare workstation 6, and one of the reasons I chose to use it. If you close the VMWare window with Windows still running, it will ask you what to do. One of the options is to run the virtual machine in the background and close the window. By doing this, VMWare will close to the tray, but leave Windows running, so that the seamless script will still work just fine.

And now, I’ll leave you with a few screenshots of the end result of this process: (Warning: Pictures are large)

NotepadMedia PlayerInternet ExplorerClipboard Screenshot

5 thoughts on “Windows Applications in Linux with SeamlessRDP

  1. Wow! I’ve been looking around the internet for a few of these guides, and yours is the best (I’ve seen the ubuntu.com and ubuntuforums.org ones). Especially the script… for a Linux noob like me, that’s like an act of God :)

  2. ya please provide a better link for the script

    i’d like to see the command line you’re using for vmware.

  3. Note: At the moment, the script is not up there, but you should be able to recreate it by reading the rdesktop and seamlessrdp documentation.

    Note also, that this feature is built into VMware 6.5, and they’ve done a much better job than my little hack.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>