<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hello World &#187; RDP</title>
	<atom:link href="http://blog.sunner.cn/tag/rdp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sunner.cn</link>
	<description>孙志岗的博客</description>
	<lastBuildDate>Fri, 03 Feb 2012 03:13:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>kvm、spice安装Windows 7备忘录</title>
		<link>http://blog.sunner.cn/kvm-spice-windows-7-notes/</link>
		<comments>http://blog.sunner.cn/kvm-spice-windows-7-notes/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 01:38:34 +0000</pubDate>
		<dc:creator>Sunner</dc:creator>
				<category><![CDATA[NULL]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[RDP]]></category>
		<category><![CDATA[spice]]></category>
		<category><![CDATA[虚拟机]]></category>

		<guid isPermaLink="false">http://blog.sunner.cn/?p=1140</guid>
		<description><![CDATA[去年在一台备用服务器上装了个VirtualBox虚拟机，用headless模式跑Windows 7，当做我的日常用系统，无论在哪都用RDP（Windows的远程桌面协议）远程登上，彻底的大内存、多CPU、千兆接入云桌面，非常舒服。 VirtualBox是个很棒的虚拟机，无论图形界面还是命令行界面，都很好用。但间或死机（虚拟机停转，却把CPU占满），分越多的CPU速度越慢（可能是我后分的多CPU有关），以及虚拟磁盘配置不合理这三个原因，使我萌生了换虚拟机的念头。 这篇评测文章的结果是kvm的性能最好，此外听安天的王维工程师说只有kvm支持的spice协议是目前最快的远程桌面协议，有代码洁癖的我就当然选用它了。但这东西，比VirtualBox和VMWare都难配置太多了……必须得写下来备忘一些要点了。 kvm kvm本身是个命令行程序，直接“kvm 参数”就能用。一开始就这么用，系统安装顺利，网络通畅。然后加bridged模式的网卡，结果一启动虚拟机就让主机网卡都断掉（甚至一度重启host系统都不能恢复，导致网络中心狠狠地重新收拾了一遍若干台交换机。对此麻烦，深表歉意）。查了无数资料，什么bridge、tun、tap的一通研究，各种脚本、手工试验，全无效。最后实在不想再跑机房了，就换用virt-manager建虚拟机。 virt-manager是libvirt的一个图形客户端，而libvirt是个通用的虚拟机管理库（支持kvm、xen、virtualbox、vmware等等）。virsh是libvirt的命令行客户端，用“virsh -c qemu:///system”可以在命令行管理virt-manager创建的虚拟机。 需要先在系统启动一个桥接网卡，才能在虚拟机里装bridged网卡。修改/etc/network/interfaces（debian）如下： Windows 7最多只支持两个CPU socket，每个socket内可以有多个core。kvm缺省每个CPU模拟一个socket，必须修改虚拟机CPU的topology，才能使用超过一个CPU。 spice virt-manager创建的虚拟机只要加了spice display，就可以用spice协议远程使用虚拟机的控制台。 Linux下的spice客户端叫spicec。 最重要的是Win7里必须安装spice的驱动和服务，才能让性能和功能达到最强。相关程序在这里下载：http://www.spice-space.org/download.html qxl和virtio-serial驱动是必须安装的。如果安装时提示数字签名无效，驱动不生效，用管理员权限执行cmd.exe，运行下面两行命令并reboot（reboot后桌面会有“测试模式”字样，不影响使用）： Windows guest agent服务也必须安装，才能同步剪贴板、屏幕分辨率。解开那个vdagent-xxxxx.zip，在管理员权限命令行执行“vdservice install”，然后reboot。 客户端加上&#8211;full-screen=auto-conf参数，就能全屏且同步分辨率了。Shift-F11切换全屏状态 spice性能确实比rdp好太多，看flash、gif基本不卡，视频音画基本同步，鼠标、键盘无延迟。最爽的，可以用招商银行大众版了！ 安全的spice spice缺省使用不安全连接。 用下面脚本创建必须的key 根据提示记住&#8211;host-subject，拷贝ca-cert.pem到指定位置 关闭虚拟机，重新启动libvirtd（sudo /etc/init.d/libvirt-bin restart） 客户端用“spicec -h HOSTNAME -s TLS-PORT &#8211;host-subject HOST-SUBJECT -w PASSWORD”连接 其它 虚拟机硬件配置很容易调整，导致Windows激活经常失效。在线激活失败时，选电话激活，根据提示打电话，跟客服mm稍加解释，就能顺利激活了。（此条只对正版Windows有效） 主要参考 SSLConnection &#8211; Spice QA:Testcase Virtualization Manually set spice listening port [...]]]></description>
			<content:encoded><![CDATA[<p>去年在一台备用服务器上装了个VirtualBox虚拟机，用headless模式跑Windows 7，当做我的日常用系统，无论在哪都用RDP（Windows的远程桌面协议）远程登上，彻底的大内存、多CPU、千兆接入云桌面，非常舒服。</p>
<p>VirtualBox是个很棒的虚拟机，无论图形界面还是命令行界面，都很好用。但间或死机（虚拟机停转，却把CPU占满），分越多的CPU速度越慢（可能是我后分的多CPU有关），以及虚拟磁盘配置不合理这三个原因，使我萌生了换虚拟机的念头。</p>
<p>这篇<a href="http://www.phoronix.com/scan.php?page=article&amp;item=ubuntu_1110_xenkvm&amp;num=1">评测文章</a>的结果是kvm的性能最好，此外听安天的王维工程师说只有kvm支持的spice协议是目前最快的远程桌面协议，有代码洁癖的我就当然选用它了。但这东西，比VirtualBox和VMWare都难配置太多了……必须得写下来备忘一些要点了。</p>
<h2>kvm</h2>
<p>kvm本身是个命令行程序，直接“kvm 参数”就能用。一开始就这么用，系统安装顺利，网络通畅。然后加bridged模式的网卡，结果一启动虚拟机就让主机网卡都断掉（甚至一度重启host系统都不能恢复，导致网络中心狠狠地重新收拾了一遍若干台交换机。对此麻烦，深表歉意）。查了无数资料，什么bridge、tun、tap的一通研究，各种脚本、手工试验，全无效。最后实在不想再跑机房了，就换用virt-manager建虚拟机。</p>
<p>virt-manager是libvirt的一个图形客户端，而libvirt是个通用的虚拟机管理库（支持kvm、xen、virtualbox、vmware等等）。virsh是libvirt的命令行客户端，用“virsh -c qemu:///system”可以在命令行管理virt-manager创建的虚拟机。</p>
<p>需要先在系统启动一个桥接网卡，才能在虚拟机里装bridged网卡。修改/etc/network/interfaces（debian）如下：</p>
<div id="gist-1654859" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c"># Replace &quot;auto eth0 ...&quot; with following lines in /etc/network/interfaces</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="c"># The primary network interface</span></div><div class='line' id='LC4'>auto br0</div><div class='line' id='LC5'>iface br0 inet static</div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;address xxx.xxx.xxx.xxx</div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;netmask xxx.xxx.xxx.xxx</div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;network xxx.xxx.xxx.xxx</div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;broadcast xxx.xxx.xxx.xxx</div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gateway xxx.xxx.xxx.xxx</div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># dns-* options are implemented by the resolvconf package, if installed</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dns-nameservers xxx.xxx.xxx.xxx</div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dns-search domain.name</div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bridge_ports    eth0</div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bridge_stp      off</div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bridge_maxwait  0</div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bridge_fd       0</div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1654859/ea31c7e923ff6077f88b68ed49ffa5741e2ec707/gistfile1.sh" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1654859#file_gistfile1.sh" style="float:right;margin-right:10px;color:#666">gistfile1.sh</a>
            <a href="https://gist.github.com/1654859">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Windows 7最多只支持两个CPU socket，每个socket内可以有多个core。kvm缺省每个CPU模拟一个socket，必须修改虚拟机CPU的topology，才能使用超过一个CPU。</p>
<h2>spice</h2>
<p>virt-manager创建的虚拟机只要加了spice display，就可以用spice协议远程使用虚拟机的控制台。</p>
<p>Linux下的spice客户端叫spicec。</p>
<p>最重要的是Win7里必须安装spice的驱动和服务，才能让性能和功能达到最强。相关程序在这里下载：<a href="http://www.spice-space.org/download.html">http://www.spice-space.org/download.html</a></p>
<p>qxl和virtio-serial驱动是必须安装的。如果安装时提示数字签名无效，驱动不生效，用管理员权限执行cmd.exe，运行下面两行命令并reboot（reboot后桌面会有“测试模式”字样，不影响使用）：</p>
<div id="gist-1654912" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>bcdedit.exe -<span class="k">set</span> <span class="nv">loadoptions</span> DDISABLE_INTEGRITY_CHECKS</div><div class='line' id='LC2'>bcdedit.exe -<span class="k">set</span> <span class="nv">TESTSIGNING</span> <span class="k">ON</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1654912/52ab477ed7ba8ba501409c1fc5523d57eb6d6950/allow_test_sign.bat" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1654912#file_allow_test_sign.bat" style="float:right;margin-right:10px;color:#666">allow_test_sign.bat</a>
            <a href="https://gist.github.com/1654912">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Windows guest agent服务也必须安装，才能同步剪贴板、屏幕分辨率。解开那个vdagent-xxxxx.zip，在管理员权限命令行执行“vdservice install”，然后reboot。</p>
<p>客户端加上&#8211;full-screen=auto-conf参数，就能全屏且同步分辨率了。Shift-F11切换全屏状态</p>
<p>spice性能确实比rdp好太多，看flash、gif基本不卡，视频音画基本同步，鼠标、键盘无延迟。最爽的，可以用招商银行大众版了！</p>
<h2>安全的spice</h2>
<p>spice缺省使用不安全连接。</p>
<p>用下面脚本创建必须的key</p>
<div id="gist-1655511" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/bin/bash</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="nv">SERVER_KEY</span><span class="o">=</span>server-key.pem</div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="c"># creating a key for our ca</span></div><div class='line' id='LC6'><span class="k">if</span> <span class="o">[</span> ! -e ca-key.pem <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC7'><span class="k"> </span>openssl genrsa -des3 -out ca-key.pem 1024</div><div class='line' id='LC8'><span class="k">fi</span></div><div class='line' id='LC9'><span class="c"># creating a ca</span></div><div class='line' id='LC10'><span class="k">if</span> <span class="o">[</span> ! -e ca-cert.pem <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC11'><span class="k"> </span>openssl req -new -x509 -days 1095 -key ca-key.pem -out ca-cert.pem  -subj <span class="s2">&quot;/C=IL/L=Raanana/O=Red Hat/CN=my CA&quot;</span></div><div class='line' id='LC12'><span class="k">fi</span></div><div class='line' id='LC13'><span class="c"># create server key</span></div><div class='line' id='LC14'><span class="k">if</span> <span class="o">[</span> ! -e <span class="nv">$SERVER_KEY</span> <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC15'><span class="k"> </span>openssl genrsa -out <span class="nv">$SERVER_KEY</span> 1024</div><div class='line' id='LC16'><span class="k">fi</span></div><div class='line' id='LC17'><span class="c"># create a certificate signing request (csr)</span></div><div class='line' id='LC18'><span class="k">if</span> <span class="o">[</span> ! -e server-key.csr <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC19'><span class="k"> </span>openssl req -new -key <span class="nv">$SERVER_KEY</span> -out server-key.csr -subj <span class="s2">&quot;/C=IL/L=Raanana/O=Red Hat/CN=my server&quot;</span></div><div class='line' id='LC20'><span class="k">fi</span></div><div class='line' id='LC21'><span class="c"># signing our server certificate with this ca</span></div><div class='line' id='LC22'><span class="k">if</span> <span class="o">[</span> ! -e server-cert.pem <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC23'><span class="k"> </span>openssl x509 -req -days 1095 -in server-key.csr -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem</div><div class='line' id='LC24'><span class="k">fi</span></div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'><span class="c"># now create a key that doesn&#39;t require a passphrase</span></div><div class='line' id='LC27'>openssl rsa -in <span class="nv">$SERVER_KEY</span> -out <span class="nv">$SERVER_KEY</span>.insecure</div><div class='line' id='LC28'>mv <span class="nv">$SERVER_KEY</span> <span class="nv">$SERVER_KEY</span>.secure</div><div class='line' id='LC29'>mv <span class="nv">$SERVER_KEY</span>.insecure <span class="nv">$SERVER_KEY</span></div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'><span class="c"># show the results (no other effect)</span></div><div class='line' id='LC32'>openssl rsa -noout -text -in <span class="nv">$SERVER_KEY</span></div><div class='line' id='LC33'>openssl rsa -noout -text -in ca-key.pem</div><div class='line' id='LC34'>openssl req -noout -text -in server-key.csr</div><div class='line' id='LC35'>openssl x509 -noout -text -in server-cert.pem</div><div class='line' id='LC36'>openssl x509 -noout -text -in ca-cert.pem</div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'><span class="c"># copy *.pem file to /etc/pki/libvirt-spice</span></div><div class='line' id='LC39'><span class="k">if</span> <span class="o">[[</span> ! -d <span class="s2">&quot;/etc/pki/libvirt-spice&quot;</span> <span class="o">]]</span> </div><div class='line' id='LC40'><span class="k">then</span></div><div class='line' id='LC41'><span class="k"> </span>mkdir -p /etc/pki/libvirt-spice</div><div class='line' id='LC42'><span class="k">fi</span></div><div class='line' id='LC43'>cp ./*.pem /etc/pki/libvirt-spice</div><div class='line' id='LC44'><br/></div><div class='line' id='LC45'><span class="c"># echo --host-subject</span></div><div class='line' id='LC46'><span class="nb">echo</span> <span class="s2">&quot;your --host-subject is&quot;</span> <span class="se">\&quot;</span><span class="sb">`</span>openssl x509 -noout -text -in server-cert.pem | grep Subject: | cut -f 10- -d <span class="s2">&quot; &quot;</span><span class="sb">`</span><span class="se">\&quot;</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'><span class="nb">echo</span> <span class="s2">&quot;copy ca-cert.pem to %APPDATA%\spicec\spice_truststore.pem or ~/.spice/spice_truststore.pem in your clients&quot;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1655511/ff270c5ef93eb4235ac31e0f8393593db162e4aa/keygen.sh" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1655511#file_keygen.sh" style="float:right;margin-right:10px;color:#666">keygen.sh</a>
            <a href="https://gist.github.com/1655511">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>根据提示记住&#8211;host-subject，拷贝ca-cert.pem到指定位置</p>
<p>关闭虚拟机，重新启动libvirtd（sudo /etc/init.d/libvirt-bin restart）</p>
<p>客户端用“spicec -h HOSTNAME -s TLS-PORT &#8211;host-subject HOST-SUBJECT -w PASSWORD”连接</p>
<h2>其它</h2>
<p>虚拟机硬件配置很容易调整，导致Windows激活经常失效。在线激活失败时，选电话激活，根据提示打电话，跟客服mm稍加解释，就能顺利激活了。（此条只对正版Windows有效）</p>
<h2>主要参考</h2>
<ol>
<li><a href="http://spice-space.org/page/SSLConnection">SSLConnection &#8211; Spice</a></li>
<li><a href="http://fedoraproject.org/wiki/QA:Testcase_Virtualization_Manually_set_spice_listening_port_with_TLS_port_set">QA:Testcase Virtualization Manually set spice listening port with TLS port set</a></li>
<li><a href="http://spice-space.org/page/WinQXL">WinQXL &#8211; Spice</a></li>
<li><a href="http://www.linux-kvm.org/page/Networking">Networking &#8211; KVM</a></li>
<li>manpages</li>
</ol>
<p>（待补充：port forward）</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sunner.cn/kvm-spice-windows-7-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用rdesktop映射本地打印机到远程的要点</title>
		<link>http://blog.sunner.cn/map-local-printer-to-remote-through-rdesktop/</link>
		<comments>http://blog.sunner.cn/map-local-printer-to-remote-through-rdesktop/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 05:19:02 +0000</pubDate>
		<dc:creator>Sunner</dc:creator>
				<category><![CDATA[NULL]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[RDP]]></category>

		<guid isPermaLink="false">http://blog.sunner.cn/?p=875</guid>
		<description><![CDATA[Linux端： rdesktop一定要用“-5”参数。只有RDP5才支持打印机映射 rdesktop映射打印机的参数“-r printer:hp-LaserJet-1010=”HP 1010&#8243;”。其中hp-LaserJet-1010必须是Linux上安装的打印机的名字。”HP 1010&#8243;可随便起名，貌似是远程Windows看到的打印机名 Windows端： 貌似不会自动搜索到这个打印机，需要手工添加 添加打印机-&#62;添加本地打印机，在端口中找TS00x这样名的，后面括号里跟着你的Linux主机名和PRN1，然后下一步，选驱动就行了。 rdesktop的代码库最近很长时间一直在更新，但是始终没有发布新版本。可气的是作者把代码树里的Makefile删了，想自己编译一个尝鲜都不能。热烈盼望beta啊！]]></description>
			<content:encoded><![CDATA[<p>Linux端：</p>
<ol>
<li>rdesktop一定要用“-5”参数。只有RDP5才支持打印机映射</li>
<li>rdesktop映射打印机的参数“-r printer:hp-LaserJet-1010=”HP 1010&#8243;”。其中hp-LaserJet-1010必须是Linux上安装的打印机的名字。”HP 1010&#8243;可随便起名，貌似是远程Windows看到的打印机名</li>
</ol>
<p>Windows端：</p>
<ol>
<li>貌似不会自动搜索到这个打印机，需要手工添加</li>
<li>添加打印机-&gt;添加本地打印机，在端口中找TS00x这样名的，后面括号里跟着你的Linux主机名和PRN1，然后下一步，选驱动就行了。</li>
</ol>
<p>rdesktop的代码库最近很长时间一直在更新，但是始终没有发布新版本。可气的是作者把代码树里的Makefile删了，想自己编译一个尝鲜都不能。热烈盼望beta啊！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sunner.cn/map-local-printer-to-remote-through-rdesktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让远程桌面（RDP）始终保持连接</title>
		<link>http://blog.sunner.cn/keep_rdp_session_alive/</link>
		<comments>http://blog.sunner.cn/keep_rdp_session_alive/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 08:50:35 +0000</pubDate>
		<dc:creator>Sunner</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[RDP]]></category>

		<guid isPermaLink="false">http://blog.sunner.cn/?p=274</guid>
		<description><![CDATA[RDP对我来说实在太重要了，但最近不知道是校园网还是电信网路由做调整，自动断开一段时间没有活动的连接，导致我切换回本地工作一会儿，再回到远程的时候，就得重新连接，非常麻烦。下面方法可以让连接一直保持着： 运行gpedit.msc，依次进入Computer Configuration -&#62; Administrative Templates -&#62; Windows Components -&#62; Terminal Services -&#62; Terminal Server -&#62; Connections -&#62; Configure keep-alive connection interval，将其Enabled，并设置interval到一个合理的值（单位：分钟）。我设置的1。]]></description>
			<content:encoded><![CDATA[<p>RDP对我来说实在太重要了，但最近不知道是校园网还是电信网路由做调整，自动断开一段时间没有活动的连接，导致我切换回本地工作一会儿，再回到远程的时候，就得重新连接，非常麻烦。下面方法可以让连接一直保持着：</p>
<p>运行gpedit.msc，依次进入Computer Configuration -&gt; Administrative Templates -&gt; Windows Components -&gt; Terminal Services -&gt; Terminal Server -&gt; Connections -&gt; Configure keep-alive connection interval，将其Enabled，并设置interval到一个合理的值（单位：分钟）。我设置的1。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sunner.cn/keep_rdp_session_alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rdesktop Patch: Switch Local Workspaces and Windows by Local Hot Keys</title>
		<link>http://blog.sunner.cn/rdesktop-patch-switch-local-workspaces-and-windows-by-local-hot-keys/</link>
		<comments>http://blog.sunner.cn/rdesktop-patch-switch-local-workspaces-and-windows-by-local-hot-keys/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 02:35:32 +0000</pubDate>
		<dc:creator>Sunner</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[RDP]]></category>

		<guid isPermaLink="false">http://blog.sunner.cn/?p=240</guid>
		<description><![CDATA[rdesktop is a powerful RDP client for Linux. The inability of switch applications between remote side and local side by hot key makes it a little uncomfortable. Look around the internet, you can find many requests for the feature but no solutions. So I made the patch. It do things like: Double press Ctrl+Alt+Left or [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rdesktop.org" target="_blank">rdesktop</a> is a powerful RDP client for Linux. The inability of switch applications between remote side and local side by hot key makes it a little uncomfortable. Look around the internet, you can find many requests for the feature but no solutions. So I made the patch. It do things like:</p>
<ul>
<li>Double press Ctrl+Alt+Left or Ctrl+Alt+Right to switch local active workspaces.</li>
<li>Double press Ctrl+Alt+Tab to switch local active window.</li>
<li>Other hot keys are sent directly to remote machine.</li>
<li>If using -fD options and having two or above workspaces, the effect is amazing!</li>
<li>If rdesktop is running in fullscreen mode (-f and without -D), Ctrl+Alt+Left/Right/Tab will toggle it to window mode first. After switching back, it can NOT toggle to fullscreen automatically. Press Ctrl+Alt+Enter to do that. (I know this is boring. But it is the best I can do. Rdesktop use override_redirect to implement fullscreen which makes it always the top-most window no matter which workspace/window you have switched to)</li>
</ul>
<p>Download and unpack <a href="http://blog.sunner.cn/wp-content/uploads/2009/10/rdesktop.tgz">rdesktop.tgz</a> to get a patched executable file: rdesktop. Overwrite /usr/bin/rdesktop with it. That&#8217;s all. The file was compiled with all debian/ubuntu official patches and tested in Ubuntu 9.10 (Karmic). It should work in other Linux distribution too. If it does or does not work in your environment, please leave a comment to report.</p>
<p><a href="http://blog.sunner.cn/wp-content/uploads/2009/10/switch_local_workspace_and_window.patch">switch_local_workspace_and_window.patch</a> is the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sunner.cn/rdesktop-patch-switch-local-workspaces-and-windows-by-local-hot-keys/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>rdesktop忽略Ctrl+Alt+Left/Right的补丁</title>
		<link>http://blog.sunner.cn/rdesktop_ctrl_alt_left_right_patch/</link>
		<comments>http://blog.sunner.cn/rdesktop_ctrl_alt_left_right_patch/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 06:26:04 +0000</pubDate>
		<dc:creator>Sunner</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[RDP]]></category>

		<guid isPermaLink="false">http://blog.sunner.cn/?p=232</guid>
		<description><![CDATA[此贴已老，请移步rdesktop Patch: Switch Local Workspaces and Windows by Local Hot Keys 经常本地运行Linux，用rdesktop连接远程的Windows主机，两边配合工作。如果能通过快捷键切换两个桌面环境，会很方便。但rdesktop窗口会吸走所有的按键，发给远程桌面，包括Window Manager管理的热键。加上“-K”参数，远端就收不到很多热键了，比如最常用的Alt+Tab。在网上搜了一下，很多人都为此困扰，但没有任何解决办法。可能大牛们都只用纯用*nix，根本无视rdesktop的存在吧。于是，我就自己做了这个补丁，实现了下面的效果： Linux桌面上要有至少两个Workspace，一个运行rdesktop，其余的本地用 在rdesktop中，连按两次及以上的Ctrl+Alt+Left/Right，可以切换Workspace，也就是虚拟桌面 建议启动rdesktop的时候，不加“-K”参数 如果用全屏方式（-f）启动rdesktop，切换Workspace的时候，rdesktop会跟着走，达不到想要的效果。这和rdesktop用override_redirect方式实现全屏窗口有关。我不知道该怎么解决。如果有了解的朋友，请不吝赐教。我现在是用“-D”参数隐藏rdesktop窗口的外框，用“-g”设一个足够大的窗口，刚好上顶上面的panel，下踩下面的panel。 rdesktop_1.6.0-2ubuntu99_i386.deb是我在Ubuntu karmic上编译好的安装文件，估计Debian上也能用。用“sudo dpkg -i rdesktop_1.6.0_2ubuntu99_i386.deb”安装。其它平台可以下载rdesktop源代码，打上99_switch_desktop_support.dpatch补丁，自己编译试试，估计应该都能好用。]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">此贴已老，请移步<a title="Permanent Link to rdesktop Patch: Switch Local Workspaces and Windows by Local Hot Keys" rel="bookmark" href="/2009/10/rdesktop-patch-switch-local-workspaces-and-windows-by-local-hot-keys/">rdesktop Patch: Switch Local Workspaces and Windows by Local Hot Keys</a></span></p>
<p>经常本地运行Linux，用rdesktop连接远程的Windows主机，两边配合工作。如果能通过快捷键切换两个桌面环境，会很方便。但rdesktop窗口会吸走所有的按键，发给远程桌面，包括Window Manager管理的热键。加上“-K”参数，远端就收不到很多热键了，比如最常用的Alt+Tab。在网上搜了一下，很多人都为此困扰，但没有任何解决办法。可能大牛们都只用纯用*nix，根本无视rdesktop的存在吧。于是，我就自己做了这个补丁，实现了下面的效果：</p>
<ul>
<li>Linux桌面上要有至少两个Workspace，一个运行rdesktop，其余的本地用</li>
<li>在rdesktop中，连按两次及以上的Ctrl+Alt+Left/Right，可以切换Workspace，也就是虚拟桌面</li>
<li>建议启动rdesktop的时候，不加“-K”参数</li>
<li>如果用全屏方式（-f）启动rdesktop，切换Workspace的时候，rdesktop会跟着走，达不到想要的效果。这和rdesktop用override_redirect方式实现全屏窗口有关。我不知道该怎么解决。如果有了解的朋友，请不吝赐教。我现在是用“-D”参数隐藏rdesktop窗口的外框，用“-g”设一个足够大的窗口，刚好上顶上面的panel，下踩下面的panel。</li>
</ul>
<p><a href="http://blog.sunner.cn/wp-content/uploads/2009/10/rdesktop_1.6.0-2ubuntu99_i386.deb">rdesktop_1.6.0-2ubuntu99_i386.deb</a>是我在Ubuntu karmic上编译好的安装文件，估计Debian上也能用。用“sudo dpkg -i rdesktop_1.6.0_2ubuntu99_i386.deb”安装。其它平台可以下载rdesktop源代码，打上<a href="http://blog.sunner.cn/wp-content/uploads/2009/10/99_switch_desktop_support.dpatch">99_switch_desktop_support.dpatch</a>补丁，自己编译试试，估计应该都能好用。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sunner.cn/rdesktop_ctrl_alt_left_right_patch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

