﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Skynet-随笔分类-系统</title><link>http://www.blogjava.net/Skynet/category/39536.html</link><description>十一长假 整理 www.blogjava.net/Good-Game 中
打搬家了 
;)</description><language>zh-cn</language><lastBuildDate>Thu, 29 Oct 2009 01:39:17 GMT</lastBuildDate><pubDate>Thu, 29 Oct 2009 01:39:17 GMT</pubDate><ttl>60</ttl><item><title>使用rsync同步网络备份(转)</title><link>http://www.blogjava.net/Skynet/archive/2009/10/28/300092.html</link><dc:creator>刘凯毅</dc:creator><author>刘凯毅</author><pubDate>Wed, 28 Oct 2009 09:55:00 GMT</pubDate><guid>http://www.blogjava.net/Skynet/archive/2009/10/28/300092.html</guid><wfw:comment>http://www.blogjava.net/Skynet/comments/300092.html</wfw:comment><comments>http://www.blogjava.net/Skynet/archive/2009/10/28/300092.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Skynet/comments/commentRss/300092.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Skynet/services/trackbacks/300092.html</trackback:ping><description><![CDATA[<font style="color: #ff0102;" size="5"><span style="font-weight: bold; font-family: 宋体;">使用rsync同步网络备份</span></font><br />
&nbsp;<br />
&nbsp;<br />
一.<font size="4"> 简介 <br />
rsync常用的备份工具, 它目前是由 rsync.samba.org 维护. <br />
rsync使用所谓的"rsync算法",提供一个非常快速的档案传输方法, 使local和远端二部主机之间的档案达到同步,它主要是传送二个档案的异动部份,而非每次都整份传送, 因此速度相当地快.&nbsp; <br />
rsync它可以搭配rsh或ssh，也可以当成daemon模式使用直接的socket连接, 所以rsync可以当做一个优异的备份工具来使用.&nbsp; <br />
我这简单介绍运用rsync备份远程网路主机档案的基本方法。 <br />
在这,我们是给rsync当成linux的一种daemon模式来运行. <br />
<br />
首先,先给个简单的定义:当然要一台主机跑rsync daemon模式, 我们就称这台机器为一rsync Server, 或者说这台主机是一台备份主机( Backup Server). <br />
备份主机会开启一个873的端口(port), 等待对方rsync连接.所以服务器记的要开这个端口 <br />
<br />
连接时, rsync Server 会检查密码是否相符, 若通过密码查核, 则开始进行档案传输. <br />
第一次连通完成时, 会把整份档案传输一次, 下一次就只传送二个档案之间异动的部份.&nbsp; <br />
以上是rsync client (欲加以备份的远程网路主机) 和rsync server 的运作方式。 <br />
&nbsp;<br />
藉由上述方法, 我们当然也可以设立多部备份主机, 使网路主机上重要的档案能分散至数部主机中, 以分散风险.&nbsp; <br />
一旦完成备份, 我们可以对这些备份主机再做进一步的储存动作, 如使用tar打成tar的包, 把档案备份到硬盘之类.<br />
<br />
以下内容，我用Ubuntu 7.10做客户机,Centos5做服务器测试过.<br />
&nbsp;&nbsp; <br />
&nbsp;<br />
二. 安装法 <br />
&nbsp;<br />
rsync目前最新版是 2.6.8, 可以到rsync.samba.org 下载. <br />
若您使用 rpm 套件,请用下面的方法安装,当然rhel5和centos5中默认就安装了<br />
#rpm -ivh rsync*.rpm<br />
#yum install rsync <br />
&nbsp;<br />
它的设定档位置在 /etc/rsyncd.conf,奇怪，我的没有自动生成这个文件，那我们就来自己配置他 <br />
&nbsp;<br />
&nbsp; <br />
&nbsp;<br />
三. 设定 rsync server: (假设这台主机名称为 rsync.x111.com) <br />
&nbsp;<br />
rsync server 端要设定以下四项: <br />
&nbsp;<br />
&nbsp;&nbsp; 1.规划建立备份目录区&nbsp; <br />
&nbsp;<br />
&nbsp;&nbsp; 2.启动xinetd中的rsync&nbsp;&nbsp; <br />
&nbsp;&nbsp; 3.设定: /etc/rsyncd.conf&nbsp; <br />
&nbsp;<br />
&nbsp;&nbsp; 4.设定: 密码档&nbsp; <br />
&nbsp;<br />
依次说明如下: <br />
&nbsp;<br />
1. 规划建立备份目录区: <br />
建议您准备一个容量较大且独立的分割区, 并在其中开好备份目录, 如此 /blackup/x99 <br />
&nbsp;<br />
2. 启动xinetd中的rsync<br />
系统默认没有安装xinetd。 <br />
# yum install xinetd <br />
#service xinetd restart<br />
#chkconfig rsync on <br />
&nbsp;<br />
以上的操作,主要是要打开rsync这个daemon,一旦有rsync client要连接时,xinetd会把它转介给rsyncd (port 873).&nbsp; <br />
&nbsp;<br />
&nbsp; <br />
3. 设定 /etc/rsyncd.conf :&nbsp; <br />
全局设置<br />
&nbsp;&nbsp;&nbsp; uid = root<br />
&nbsp;&nbsp;&nbsp; gid = root <br />
&nbsp;&nbsp;&nbsp; use chroot = no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 不使用chroot<br />
&nbsp;&nbsp;&nbsp; max connections = 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 最大连接数为4<br />
&nbsp;&nbsp;&nbsp; pid file = /var/run/rsyncd.pid<br />
&nbsp;&nbsp;&nbsp; lock file = /var/run/rsync.lock<br />
&nbsp;&nbsp;&nbsp; log file = /var/log/rsyncd.log&nbsp;&nbsp;&nbsp; # 日志记录文件<br />
&nbsp;<br />
以下的部分,代表开放给某一台rsync client 主机的设定, 简单范本如下:&nbsp; <br />
&nbsp;&nbsp;&nbsp; [x99] <br />
&nbsp;&nbsp;&nbsp; path = /blackup/x99/x99_backup&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; auth users = x99_backup <br />
&nbsp;&nbsp;&nbsp; secrets file = /etc/rsyncd.secrets <br />
&nbsp;&nbsp;&nbsp; read only = no <br />
&nbsp;<br />
&nbsp;<br />
以上文件的注解:&nbsp; <br />
&nbsp;<br />
[x99] 代表要备份的主机代号, 名称自己设置. <br />
&nbsp;<br />
path 用来设定备份档案要存放在那一个目录.这个可先要mkdir开好,可以自己设置 <br />
auth users 代表授权的帐号, 可以自己设置. <br />
secrets file 代表储存帐号密码的密码档, 其放置的路径档名. <br />
&nbsp;<br />
当然, 这台备份主机, 可以容纳许多 rsync client 连接, 只要在 rsyncd.conf中设置对应的多个部分即可. <br />
&nbsp;<br />
以下例子,代表二个主机x99及x100欲备份进来: <br />
&nbsp;<br />
&nbsp; <br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp; [x99] <br />
&nbsp;&nbsp;&nbsp; path = /blackup/x99/x99_backup<br />
&nbsp;&nbsp;&nbsp; comment = XXXXX <br />
&nbsp;&nbsp;&nbsp; auth users = x99_backup <br />
&nbsp;&nbsp;&nbsp; secrets file = /etc/rsyncd.secrets <br />
&nbsp;&nbsp;&nbsp; read only = no <br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; [x100] <br />
&nbsp;&nbsp;&nbsp; path = /blackup/x100/x100_backup <br />
&nbsp;&nbsp;&nbsp; auth users = x100_backup <br />
&nbsp;&nbsp;&nbsp; secrets file = /etc/rsyncd.secrets <br />
&nbsp;&nbsp;&nbsp; read only = no <br />
&nbsp;<br />
&nbsp; <br />
&nbsp;<br />
4. 设定密码文件: <br />
&nbsp;<br />
rsyncd.secrets 的内容很容易, 格式为"帐号:密码"; <br />
如以下例子: <br />
x99_backup:x99pass <br />
注意! 上述设定只是一个例子,你自己设置可一定千万不要直接套用. <br />
接下来, 要将 rsyncd.secrets 这个密码档的档案属性设为root拥有, 且权限要设为600, 否则无法备份成功! <br />
&nbsp;<br />
因此, 请下:&nbsp; <br />
#chown root.root rsyncd.secrets&nbsp; <br />
#chmod 600 rsyncd.secrets&nbsp; <br />
&nbsp;<br />
至此, rsync的服务器这端已设定完成, 若欲查看备份日志.<br />
#tail -f /var/log/rsyncd.log<br />
&nbsp; <br />
&nbsp;<br />
<br />
接下来是 client 端(即欲备份的网络主机) 的设定. <br />
&nbsp;<br />
&nbsp;<br />
四. 设定 rsync client (假设这台主机 IP 为 : 11.22.33.44) <br />
步骤: <br />
&nbsp;<br />
&nbsp;&nbsp; 1.设定密码档&nbsp; <br />
&nbsp;<br />
&nbsp;&nbsp; 2.测试rsync命令是否可以正常&nbsp; <br />
&nbsp;<br />
&nbsp;&nbsp; 3.将rsync指令放入定时任务(crontab)&nbsp; <br />
&nbsp;<br />
另外, 假设x99这台主机是网路上的服务器, 现打算把/var/www/html这个目录加以备份至backup server(上面讲的rsync.x111.com),&nbsp; <br />
&nbsp;<br />
但不想备份下面的目录中的内容/html/log，(也就是说要把/html/log目录排除), 整个操作方式如下: <br />
&nbsp;<br />
1. 假设把密码档放在 /root/rsyncd.secrets, 内容只要含有密码一行即可: <br />
&nbsp;<br />
x99pass <br />
&nbsp;<br />
注意: rsyncd.secrets 的权限属性必须设为600,设置方法见上面. <br />
&nbsp;<br />
2. 测试指令是否可以成功? <br />
&nbsp;<br />
/usr/bin/rsync
-rvztopglHpogDtS --progress&nbsp; --password-file=/root/rsyncd.secrets
/var/www/html --exclude /html/log x99_backup@rsync.x111.com::x99 <br />
&nbsp;<br />
若
出现传输目录档案的画面,
即表示测试成功.上面这个命令行中-rv里的v是verbose，z是压缩，r是递归，字目录一直，topg都是保持文件原有属性如属主、时间的参数。
--progress是指显示出详细的进度情况，--delete是指如果服务器端删除了这一文件，那么客户端也相应把文件删除，保持真正的一致。后面的
x99_backup@ip中，的x99_backup是指的用户名 <br />
&nbsp;<br />
3. 置入工作排程, 假设每天凌晨5点开始备份: <br />
&nbsp;<br />
crontab -u root -e <br />
0
5 * * * /usr/bin/rsync -rvlHpogDtS --password-file=/root/rsyncd.secrets
/var/www/html --exclude apache /html/log x99_backup@rsync.x111.com::x99
<br />
&nbsp;<br />
若您有其它目录(如 /home)要备份, 则如法泡制: 20 5 * * * /usr/bin/rsync
-rvlHpogDtS --password-file=/root/rsyncd.secrets /home
x99_bakup@rsync.x111.com::x99 <br />
&nbsp;<br />
当然您觉得备份一台Backup Server不够,还可再按上述方法,自行增加任意多台Backup Server, 以分散风险! <br />
&nbsp;<br />
&nbsp;<br />
五. 安全性: <br />
&nbsp;<br />
防火墙的 iptables 指令, 来限制 rsync client 的连线范围, 例子如下: <br />
&nbsp;<br />
iptables -A INPUT -p tcp -s ! xx.xx.xx.xx --dport 873 -j DROP <br />
&nbsp;<br />
如此, 只有 xx.xx.xx.xx 这个 client IP 能连入这台 rsync server.<br />
<br />
<br />
附:<br />
详细格式说明：<br />
-v, --verbose 详细模式输出<br />
-q, --quiet 精简输出模式<br />
-c, --checksum 打开校验开关，强制对文件传输进行校验<br />
-a, --archive 归档模式，表示以递归方式传输文件，并保持所有文件属性，等于-rlptgoD<br />
-r, --recursive 对子目录以递归模式处理<br />
-R, --relative 使用相对路径信息<br />
-b, --backup 创建备份，也就是对于目的已经存在有同样的文件名时，将老的文件重新命名为<br />
~filename。可以使用--suffix选项来指定不同的备份文件前缀。<br />
--backup-dir 将备份文件(如~filename)存放在在目录下。<br />
-suffix=SUFFIX 定义备份文件前缀<br />
-u, --update 仅仅进行更新，也就是跳过所有已经存在于DST，并且文件时间晚于要备份的文件。<br />
(不覆盖更新的文件)<br />
-l, --links 保留软链结<br />
-L, --copy-links 想对待常规文件一样处理软链结<br />
--copy-unsafe-links 仅仅拷贝指向SRC路径目录树以外的链结<br />
--safe-links 忽略指向SRC路径目录树以外的链结<br />
-H, --hard-links 保留硬链结<br />
-p, --perms 保持文件权限<br />
-o, --owner 保持文件属主信息<br />
-g, --group 保持文件属组信息<br />
-D, --devices 保持设备文件信息<br />
-t, --times 保持文件时间信息<br />
-S, --sparse 对稀疏文件进行特殊处理以节省DST的空间<br />
-n, --dry-run现实哪些文件将被传输<br />
-W, --whole-file 拷贝文件，不进行增量检测<br />
-x, --one-file-system 不要跨越文件系统边界<br />
-B, --block-size=SIZE 检验算法使用的块尺寸，默认是700字节<br />
-e, --rsh=COMMAND 指定替代rsh的shell程序<br />
--rsync-path=PATH 指定远程服务器上的rsync命令所在路径信息<br />
-C, --cvs-exclude 使用和CVS一样的方法自动忽略文件，用来排除那些不希望传输的文件<br />
--existing 仅仅更新那些已经存在于DST的文件，而不备份那些新创建的文件<br />
--delete 删除那些DST中SRC没有的文件<br />
--delete-excluded 同样删除接收端那些被该选项指定排除的文件<br />
--delete-after 传输结束以后再删除<br />
--ignore-errors 及时出现IO错误也进行删除<br />
--max-delete=NUM 最多删除NUM个文件<br />
--partial 保留那些因故没有完全传输的文件，以是加快随后的再次传输<br />
--force 强制删除目录，即使不为空<br />
--numeric-ids 不将数字的用户和组ID匹配为用户名和组名<br />
--timeout=TIME IP超时时间，单位为秒<br />
-I, --ignore-times 不跳过那些有同样的时间和长度的文件<br />
--size-only 当决定是否要备份文件时，仅仅察看文件大小而不考虑文件时间<br />
--modify-window=NUM 决定文件是否时间相同时使用的时间戳窗口，默认为0<br />
-T --temp-dir=DIR 在DIR中创建临时文件<br />
--compare-dest=DIR 同样比较DIR中的文件来决定是否需要备份<br />
-P 等同于 --partial --progress 显示备份过程<br />
-z, --compress 对备份的文件在传输时进行压缩处理<br />
--exclude=PATTERN 指定排除不需要传输的文件模式<br />
--include=PATTERN 指定不排除而需要传输的文件模式<br />
--exclude-from=FILE 排除FILE中指定模式的文件<br />
--include-from=FILE 不排除FILE指定模式匹配的文件<br />
--version 打印版本信息<br />
--address 绑定到特定的地址<br />
--config=FILE 指定其他的配置文件，不使用默认的rsyncd.conf文件<br />
--port=PORT 指定其他的rsync服务端口<br />
--blocking-io 对远程shell使用阻塞IO<br />
-stats 给出某些文件的传输状态<br />
--progress 在传输时现实传输过程<br />
--log-format=FORMAT 指定日志文件格式<br />
--password-file=FILE 从FILE中得到密码<br />
--bwlimit=KBPS 限制I/O带宽，KBytes per second<br />
-h, --help 显示帮助信息<br />
<br />
<br />
</font>转自 http://blog.csdn.net/KataDoc360/archive/2009/03/16/3995559.aspx<br />
<img src ="http://www.blogjava.net/Skynet/aggbug/300092.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Skynet/" target="_blank">刘凯毅</a> 2009-10-28 17:55 <a href="http://www.blogjava.net/Skynet/archive/2009/10/28/300092.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ftp 服务器搭建</title><link>http://www.blogjava.net/Skynet/archive/2009/07/27/288595.html</link><dc:creator>刘凯毅</dc:creator><author>刘凯毅</author><pubDate>Mon, 27 Jul 2009 07:46:00 GMT</pubDate><guid>http://www.blogjava.net/Skynet/archive/2009/07/27/288595.html</guid><wfw:comment>http://www.blogjava.net/Skynet/comments/288595.html</wfw:comment><comments>http://www.blogjava.net/Skynet/archive/2009/07/27/288595.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Skynet/comments/commentRss/288595.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Skynet/services/trackbacks/288595.html</trackback:ping><description><![CDATA[<br />
<br />
<p>1. vi /etc/vsftpd/vsftpd.conf<br />
&nbsp;&nbsp; 添加：<br />
listen=YES<br />
tcp_wrappers=YES<br />
port_enable=YES<br />
ftp_data_port=20<br />
listen_port=21<br />
listen_address=0.0.0.0<br />
port_promiscuous=NO<br />
no_anon_password=NO<br />
anon_mkdir_write_enable=no</p>
<p>2.将chroot_list_enable=YES前的#去掉<br />
&nbsp; 并将chroot_list_file=/etc/vsftpd.chroot_list 前的#去掉</p>
<p>3.创建用户 <br />
&nbsp;&nbsp; useradd 用户 <br />
&nbsp;&nbsp; passwd 用户</p>
<p>4. vi /etc/vsftpd.chroot_list<br />
&nbsp;&nbsp; 将 用户 添加到文件里</p>
<p>5.修改用户的登录路径（主目录）<br />
&nbsp; vi /etc/passwd <br />
&nbsp;&nbsp;&nbsp; 如：data:x:516:516::/home/data/data:/sbin/nologin</p>
<p>6.启动vsftp<br />
&nbsp; service vsftpd restart <br />
</p>
<img src ="http://www.blogjava.net/Skynet/aggbug/288595.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Skynet/" target="_blank">刘凯毅</a> 2009-07-27 15:46 <a href="http://www.blogjava.net/Skynet/archive/2009/07/27/288595.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cygwin 解决 乱码问题 (转)</title><link>http://www.blogjava.net/Skynet/archive/2009/05/13/270326.html</link><dc:creator>刘凯毅</dc:creator><author>刘凯毅</author><pubDate>Wed, 13 May 2009 00:13:00 GMT</pubDate><guid>http://www.blogjava.net/Skynet/archive/2009/05/13/270326.html</guid><wfw:comment>http://www.blogjava.net/Skynet/comments/270326.html</wfw:comment><comments>http://www.blogjava.net/Skynet/archive/2009/05/13/270326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Skynet/comments/commentRss/270326.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Skynet/services/trackbacks/270326.html</trackback:ping><description><![CDATA[<br />
结合 <a id="homepage1_HomePageDays_DaysList_ctl00_DayItem_DayList_ctl01_TitleUrl" href="../../Skynet/archive/2009/05/12/270270.html">windows ssh 搭建,你会知道更多</a><br />
<br />
<div>
<h2>[转] 配置cygwin下中文支持</h2>
</div>
<p style="line-height: 180%;">
<a href="http://creativecommons.org/licenses/by/3.0/deed.zh" target="_blank">版权声明</a>：转载时请以超链接形式标明文章原始出处和作者信息及<a href="http://bangzhuzhongxin.blogbus.com/logs/11205960.html" target="_blank">本声明</a><br />
<a href="http://fangsblog.blogbus.com/logs/4787655.html">http://fangsblog.blogbus.com/logs/4787655.html</a><br />
<br />
</p>
<p>&nbsp;&nbsp;配置cygwin来支持中文</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://my.opera.com/render/blog/show.dml/369483">http://my.opera.com/render/blog/show.dml/369483</a></p>
<p>&nbsp;Site From: <a href="http://ergophile.bokee.com/1145741.html">http://ergophile.bokee.com/1145741.html</a></p>
<div id="header">
<h1>Cygwin中文How-to- -</h1>
</div>
<div>
<p>I googled it.</p>
<p><a href="http://www.linuxeden.com/forum/blog/index.php?op=ViewArticle&amp;articleId=567&amp;blogId=110848">http://www.linuxeden.com/forum/blog/index.php?op=ViewArticle&amp;articleId=567&amp;blogId=110848</a></p>
<br />
<p>bamanzi | 28 九月, 2004 22:14</p>
<div>大致写了一下，有待补充。<br />
本来一年前就打算写的，但后来觉得老黄写更合适，但这家伙似乎只对代码有兴趣，总不写文档。<br />
</div>
<h3>终端</h3>
<h4>locale支持</h4>
<div>Cygwin的locale支持一直都不太好，采用zh_CN.gb2312好像问题很多，我一直采用的是zh_CN.gbk<br />
~/.bashrc<br />
</div>
<div style="margin-left: 40px;">LC_CTYPE=zh_CN.gbk<br />
CHARSET=GBK #(glib2需要使用找个环境变量确定文件名的编码)<br />
export LC_CTYPE CHARSET</div>
<h4>一些小问题</h4>
<div>允许bash输入、输出中文字符<br />
~/.inputrc<br />
</div>
<div style="margin-left: 40px;">set convert-meta off<br />
set input-meta on<br />
set output-meta on<br />
</div>
<div><br />
ls显示中文文件名(而不是一堆问号)<br />
</div>
<div style="margin-left: 40px;"><span style="font-family: courier new,courier,monospace;">alias ls="/bin/ls --show-control-chars"</span><br />
</div>
<div><br />
less浏览中文文件<br />
</div>
<div style="margin-left: 40px;">less --raw-control-chars<br />
</div>
<div>另外LESSCHARSET环境变量也很有用<br />
<br />
</div>
<h3>X下的中文支持</h3>
<h4>locale支持</h4>
<div>Cygwin的locale支持一直都有问题，好在X程序还可以使用XLOCALE。<br />
建议还是使用zh_CN.gbk, 不要使用zh_CN.GB2312<br />
<br />
在移植程序时需要注意不要让程序连接libcygwin.a里面的setlocale，而是采用libX11.a里面的_Xsetlocale。方法是：检查被移植程序的全部源代码，发现<br />
</div>
<div style="margin-left: 40px;">#include <br />
</div>
<div>就修改为<br />
</div>
<div style="margin-left: 40px;"><span style="font-family: courier new,courier,monospace;">#define X_LOCALE</span><br />
<span style="font-family: courier new,courier,monospace;">#include </span><br />
</div>
<div>同时注意程序的连接库要添加-lX11.<br />
如果对于结果没有把握，可以找个<a href="http://www.dependencywalker.com/">Dependency Walker</a>查看程序是否连接到了cygwin1.dll里面的setlocale，如果是，就说明有遗漏。<br />
<br />
</div>
<h4>中文字体</h4>
<h5>PCF点阵字体</h5>
<div>GTK1.x 和其他一些老的X程序都是用X字体，<br />
<br />
<span style="font-weight: normal;">注意必须要有编码与locale一致的字体，比如用zh_CN.gbk就必须要由GBK编码的字体，用zh_CN.GB2312就必须要有GB2312编码的字体</span><br />
<br />
如果使用zh_CN.GB2312，这里有一个<a href="http://www.linuxfans.org/nuke/modules.php?name=Site_Downloads&amp;op=geninfo&amp;did=463">RedOffice面带的点阵字体包</a><br />
<br />
可以采用ttf2bdf从TTF抽取得到bdf格式，然后再用bdf2pcf得到pcf格式的字体文件。<br />
(<a href="ftp://linux.cis.nctu.edu.tw/packages/chinese/TTF2BDF.exe">这里</a>有一个Windows版本的TTF2BDF，可以将Windows TTF字体转换出BDF字体, 注意得到bdf后要手工编辑一下文件头，将编码声明修改正确)<br />
<br />
得
到字体之后，放到某个目录下，执行mkfontdir生成fonts.dir，然后用xset +fp
/path/to/your/fonts将字体路径加入即可(注意与fontconfig的配置不同，这里路径是不递归的，如果有的字体放在子目录里面，
子目录也需要添加进去才行)。<br />
</div>
<h5>TTF字体</h5>
<div>很多新的应用程序(比如GTK2)都使用fontconfig/libxft2来显示字体，它对TTF字体的支持比较好(X以前通过freetype, xft模块也支持TTF字体，但对中日韩字体的支持不是太好，而且也在Cygwin下似乎也没有这些模块)<br />
<br />
完全可以使用Linux下的arphic字体包. 如果没有安装Linux，可以到<img src="http://www.blogcn.com/images/aurl.gif" alt="" align="absbottom" border="0" height="15" hspace="2" width="15" /><a href="http://packages.debian.org/" target="_blank">http://packages.debian.org</a>下载相应的包，然后用<a href="http://www.7-zip.org/">7zip</a>解压提取出ttf文件。<br />
<br />
得到字体文件之后，放到某个目录之下，编辑/etc/fonts/local.conf，将字体路径加入:<br />
</div>
<span style="font-family: courier new,courier,monospace;">
<div>/path/to/my/ttf/fonts</div>
</span><font face="宋体, MS Song" size="+0">如果只是自己使用，可以将字体文件放到~/.fonts下，不需要修改任何配置，最多三十秒fontconfig就能够发现这些字体了。<br />
</font>
<h4>中文输入法</h4>
老黄(hzhr)移植了<span style="font-weight: bold;">miniChinput</span>到Cygwin，我也移植了<span style="font-weight: bold;">fcitx-1.8.5</span>和3.0，均可以从我的网站上找到 <a href="http://www.oliwen.com/bamanzi/cygwin/chinese/" target="_blank">http://www.oliwen.com/bamanzi/cygwin/chinese/</a><br />
<br />
一般设置了LC_CTYPE和XMODIFIERS就可以在程序中激活输入输入法了(除非这个程序没有XIM支持):<br />
<br />
<div style="margin-left: 40px;"><span style="font-family: courier new,courier,monospace;">LC_CTYPE=zh_CN.gbk</span><br />
<span style="font-family: courier new,courier,monospace;">XMODIFIERS="@im=Chinput"</span><br />
<span style="font-family: courier new,courier,monospace;">export LC_CTYPE XMODIFIERS<br />
<br />
</span></div>
<span style="font-family: courier new,courier,monospace;">对于fcitx而言，XMODIFIERS设置为什么都可以(但必须要设置)，所以设置为"@im=Chinput"的话chinput和fcitx都可以正常使用</span></div>
<br />
<br />
<img src ="http://www.blogjava.net/Skynet/aggbug/270326.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Skynet/" target="_blank">刘凯毅</a> 2009-05-13 08:13 <a href="http://www.blogjava.net/Skynet/archive/2009/05/13/270326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>windows ssh 搭建（转）</title><link>http://www.blogjava.net/Skynet/archive/2009/05/12/270270.html</link><dc:creator>刘凯毅</dc:creator><author>刘凯毅</author><pubDate>Tue, 12 May 2009 11:21:00 GMT</pubDate><guid>http://www.blogjava.net/Skynet/archive/2009/05/12/270270.html</guid><wfw:comment>http://www.blogjava.net/Skynet/comments/270270.html</wfw:comment><comments>http://www.blogjava.net/Skynet/archive/2009/05/12/270270.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Skynet/comments/commentRss/270270.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Skynet/services/trackbacks/270270.html</trackback:ping><description><![CDATA[<br />
结合 <a id="Editor_Results_rprSelectionList_ctl01_LinkTitle" class="titlelink" href="../../Skynet/archive/2009/05/13/270326.html">cygwin 解决 乱码问题 (转)</a> 你会知道更多<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参考 :&nbsp; http://www.docin.com/p-4534575.html<br />
<br />
<br />
<br />
<table style="border-collapse: collapse;" align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="760">
    <tbody>
        <tr>
            <td align="center" height="30"><font style="font-size: 14pt;" color="#02368d"><strong>Cygwin + OpenSSH FOR Windows的安装配置</strong></font><br />
            </td>
        </tr>
        <tr>
            <td align="center" height="9"><img src="http://blog.chinaunix.net/templates/default/images/right_line.gif" alt="" border="0" height="9" width="502" /></td>
        </tr>
        <tr>
            <td align="center">
            <table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="740">
                <tbody>
                    <tr>
                        <td width="740">
                        <div id="art" width="560" style="margin: 15px;">
                        <div><font face="宋体">Cygwin是一款世界著名软件，它可将Linux下的自由软件移植到Windows系统上来应用，了解和掌
                        握这个软件，将使您又多了许多有益的选择，并带您到一个更广阔的天空下翱翔，这对于您的学习和工作将起到确定无疑的推动作用。下面我用自己总结的一个例
                        子，带大家进入这个世界。<br />
                        <font style="font-size: 10.5pt;"><font size="3"><font color="#000000">&nbsp;
                        &nbsp; 在windows操作系统中，使用Cygwin +
                        OpenSSH开源软件来作为远程连接的安全工具，是一个非常好的方法，得到许多网管人员的青睐。然而要想顺利安装配置好这套软件，对于初学者来说，是有
                        一定难度的。为了使同道们少走弯路，特将本人摸索的经验陈列于此，以供需要者参考。建议在安装配置这套软件之前，最好要初步掌握一些Linux终端操作技
                        能及其技术概念。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">以下所述是在Windows XP系统中实践完成，其它Windows系统可参照此文实施。</font></font></font></font><br />
                        <strong><font face="宋体 "><font style="font-size: 12pt;"><font color="#000000">一、安装Cygwin + OpenSSH </font></font></font></strong><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">首先打开<a href="http://cygwin.com/" target="_blank"><font color="#0000ff">http://Cygwin.com</font></a>网页，点击如下链接：</font></font></font></font><br />
                        <p align="center"><font style="font-size: 10pt;"><a href="http://bbs.wuyou.com/1" target="_blank"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33978', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_6422b2b9d20a77ef0969pYa1DYjhF1re.gif')" onmouseout="attachimginfo(this, 'attach_33978', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_6422b2b9d20a77ef0969pYa1DYjhF1re.gif" border="0" /></a></font><font style="font-size: 10pt;"><font face="Times New Roman "><font color="#000000">Install or update</font></font></font></p>
                        <p align="center"><font style="font-size: 10pt;"><strong><font face="Times New Roman "><font color="#000000">now!</font></font></strong></font></p>
                        <br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">将会下载一个安装Cygwin的setup.exe文件，然后在欲安装Cygwin + OpenSSH软件的磁盘上创建Cygwin目录，在此我们假定为：C:"Cygwin，运行setup.exe后打开图一：</font></font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">&nbsp;&nbsp;</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;
                        </font></font></font></font>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33979', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_7c774d4790f99493a014MbrgctIA5HP1.gif')" onmouseout="attachimginfo(this, 'attach_33979', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_7c774d4790f99493a014MbrgctIA5HP1.gif" border="0" /></font></font></font></font></p>
                        <br />
                        <font color="black"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;图一</font></font></font></font><br />
                        <font size="3"><font color="black"><font face="宋体 "><font style="font-size: 10.5pt;">图一主要提供关于Cygwin软件安装的一些信息，点击下一步</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"><font color="#000000">后打开图二：</font></font></font></font><br />
                        <p align="center"><font color="black"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33980', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_7d7cd2146d97cb3c6cf8Hr5RTOC9lQWk.gif')" onmouseout="attachimginfo(this, 'attach_33980', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_7d7cd2146d97cb3c6cf8Hr5RTOC9lQWk.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font color="black"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3">图二</font></font></font></font></p>
                        <font color="black"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3">图二提供了三个选项：</font></font></font></font><br />
                        <font size="3"><font color="black"><font face="宋体 "><font style="font-size: 10.5pt;">第一选项：从Internet</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"><font color="#000000">上下载并安装所需软件。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">第二选项：<font color="black">从Internet</font>上下载所需软件安装包到本地磁盘。</font></font></font></font><br />
                        <font size="3"><font color="black"><font face="宋体 "><font style="font-size: 10.5pt;">第三选项：从</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"><font color="#000000">本地磁盘<font color="black">安装包的目录中</font>安装所需软件。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">此处选择<font color="black">从Internet</font>上下载并安装所需软件，点击下一步后打开图三：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33981', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_5902a2f4536355cd336efY5TAgW6dBZt.gif')" onmouseout="attachimginfo(this, 'attach_33981', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_5902a2f4536355cd336efY5TAgW6dBZt.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图三</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图三为指定软件安装的目标路径，其它按图上默认的选项选择。点击下一步后打开图四：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33982', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_ea7876a209ecc6ecd725dNjdJJWJJ54u.gif')" onmouseout="attachimginfo(this, 'attach_33982', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_ea7876a209ecc6ecd725dNjdJJWJJ54u.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图四</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图四为指定软件安装包的本地存放路径。点击下一步后打开图五：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33983', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_e4eaf1444d526777fc0dTyNMtmrm7zW8.gif')" onmouseout="attachimginfo(this, 'attach_33983', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_e4eaf1444d526777fc0dTyNMtmrm7zW8.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图五</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图五是选择连接Internet的方式，照图点选Use IE5 Settings，点击下一步后打开图六：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33984', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_9e58301754391715d2077D72p6BMs9vM.gif')" onmouseout="attachimginfo(this, 'attach_33984', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_9e58301754391715d2077D72p6BMs9vM.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图六</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图六是选择下载Cygwin的网站，尽量选离我国近的网站，以提高安装速度。点下一步打开图七：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33985', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_3a3f8997ea791ec657179YpP9FUQ3Mcl.gif')" onmouseout="attachimginfo(this, 'attach_33985', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_3a3f8997ea791ec657179YpP9FUQ3Mcl.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图七</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图七为软件包的选择界面，All所在行是选择全部软件包的位置，其它各行是软件组的选择位置，点击软件组前部的+号，可以打开软件组来选择所属软件项。点击所选软件项的循环箭头，可以选择对相应项目的操作方式，每点一次，该项目的操作方式就变化一次。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">针对All及软件组的操作方式有四种选择：即Default、Install、Reinstall和Uninstall，依次代表：默认状态、安装、重新安装和反安装项。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">针对软件项的操作方式有两类五种：</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">第一类：对未安装的软件项有两种选择，即Skip和该软件的版本号，Skip为跳过该软件的安装，显示软件版本号为确定安装该软件。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">第二类：对已安装的软件项有三种选择，即Keep、Reinstall和Uninstall，依次代表：保持现状、重新安装和反安装项。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图八为打开NET软件组的界面</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33986', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_21088429dedd313ac8804kCokblmuTr3.gif')" onmouseout="attachimginfo(this, 'attach_33986', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_21088429dedd313ac8804kCokblmuTr3.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图八</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图
                        八表示选择网络相关软件，我们要安装的是OpenSSH，故点击OpenSSH软件项相应的循环箭头，使原来的Skip变为版本号即可，与OpenSSH
                        软件包相关的Cygwin支持软件包会自动配套选中，例如下一行的OpenSSL软件包也就自动选中了。点击下一步打开图九：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33987', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_3babd602e6c5acdaa1c3JWMJao2mECpB.gif')" onmouseout="attachimginfo(this, 'attach_33987', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_3babd602e6c5acdaa1c3JWMJao2mECpB.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图九</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图九显示安装工作的进度，完成后自动打开图十：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33988', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_28fe621f759bd9a577fdlv5BUmQ0ay5H.gif')" onmouseout="attachimginfo(this, 'attach_33988', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_28fe621f759bd9a577fdlv5BUmQ0ay5H.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十中提示将在桌面建立Cygwin控制台图标和在开始菜单中添加Cygwin控制台图标。点击完成按钮结束安装工作。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">注意：</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">安装软件时，必须以Administrator用户身份来安装，否则可能出现许多莫名的问题，大概是由于用户权限不够造成的，估计是该软件出于安全考虑而有意设计的。</font></font></font></font><br />
                        <strong><font face="宋体 "><font style="font-size: 12pt;"><font color="#000000">二、Openssh基本配置</font></font></font></strong><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">1</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．增加环境变量</font></font></strong></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">用鼠标右键单击我的电脑 </font></font><font face="Wingdings "><font style="font-size: 10.5pt;"><font face="Wingdings ">&#224;</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;">属性 </font></font><font face="Wingdings "><font style="font-size: 10.5pt;"><font face="Wingdings ">&#224;</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;">高级 </font></font><font face="Wingdings "><font style="font-size: 10.5pt;"><font face="Wingdings ">&#224;</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;">环境变量，</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">A</font></font><font face="宋体 "><font style="font-size: 10.5pt;">．在系统变量框中新建变量名为：CYGWIN，变量值为：ntsec tty 的变量。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">B</font></font><font face="宋体 "><font style="font-size: 10.5pt;">．编辑path变量，在原变量值后加上以分号分隔的C:"Cygwin"bin字符串，注意保留原变量的值！</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">2</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．</font></font></strong><strong><font face="宋体 "><font style="font-size: 12pt;">Open</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">SSH</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">服务配置</font></font></strong></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">双击Cygwin图标打开控制台，键入：cd /bin转入bin目录，再键入：ssh-host-config -y，执行后系统提示&#8220;CYGWIN=&#8221; 时输入ntsec tty即可。至此，SSH服务已被加入到Windows的自动启动服务项中了。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">重新启动电脑进入普通用户界面，打开Cygwin控制台后，系统会在Cygwin的home目录下生成一个同名目录：youname (此处假设用户名为：youname)，用户可以在command控制台上用：</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">ssh&nbsp;&nbsp;<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#121;&#111;&#117;&#110;&#97;&#109;&#101;&#64;&#49;&#50;&#55;&#46;&#48;&#46;&#48;&#46;&#49;"><font color="#0000ff">youname@127.0.0.1</font></a></font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">登录自己的SSH服务器试一试，若能登录则表示安装配置基本成功，可以进行远程登录连接，若远程登录失败，应在SSH服务器防火墙的例外中添加允许SSH端口通过的条目，SSH服务默认使用的是22号端口。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">3</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．启动</font></font></strong><strong><font face="宋体 "><font style="font-size: 12pt;">Open</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">SSH</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">服务的方法</font></font></strong></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">A</font></font><font face="宋体 "><font style="font-size: 10.5pt;">．在command控制台上启动：</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Net&nbsp;&nbsp;start&nbsp;&nbsp;sshd&nbsp; &nbsp;&nbsp;&nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">启动SSH服务</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Net&nbsp;&nbsp;stop&nbsp;&nbsp;sshd&nbsp; &nbsp;&nbsp; &nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">停止SSH服务</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">B</font></font><font face="宋体 "><font style="font-size: 10.5pt;">．在Cygwin控制台上启动：</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Cygwin&nbsp;&nbsp;--start&nbsp;&nbsp;sshd&nbsp; &nbsp;&nbsp; &nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">启动SSH服务</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Cygwin&nbsp;&nbsp;--stop&nbsp;&nbsp;sshd&nbsp; &nbsp;&nbsp; &nbsp; #</font></font><font face="宋体 "><font style="font-size: 10.5pt;">停止SSH服务</font></font></font></font><br />
                        <strong><font face="宋体 "><font style="font-size: 12pt;"><font color="#000000">三、Openssh高级配置</font></font></font></strong><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">提示：A. </font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">修改sshd_config 文件前应先通过Cygwin控制台修改文件属性值，使当前用户具有修改权：</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">cd /etc&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">转到sshd_config文件所在目录</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Chmod 777 sshd_config&nbsp; &nbsp;&nbsp; &nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">修改文件属性值，使其他用户可以修改该文件</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">。。。。。&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;#然后参照后面介绍的1、2、3条进行操作</font></font></font></font><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">Chmod 644 sshd_config&nbsp; &nbsp;&nbsp; &nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">修改文件属性，使其恢复原来的属性值</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">B. </font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">sshd_config</font></font><font face="宋体 "><font style="font-size: 10.5pt;">文件被修改后，必须重启SSH服务后改动项才能生效。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">1</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．更改</font></font></strong><strong><font face="宋体 "><font style="font-size: 12pt;">Open</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">SSH</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">工作端口及协议版本</font></font></strong></font></font><br />
                        <p align="left"><font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">用写字板打开C:"Cygwin"etc"sshd_config文件，将port 22改为port 10022或其它自己想改的端口号，最好选1025 -- 65535之间其它软件未用的端口号。再将#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">Protocol 2,1 改为Protocol 2，使当前的SSH服务只支持2.0协议版本。此两项更改的目的是为了增强系统的安全性。</font></font></font></font></p>
                        <p align="left"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10pt;">2．</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3">禁止超级用户远程登录</font></font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3">Open</font></font></font></strong><font size="3"><strong><font face="宋体 "><font style="font-size: 10.5pt;">SSH</font></font></strong></font></font></p>
                        <p align="left"><font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">用写字板打开 C:"Cygwin"etc"sshd_config 文件，将 #</font></font><font face="宋体 "><font style="font-size: 10.5pt;">PermitRootLogin yes 修改为PermitRootLogin no即可。若系统需要超级用户登录，则不必修改此项目。</font></font></font></font></p>
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">3</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．仅使用非对称密钥安全登录</font></font></strong></font></font><br />
                        <p align="left"><font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;"><strong>A</strong></font></font><strong><font face="宋体 "><font style="font-size: 10.5pt;">．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">用写字板打开 C:"Cygwin"etc"sshd_config 文件，将#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">PasswordAuthentication yes 修改为 PasswordAuthentication no 。</font></font></font></font></p>
                        <p align="left"><font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">B．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">在Cygwin控制台：</font></font></font></font></p>
                        <p align="left"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">cd /home/youname&nbsp; &nbsp;&nbsp; &nbsp;#转到当前用户目录</font></font></font></font></p>
                        <p align="left"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">mkdir .ssh&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;#建立 .ssh隐含目录</font></font></font></font></p>
                        <p align="left"><font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">C．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">将制作好的authorized_keys公钥文件复制到c:"Cygwin"home"youname".ssh目录下</font></font></font></font></p>
                        <p align="left"><font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">D．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">在Cygwin控制台：</font></font></font></font></p>
                        <p align="left"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">cd /home/youname/.ssh&nbsp; &nbsp; #转到 .ssh隐含目录</font></font></font></font></p>
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">chmod 600 authorized_keys&nbsp; &nbsp;#</font></font><font face="宋体 "><font style="font-size: 10.5pt;">修改文件属性使之生效(注：属性值大于600时该文件无效)</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">此后用户远程访问ssh服务器时，将不能凭用户密码登录，只能凭借对应的私钥来登录，排除了密码暴力破解的可能，提高了网络访问的安全性。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">4</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．公钥对的生成</font></font></strong></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">由于习惯了用putty作为登录ssh服务器的工具，故在此仅介绍用putty软件生成密钥对的方法。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">A</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">可以从<a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html" target="_blank"><font color="#0000ff">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</font></a>处，选择putty.zip下载，该软件为自由软件，可免费使用，当前版本为V 0.60。</font></font></font></font><br />
                        <font size="3"><font color="#000000"><strong><font face="宋体 "><font style="font-size: 10.5pt;">B</font></font></strong><strong><font face="宋体 "><font style="font-size: 10.5pt;">．</font></font></strong><font face="宋体 "><font style="font-size: 10.5pt;">解压后运行puttygen.exe , 打开图十一：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33989', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_df15cc35e49ffddb4154qPOWXPEGKvU4.gif')" onmouseout="attachimginfo(this, 'attach_33989', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_df15cc35e49ffddb4154qPOWXPEGKvU4.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十一</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">如图选择SSH-2 RSA和1024密钥长度，点击Generate按钮，打开图十二：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33990', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_efe94e278fbd9fd14531D63QITN4LBF6.gif')" onmouseout="attachimginfo(this, 'attach_33990', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_efe94e278fbd9fd14531D63QITN4LBF6.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十二</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">将鼠标在电脑屏幕上随机移动，密钥生成进度条随鼠标指针移动而前进，直至完成并呈现图十三：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33991', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_dd3aba3647d1bc17acf9EnAoFNp2Nko0.gif')" onmouseout="attachimginfo(this, 'attach_33991', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_dd3aba3647d1bc17acf9EnAoFNp2Nko0.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十三</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图上部框中显示的是公钥内容，用户可以在key passphrase框及confirm passphrase框中输入密钥密码，以使密钥丢失后多一道安全防护。当然如果为了方便也可以不设密钥密码。</font></font></font></font><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">依
                        次点击save public key和save private
                        key按钮，分别保存生成的公钥和私钥，将保存的公钥文件改为authorized_key文件名，或将图十三上部框中的公钥内容复制到
                        authorized_key文件中，并保存为纯文本文件(本人习惯于后一种方法)，然后将该文件复制到用户的 .SSH目录中应用，<strong>注意：</strong>该文件在使用时必须将其属性值改为小于等于600方可应用，否则该公钥不会生效。而默认以 .ppk扩展名保存的私钥文件，则要妥善保管好，今后访问SSH服务器就要凭此私钥登录了。</font></font></font></font><br />
                        <strong><font face="宋体 "><font style="font-size: 12pt;"><font color="#000000">四、卸载Cygwin</font></font></font></strong><br />
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">卸
                        载Cygwin与安装Cygwin的过程差不多，也是先运行setup.exe，与安装时一样操作，直到出现图七所示界面时，将All设置为
                        UnInstall后再点击下一步，系统将自动完成Cygwin软件的卸载，Cygwin的安装目录需要手工删除，注册表内与Cygwin相关的项目也要
                        手动删除，如若删除不尽，可能会影响到以后Cygwin的顺利安装和配置，切记！</font></font></font></font><br />
                        <strong><font face="宋体 "><font style="font-size: 12pt;"><font color="#000000">五、PUTTY软件的简单应用</font></font></font></strong><br />
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">运行Putty.exe打开图十四：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33992', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_7613dbc3a82782868dca1lxNAC5V3RVu.gif')" onmouseout="attachimginfo(this, 'attach_33992', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_7613dbc3a82782868dca1lxNAC5V3RVu.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十四</font></font></font></font></p>
                        <font size="3"><font color="#000000"><font face="宋体 "><font style="font-size: 10.5pt;">在Host Name框中输入SSH服务器的IP地址，Port框中输入OpenSSH服务的端口号，然后点开Connection </font></font><font face="Wingdings "><font style="font-size: 10.5pt;"><font face="Wingdings ">&#224;</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"> SSH </font></font><font face="Wingdings "><font style="font-size: 10.5pt;"><font face="Wingdings ">&#224;</font></font></font><font face="宋体 "><font style="font-size: 10.5pt;"> Auth</font></font><font face="宋体 "><font style="font-size: 10.5pt;">打开图十五：</font></font></font></font><br />
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000"><img onmousewheel="return imgzoom(this)" onmouseover="attachimginfo(this, 'attach_33993', 1);attachimg(this, 'mouseover')" onclick="attachimg(this, 'click', 'attachments/20080112_b3a4ed8c4c3b33e90ac5ETrsWaFdBV8e.gif')" onmouseout="attachimginfo(this, 'attach_33993', 0, event)" alt="" src="http://bbs.wuyou.com/attachments/20080112_b3a4ed8c4c3b33e90ac5ETrsWaFdBV8e.gif" border="0" /></font></font></font></font></p>
                        <p align="center"><font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">图十五</font></font></font></font></p>
                        <font face="宋体 "><font style="font-size: 10.5pt;"><font size="3"><font color="#000000">按
                        图中选择相应项，在private key file for authentication框中填入自己私钥的保存路径，再回到图十四，在Saved
                        sessions框中输入一个相关名字，再点击Save按钮将当前会话以相关命名保存起来，以供将来重复使用该会话。使用时选中会话，点击Load按钮装
                        入，再点击Open按钮开始连接SSH服务器，连接界面弹出后，按提示输入用户名、私钥密码，验证通过后即可登录服务器了。</font></font></font></font></div>
                        </div>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>
<br />
<br />
<br />
<img src ="http://www.blogjava.net/Skynet/aggbug/270270.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Skynet/" target="_blank">刘凯毅</a> 2009-05-12 19:21 <a href="http://www.blogjava.net/Skynet/archive/2009/05/12/270270.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>