Rdesktop Gnome RDP Mapped Drives

From SifWiki
Revision as of 19:43, 28 October 2013 by Siftah (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


If you regularly have to administer or work on remote Windows machines, then firstly, my sincerest condolences to you. But more seriously one of the things I always find lacking is the lack of an easy way to map a shared drive from the majority of the graphical clients available on the Linux desktop.

Even GNOME 3 and the updated "Gnome RDP" app doesn't seem to have a way to do this - it seems like a massive oversight!

I Googled for an alternative and didn't find one, eventually I settled on this hack.


The Gnome RDP binary actually calls rdesktop in the background. The rdesktop binary itself contains lots more options than are exposed in the Gnome RDP front-end.

So the idea here is just to wrap the call to the binary so we can inject some additional command line options into it, you can use this method for any of the additional options provided by rdesktop, for example;

[root@jblaptop bin]# rdesktop
rdesktop: A Remote Desktop Protocol client.
Version 1.8.0. Copyright (C) 1999-2011 Matthew Chapman et al.
See http://www.rdesktop.org/ for more information.

Usage: /usr/bin/rdesktop_orig [options] server[:port]
   -u: user name
   -d: domain
   -s: shell / seamless application to start remotly
   -c: working directory
   -p: password (- to prompt)
   -n: client hostname
   -k: keyboard layout on server (en-us, de, sv, etc.)
   -g: desktop geometry (WxH)
   -i: enables smartcard authentication, password is used as pin
   -f: full-screen mode
   -b: force bitmap updates
   -L: local codepage
   -A: path to SeamlessRDP shell, this enables SeamlessRDP mode
   -B: use BackingStore of X-server (if available)
   -e: disable encryption (French TS)
   -E: disable encryption from client to server
   -m: do not send motion events
   -C: use private colour map
   -D: hide window manager decorations
   -K: keep window manager key bindings
   -S: caption button size (single application mode)
   -T: window title
   -t: disable use of remote ctrl
   -N: enable numlock syncronization
   -X: embed into another window with a given id.
   -a: connection colour depth
   -z: enable rdp compression
   -x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex nr.)
   -P: use persistent bitmap caching
   -r: enable specified device redirection (this flag can be repeated)
         '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1
             or      COM1=/dev/ttyS0,COM2=/dev/ttyS1
         '-r disk:floppy=/mnt/floppy': enable redirection of /mnt/floppy to 'floppy' share
             or   'floppy=/mnt/floppy,cdrom=/mnt/cdrom'
         '-r clientname=<client name>': Set the client name displayed
             for redirected disks
         '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1
             or      LPT1=/dev/lp0,LPT2=/dev/lp1
         '-r printer:mydeskjet': enable printer redirection
             or      mydeskjet="HP LaserJet IIIP" to enter server driver as well
         '-r sound:[local[:driver[:device]]|off|remote]': enable sound redirection
                     remote would leave sound on server
                     available drivers for 'local':
                     libao:     libao output driver, default device: system dependent
         '-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard
                      'PRIMARYCLIPBOARD' looks at both PRIMARY and CLIPBOARD
                      when sending data to server.
                      'CLIPBOARD' looks at only CLIPBOARD.
         '-r scard[:"Scard Name"="Alias Name[;Vendor Name]"[,...]]
          example: -r scard:"eToken PRO 00 00"="AKS ifdh 0"
                   "eToken PRO 00 00" -> Device in Linux/Unix enviroment
                   "AKS ifdh 0"       -> Device shown in Windows enviroment 
          example: -r scard:"eToken PRO 00 00"="AKS ifdh 0;AKS"
                   "eToken PRO 00 00" -> Device in Linux/Unix enviroment
                   "AKS ifdh 0"       -> Device shown in Windows enviroment 
                   "AKS"              -> Device vendor name                 
   -0: attach to console
   -4: use RDP version 4
   -5: use RDP version 5 (default)
   -o: name=value: Adds an additional option to rdesktop.
           sc-csp-name        Specifies the Crypto Service Provider name which
                              is used to authenticate the user by smartcard
           sc-container-name  Specifies the container name, this is usally the username
           sc-reader-name     Smartcard reader name to use
           sc-card-name       Specifies the card name of the smartcard to use

So the one we're interested in here is the `-r disk:` option, we need to wrap the binary and add this in. There's a major security implication to bear in mind here;

This is going to happen for every single session as we're hardcoding this option. Therefore I'd suggest you make this a seperate directory, rather than sharing something like your /home directory which could potentially expose lots more data to the remote host than is safe or necessary. I use a 'Share' directory which I just treat like a /tmp dir and clear out copied files once moved.

Step by Step

1) Move the original rdesktop binary to a new filename as the Gnome RDP binary is hardcoded to call `/usr/bin/rdesktop`

sudo cp /usr/bin/rdesktop /usr/bin/rdesktop_orig

2) Create your wrapper script as follows, substituting your own share into it;

[root@jblaptop bin]# cat rdesktop
/usr/bin/rdesktop_orig -r disk:Share=$HOME/Share $@

3) Ensure that your share exists;

mkdir $HOME/Share

4) Set the perms on the script;

chmod +x /usr/bin/rdesktop

And at this point you should be able to use Gnome RDP as normal, fire up an RDP session and access the mapped drive as a local drive.

Personal tools

Google AdSense