Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old June 10th, 2008   #1
qns8dn3
5 Cups of Ubuntu
 
Join Date: Mar 2008
Beans: 34
How to use rdesktop (Windows remote desktop connection)

rdesktop is a client program that allows you to connect from your Ubuntu computer to your Windows computer to remote control the Windows computer. In other words, while you are sitting in front of your Ubuntu computer at home, you can log into and access your Windows computer as if you are sitting in front of the Windows computer. See remote desktop software.

rdesktop and VNC and Terminal Server Client (comparison)
There is another similar program called VNC. VNC is slow compared to rdesktop and VNC connection is unencrypted while rdesktop connection is encrypted by default. But there is a way to use VNC with encrypted connection. VNC works on almost all operating systems. See comparison of remote desktop software.
Terminal Server Client (Applications > Internet > Terminal Server Client) is a GUI front-end to VNC and rdesktop. If you open Terminal Server Client, you will see Protocol option (RDP, RDPv5, VNC), RDP and RDPv5 are for rdesktop connection. You should use Terminal Server Client if it works fine and if you are ok with this bug. If you want more control (such as connecting a specific local folder or other device redirection, hiding or keeping window manager decoration, using seamlessRDP), use rdesktop following this guide.


What to do on the Windows side (the server side)

The Windows computer you will connect to must be running Windows XP Pro or a higher version of Windows.

* If you have a weak Windows login password (such as john1, aaaaaaaaaaaaa, abcabc), change it to a stronger password that is longer than 10 characters and that is not a combination of words that can be found on a dictionary. You need to do this because if you enable Remote Desktop Connection, anybody with internet access can try to log into your Windows computer with automated cracking tools.

* Enable Remote Desktop Connection on the Windows computer following this guide. If the Ubuntu computer you will be connecting from has a static ip address, you can set your Windows Firewall to allow remote desktop connection from only your Ubuntu computer and refuse connection from other computers. To do this, open Windows Firewall, click on the Exceptions tab, Select 'Remote Desktop', click 'Edit', click 'Change Scope...', choose 'Custom list' and enter the IP addresses of computers from which you want to remote connect (See the attached screenshot)

What to do on the Ubuntu side (client side)

* On your Ubuntu computer, open a terminal (Application > Accessories > Terminal) and enter the following command:
Code:
rdesktop
You'll see a long list of options for rdesktop. Think of it as an rdesktop cheatsheet.


If your windows username and Ubuntu username is the same and if the static IP address of your Windows computer is (suppose) 143.210.123.456, you can now connect to your Windows computer by entering the following command:
Code:
rdesktop 143.210.123.456
If the usernames are different and your Windows username is (suppose) john, enter:
Code:
rdesktop -u john 143.210.123.456
To disconnect, open Windows Start menu and click 'Disconnect'.

Most cases, you'll use one of the following two commands:
Code:
rdesktop -u john -fP 143.210.123.456
Code:
rdesktop -u john -g 100% -PKD 143.210.123.456
Both commands display remote desktop in full screen (corresponding option : -f, -g 100% -D) and bitmap cache is enabled for speed (-P). There is a bug and clipboard functionality (copy paste between remote desktop and local one) doesn't work in full screen mode. To make clipboard work, you need to escape full screen mode by pressing ctrl+alt+enter. ( Press ctrl+alt+enter again to get back to full screen mode. ) This bug only affects the first command and not the second command. So if you need to copy and paste between two desktops a lot, go with the second command. (Install dragking if you want to copy by selecting a text and paste by middle-click on your Windows desktop. dragking.ahk script requires ahkstructlib.ahk). The two commands also differs in how the keybindings are handled,

* First command : if you press alt+tab (keyboard shortcut for switching windows), it doesn't switch windows from Ubuntu desktop, it switches from the remote Windows desktop. And ctrl+alt+right (for switching to another workspace) doesn't work. This is useful when you want to alt+tab in the remote Windows.

* Second command : keyboard shortcuts such as ctrl+alt+right and alt+tab works on your Ubuntu desktop. This is useful because you can put the remote desktop on the seperate workspace then you can switch between your local ubuntu workspace and your remote Windows desktop just by pressing ctrl+alt+right and ctrl+alt+left.


Create a launcher

Opening terminal every time you want to remote connect to Windows is of a hassle. To create a lancher, right click on the top panel, click 'Add to Panel...', select 'Custom Application launcher', click 'Add' button, type your command in the command field. (See the attached screenshot). if the command contains %, replace % with %%.


useful rdesktop options

-r disk:doc=/home/john/Documents,pic=/home/john/Pictures
With this option, rdesktop connects folders /home/john/Documents and /home/john/Pictures to Windows remote desktop. Open Windows Start menu and click 'My Computer' and you will see the connected folders named doc and pic.

-r sound:local
This option is to hear sound from Windows remote desktop.

See /usr/share/doc/rdesktop/redirection.txt for more on device redirection.

-k ko
This sets the keyboard layout to Korean. This makes Hangul key work on the remote desktop. See /usr/share/doc/rdesktop/keymap-names.txt




How to use rdesktop over ssh

rdesktop is vulnerable to man-in-the-middle attacks. So you might want to use it over ssh.

Follow this lifehacker article to set up an ssh server on the Windows computer. (You can edit sshd_config with a Windows editor supporting UNIX texts such as notepad2) You might want to set Windows Firewall to disallow ssh access from IP addresses other than your Ubuntu computer's. Take note of the RSA key fingerprint by open a cygwin shell (Start > All Programs > Cygwin > Cygwin Bash Shell) and entering :
Code:
ssh-keygen -lf /etc/ssh_host_rsa_key.pub
On your Ubuntu computer, check if the local port 3389 (default listening port number for Windows Remote Desktop service) is available:
Code:
telnet localhost 3389
The output should be similar to :
Code:
$ telnet localhost 3389
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
, which means the port is available. If the port is already in use the output should be similar to :
Code:
$ telnet localhost 3389
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
If the port is available, connect to windows ssh service with port forward:
Code:
ssh -L 3389:localhost:3389 john@143.210.123.456
The port 3389 of your Ubuntu is forwarded to the port 3389 of your Windows. The output should be like :
Code:
$ ssh -L 3389:localhost:3389 john@143.210.123.456
The authenticity of host '143.210.123.456 (143.210.123.456)' can't be established.
RSA key fingerprint is f3:90:3b:70:20:a2:52:fe:fx:a2:90:70:3b:f3:6a:22.
Are you sure you want to continue connecting (yes/no)?
Check if the presented RSA key fingerprint is the same as the one you took note of. If they are different, you should answer no, the host you are connecting to is not your real Windows computer, it may be a man in the middle. If they are same, answer yes and proceed. You can get out of the ssh session by entering 'exit' but don't do it now.

Open another terminal and make rdesktop connect to localhost:
Code:
rdesktop -u john localhost
The remote desktop will be a bit slow. cygwin is slow.

What if the port 3389 was already in use? Find a different available port (suppose, 3099) and connect to Windows ssh like this :
Code:
ssh -L 3099:localhost:3389 john@143.210.123.456
The port 3099 of your Ubuntu is forwarded to the port 3389 of your Windows.

Open a new terminal and make rdesktop connect to localhost at the port 3099 :
Code:
rdesktop -u john localhost:3099
Attached Images
File Type: png Screenshot-launcher2.png (115.4 KB, 282 views)
File Type: png windows.firewall.pngagain.png (42.2 KB, 236 views)
qns8dn3 is offline   Reply With Quote
Old June 13th, 2008   #2
ForksHolder
A Carafe of Ubuntu
 
ForksHolder's Avatar
 
Join Date: Dec 2007
Beans: 103
Re: How to use rdesktop (Windows remote desktop connection)

AWESOME!!!!
You helped me ALOT man, Thanks
__________________
DO NOT USE RM COMMANDS!!! Click Here for more information.
Linux & Metal FTW
See ya at Ubuntu.
ForksHolder is offline   Reply With Quote
Old June 13th, 2008   #3
CostaRica
A Carafe of Ubuntu
 
CostaRica's Avatar
 
Join Date: Jul 2007
Location: Costa Rica
Beans: 87
Ubuntu 10.04 Lucid Lynx
Re: How to use rdesktop (Windows remote desktop connection)

Is there a way to remote desktop without a static-public IP? I use LogMeIn, but it does not work from Ubuntu...
__________________
Not-So-Obvious Favorites
www.djangoproject.com
www.untangle.com
CostaRica is offline   Reply With Quote
Old June 13th, 2008   #4
CostaRica
A Carafe of Ubuntu
 
CostaRica's Avatar
 
Join Date: Jul 2007
Location: Costa Rica
Beans: 87
Ubuntu 10.04 Lucid Lynx
Re: How to use rdesktop (Windows remote desktop connection)

I have 4 computers I need to do remote desktop to, but only 2 have static-public ips. My question is, - is there an app where one can make one of the static-public ips to be the "remote desktop server" of the rest, so that the other computers keep reporting the server in which ip they are? I suppose that is the way LogMeIn.com works.
__________________
Not-So-Obvious Favorites
www.djangoproject.com
www.untangle.com
CostaRica is offline   Reply With Quote
Old June 15th, 2008   #5
Roasted
I Ubuntu, Therefore, I Am
 
Join Date: Jul 2006
Beans: 3,446
Ubuntu 9.10 Karmic Koala
Re: How to use rdesktop (Windows remote desktop connection)

Is there any way you can do remote desktop without the end user's computer locking itself out?

I just tested it on my XP Pro laptop, and it locked my laptop and said it was in use. I'd like for the end user to still have visibility of what's going on.
Roasted is offline   Reply With Quote
Old June 18th, 2008   #6
qns8dn3
5 Cups of Ubuntu
 
Join Date: Mar 2008
Beans: 34
Re: How to use rdesktop (Windows remote desktop connection)

CostaRica
Using a dynamic dns service can be a workaround. See dynamic DNS service providers list

Roasted
have you tried "-0" (zero) option (attach to console)?
Code:
rdesktop -0 ipaddress
qns8dn3 is offline   Reply With Quote
Old June 19th, 2008   #7
moloch16
First Cup of Ubuntu
 
Join Date: Jun 2008
Beans: 6
Question Re: How to use rdesktop (Windows remote desktop connection)

Thanks for the tips. Has anyone been able to get sound to display on the local computer? I'm running Hardy connected to a remote Windows XP box. I'm using tsclient to setup the remote desktop. When I choose to hear sound from the remote machine on the local machine I get the attached error on the Windows box.
Attached Images
File Type: png NoSound.png (5.9 KB, 57 views)
moloch16 is offline   Reply With Quote
Old August 21st, 2008   #8
argail1980
Gee! These Aren't Roasted!
 
argail1980's Avatar
 
Join Date: May 2008
Location: Germany
Beans: 167
Re: How to use rdesktop (Windows remote desktop connection)

Hi there,

I am trying to connect from a ubuntu 8.10 system to a windows XP system but I always get "connection refused". I followed the recommendations of this thread, set a firewall exception for my IP and still it doesn't work. Any idea what else could it be?


UPDATE:
ignore that post... I simply forgot a checkbox.

Last edited by argail1980; August 21st, 2008 at 12:47 PM..
argail1980 is offline   Reply With Quote
Old September 10th, 2008   #9
clarknova
A Carafe of Ubuntu
 
clarknova's Avatar
 
Join Date: Feb 2005
Location: Fairview
Beans: 127
Kubuntu 9.10 Karmic Koala
Re: How to use rdesktop (Windows remote desktop connection)

Good tutorial, thanks.

ctrl-alt-enter doesn't get me out of full-screen mode. Well, it does for a fraction of a second, but then I'm right back into my windows desktop. Desktop switching doesn't appear to work for me either (ctrl-alt-direction arrow). Any ideas?

db
clarknova is offline   Reply With Quote
Old September 11th, 2008   #10
clarknova
A Carafe of Ubuntu
 
clarknova's Avatar
 
Join Date: Feb 2005
Location: Fairview
Beans: 127
Kubuntu 9.10 Karmic Koala
Re: How to use rdesktop (Windows remote desktop connection)

Quote:
Originally Posted by clarknova View Post
Good tutorial, thanks.

ctrl-alt-enter doesn't get me out of full-screen mode. Well, it does for a fraction of a second, but then I'm right back into my windows desktop. Desktop switching doesn't appear to work for me either (ctrl-alt-direction arrow). Any ideas?

db
Never mind. Amazing what a reboot will fix.

db
clarknova is offline   Reply With Quote

Bookmarks

Tags
rdesktop, remote connection, ssh

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:06 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry