公司有一台windows服务器,需要维护,但本人用的是的deepin系统(最好用的linux桌面操作系统)。
以前一直用的是remmina链接windows服务器,这个工具很万能,不止可以链接windows,还提供各种链接协议,也可以用ssh链接linux。但是链接效率不高,经常出现链接不上。
于是搜了一下,发现一个叫做rdesktop的工具,链接速度超快。记录一下怎么使用。
rdesktop介绍
rdesktop是linux下支持Windows远程桌面连接的客户端程序,在linux系统下可通过它远程访问Windows桌面,支持多种版本。rdesktop是sourceforge下支持GPL协议的一个开源项目,采用RDP(Remote Desktop Protocol,远程桌面协议),几乎可以连接windows的所有版本,诸如NT 4 Terminal Server, 2000, XP, 2003, 2003 R2, Vista, 2008, 7, and 2008 R2等。目前,rdesktop可运行于所有的基于X window平台的Unix系统中。
主页:http://www.rdesktop.org/
Github仓库:https://github.com/rdesktop/rdesktop
安装
- debian(Ubuntu)系统下执行:
$ sudo apt-get install rdesktop
- Centos/RedHat可以通过yum命令在线安装:
yum -y install rdesktop
- Archlinux使用pacman -S也可以安装。
使用
rdesktop -f 192.168.1.112 (这里的ip对应自己windows的ip地址)
这样你就链接到了windows服务器,输入你的用户名和密码就可以登录了。
-f参数默认全屏打开,使用Ctrl + Alt + Enter可以退出全屏模式。
如果你希望记住用户名和密码,控制链接窗口大小,共享剪切板,共享文件夹,都不是问题,只需要加几个参数就可以了,下面看下我的链接设置
rdesktop -a 16 -u 'shooke' -p '123456' -r sound:on/off -r clipboard:PRIMARYCLIPBOARD -g 1280x800 -r disk:shooke=/var/www 115.29.150.198
-a 支持色彩 16位
-u 用户名
-p 密码
-r sound:on/off 声音
-r clipboard:PRIMARYCLIPBOARD 共享剪切板,很实用哦
-g 1280x800 窗口分辨率
-r disk:shooke=/var/www 将本地磁盘映射到远程电脑,其中shooke为远程显示名称,可自定义,/var/www是本地linux的一个目录
快捷使用
为了方便,可以把链接命令存成一个shell脚步文件,每次链接的时候双击就可以使用了。存shell文件要加个声明像这样
#!/bin/sh
rdesktop -a 16 -u 'shooke' -p '123456' -r sound:on/off -r clipboard:PRIMARYCLIPBOARD -g 1280x800 -r disk:shooke=/var/www 115.29.150.198
把这段代码存成,desktop.sh,下次直接双击这个文件就可以了。
上面的参数基本够用,如果还想详细怎么做呢。打一下help就可以看到了
参数说明
$ rdesktop -h
rdesktop: A Remote Desktop Protocol client.
Version 1.8.3. Copyright (C) 1999-2011 Matthew Chapman et al.
See http://www.rdesktop.org/ for more information.
Usage: rdesktop [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':
alsa: ALSA output driver, default device: default
'-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard
redirection.
'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
更详细的资料看这里吧。http://www.jianshu.com/p/91fb0b1c6815,本文是根据这篇文章做了个小小的总结,删去了关于windows配置远程链接的部分。