<?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>夜行人 &#187; Cygwin</title>
	<atom:link href="http://www.187299.com/archives/category/cygwin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.187299.com</link>
	<description>寻觅生命中的那一片浅草......</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:25:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SecureCRT批量配置使用会话key</title>
		<link>http://www.187299.com/archives/1787</link>
		<comments>http://www.187299.com/archives/1787#comments</comments>
		<pubDate>Sun, 16 Jan 2011 14:14:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[MS]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1787</guid>
		<description><![CDATA[部分服务器使用单独的key，为了方便，写了这2个脚本 2个版本，都需要Python Windows版 win_crt_conf.py cygwin版 cygwin_crt_conf.py cygwin下可以用find+sed+unix2dos实现，但真的太慢了，Python快啊 2个文件要修改... ]]></description>
			<content:encoded><![CDATA[<p>部分服务器使用单独的key，为了方便，写了这2个脚本</p>
<p>2个版本，都需要Python<br />
Windows版<br />
win_crt_conf.py</p>
<p>cygwin版<br />
cygwin_crt_conf.py</p>
<p>cygwin下可以用find+sed+unix2dos实现，但真的太慢了，Python快啊</p>
<p>2个文件要修改的地方是一样的</p>
<p>需要使用单独key的SecureCRT配置文件目录<br />
crt_conf_dir = 'E:\\CRT_CONF'</p>
<p>定义key文件的位置，identify为private key的名字<br />
key_path_new = 'S:"Identity Filename"=E:\CRT_KEY\identify'</p>
<p>原理，每个服务器配置都定义了使用全局key还是会话key<br />
这个是使用全局key<br />
D:"Use Global Public Key"=00000001<br />
定义使用的key文件路径<br />
S:"Identity Filename"=</p>
<p>定义使用会话key<br />
D:"Use Global Public Key"=00000000</p>
<p>E:\CRT_KEY\identify为要使用的会话key<br />
S:"Identity Filename"=E:\CRT_KEY\identify<br />
win_crt_conf.py<br />
[python]<br />
#!D:\\Python27\\python<br />
#-*-coding=utf-8-*-    </p>
<p>import os,sys,re  </p>
<p>crt_conf_dir = 'E:\\CRT_CONF'<br />
global_public_key_true = 'D:"Use Global Public Key"=00000001'<br />
global_public_key_false = 'D:"Use Global Public Key"=00000000'<br />
key_path_old = 'S:"Identity Filename"='<br />
key_path_new = 'S:"Identity Filename"=E:\CRT_KEY\identify'</p>
<p>re_global_public_key = re.compile(global_public_key_true,re.DOTALL)<br />
re_key_path = re.compile('S:"Identity Filename"=(.*)')</p>
<p>os.chdir(crt_conf_dir)  </p>
<p>c1 = os.walk(os.getcwd()) </p>
<p>filelist = []   </p>
<p>for c2 in c1:<br />
	for c3 in c2[2]:<br />
		filelist.append(os.path.join(c2[0],c3))</p>
<p>for filename in filelist:<br />
    fileread = open(filename,'r')<br />
    filer = fileread.read()<br />
    pub_key = re.sub(re_global_public_key,global_public_key_false,filer,0)<br />
    key_path = re.sub(re_key_path,key_path_new,pub_key,0)<br />
    fileread.close()<br />
    fileok = open(filename,'w')<br />
    fileok.write(key_path)<br />
    fileok.close()<br />
    print filename,'替换成功!'<br />
[/python]</p>
<p>cygwin_crt_conf.py</p>
<p>[python]<br />
#!/usr/bin/python<br />
#-*-coding=utf-8-*-    </p>
<p>import os,sys,re  </p>
<p>crt_conf_dir = '/cygdrive/e/CRT_CONF'<br />
global_public_key_true = 'D:"Use Global Public Key"=00000001'<br />
global_public_key_false = 'D:"Use Global Public Key"=00000000'<br />
key_path_old = 'S:"Identity Filename"='<br />
key_path_new = 'S:"Identity Filename"=E:\CRT_KEY\identify'</p>
<p>re_global_public_key = re.compile(global_public_key_true,re.DOTALL)<br />
re_key_path = re.compile('S:"Identity Filename"=(.*)')</p>
<p>os.chdir(crt_conf_dir)  </p>
<p>c1 = os.walk(os.getcwd()) </p>
<p>filelist = []   </p>
<p>for c2 in c1:<br />
	for c3 in c2[2]:<br />
		filelist.append(os.path.join(c2[0],c3))</p>
<p>for filename in filelist:<br />
    fileread = open(filename,'r')<br />
    filer = fileread.read()<br />
    pub_key = re.sub(re_global_public_key,global_public_key_false,filer,0)<br />
    key_path = re.sub(re_key_path,key_path_new,pub_key,0)<br />
    fileread.close()<br />
    fileok = open(filename,'w')<br />
    fileok.write(key_path)<br />
    fileok.close()<br />
    print filename,'Replace successful!'<br />
[/python]</p>
<p>主要参考了http://blog.591by.com/show-214-1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1787/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>telnet on Cygwin</title>
		<link>http://www.187299.com/archives/1587</link>
		<comments>http://www.187299.com/archives/1587#comments</comments>
		<pubDate>Sun, 13 Jun 2010 07:43:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://www.187299.com/archives/1587</guid>
		<description><![CDATA[Telnet remote server gives no response on Cygwin Windows's telnet doesn't work on cygwin.We can install inetutils which contains some useful command,such as telnet ftp and so on inetutils is in Net category... ]]></description>
			<content:encoded><![CDATA[<p>Telnet remote server gives no response on Cygwin</p>
<p>Windows's telnet doesn't work on cygwin.We can install inetutils which contains some useful command,such as telnet ftp and so on</p>
<p>inetutils is in Net category.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1587/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>windows下启动cygwin的cron</title>
		<link>http://www.187299.com/archives/1486</link>
		<comments>http://www.187299.com/archives/1486#comments</comments>
		<pubDate>Tue, 23 Feb 2010 12:30:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1486</guid>
		<description><![CDATA[windows下启动cygwin的cron windows 的计划任务管理 taskschedule 实在太不合我口味了，老早以前就搜过 windows 下的 cron 实现，找到一个运行不怎么稳定，莫名其妙的崩溃。老早以前用 cygwin 的时候，以 l... ]]></description>
			<content:encoded><![CDATA[<p>windows下启动cygwin的cron<br />
windows 的计划任务管理 taskschedule 实在太不合我口味了，老早以前就搜过 windows 下的 cron 实现，找到一个运行不怎么稳定，莫名其妙的崩溃。老早以前用 cygwin 的时候，以 linux 的思维方式， crontab -e 制定完任务以后，发现怎么也执行不了。</p>
<p>前阵子又进一步了解了 cygwin ，原来还需要启动一个服务才能够搞定 cron 。cygwin 下不仅仅是 cron 需要以 windows 服务的方式启动，消息队列、共享内存以及信号量等进程间通信方式也需要以 windows 服务方式启动 cygserver 以后才可用。除了 cron 包，还需要确认 cygrnsrv 包已经安装：</p>
<p># 安装 cron 服务<br />
cygrunsrv -I cron -p /usr/sbin/cron -a -D<br />
# 启动服务: 也可以用 windows 的启动方式 net start cron<br />
cygrunsrv -S cron</p>
<p># 启动 cygserver<br />
cygrunsrv -I cygserver -p /usr/sbin/cygserver -e "CYGWIN=server"</p>
<p>启动 cron 以后，即使关闭 cygwin 命令窗口，crond 还是会继续运行 :) ，而且默认是自动启动的服务，重启机器以后依然运行—不需要开 cygwin 窗口。</p>
<p>如果用于运行cron的用户是有密码的</p>
<p>则需要用</p>
<p>cron-config来进行初始化配置</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1486/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cygwin中文乱码</title>
		<link>http://www.187299.com/archives/806</link>
		<comments>http://www.187299.com/archives/806#comments</comments>
		<pubDate>Sat, 09 May 2009 02:38:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=806</guid>
		<description><![CDATA[直接执行 alias ls='ls --color --show-control-chars --time-style=long-iso' 或者把上面的内容加到/etc/profile中重启Cygwin即可。 为了使使用更方便，推荐增加如下配置信息： 1. 编辑用户home目录下的文件.inputc，... ]]></description>
			<content:encoded><![CDATA[<div id="articleBody" class="articleContent">
<div class="item-content">
<p>直接执行<br />
alias ls='ls --color --show-control-chars --time-style=long-iso'<br />
或者把上面的内容加到/etc/profile中重启Cygwin即可。</p>
<p>为了使使用更方便，推荐增加如下配置信息：</p>
<p>1. 编辑用户home目录下的文件.inputc，去除以下几行的注释：</p>
<p>set meta-flag on</p>
<p># 关闭bash命令行8字节字符转义符的转换<br />
set convert-meta off</p>
<p># 使bash命令行支持8字节字符输出<br />
set output-meta on<br />
set input-meta on</p>
<p>2 编辑用户home目录下的文件.bash_profile，在文件末尾加上下面几行：</p>
<p>alias ls='ls --color --show-control-chars --time-style=long-iso'<br />
export LC_ALL=zh_CN.GB23122<br />
export LC_CTYPE=zh_CN.GB2312<br />
export LANG=zh_CN.GB2312<br />
export XMODIFIERS="@im=Chinput"3<br />
stty cs8 -istrip<br />
stty pass8<br />
# Update: 少了这个less就不支持中文了<br />
export LESSCHARSET=latin1</p>
<p>转载自：<a href="http://blog.sina.com.cn/s/blog_3ee207aa010008ml.html" target="_blank">http://blog.sina.com.cn/s/blog_3ee207aa010008ml.html</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/806/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cygwin上的whois、dig、host</title>
		<link>http://www.187299.com/archives/798</link>
		<comments>http://www.187299.com/archives/798#comments</comments>
		<pubDate>Fri, 08 May 2009 16:04:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=798</guid>
		<description><![CDATA[安装bind包 安装好后，执行 dig 报错： ;; communications error: connection reset 解决办法： 1、指定使用的DNS服务器，就可以正常显示 dig 187299.com @192.168.0.1 2、彻底解决，添加/etc/resolv.con文件 vim /etc/resolv... ]]></description>
			<content:encoded><![CDATA[<p>安装bind包<br />
安装好后，执行<br />
dig<br />
报错：<br />
;; communications error: connection reset<br />
解决办法：<br />
1、指定使用的DNS服务器，就可以正常显示<br />
dig 187299.com @192.168.0.1<br />
2、彻底解决，添加/etc/resolv.con文件<br />
vim /etc/resolv.conf<br />
添加以下内容<br />
nameserver 192.168.0.1<br />
保存退出<br />
添加resolv.conf之后，whois、dig、host就可以正常使用</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/798/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cygwin install catalog</title>
		<link>http://www.187299.com/archives/796</link>
		<comments>http://www.187299.com/archives/796#comments</comments>
		<pubDate>Fri, 08 May 2009 15:23:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=796</guid>
		<description><![CDATA[cygwin setup.exe 2.573.2.2 Accessibility Admin shutdown: Shutdown, reboot, hibernate or suspend the machine Base alternatives: A tool for managing package conflicts ash: A Bourne Shell (/bin/sh) workalike bash: The GNU Bourne Again SHell coreutils: GNU c... ]]></description>
			<content:encoded><![CDATA[<p>cygwin setup.exe 2.573.2.2</p>
<p>Accessibility<br />
Admin<br />
shutdown: Shutdown, reboot, hibernate or suspend the machine<br />
Base<br />
alternatives: A tool for managing package conflicts<br />
ash: A Bourne Shell (/bin/sh) workalike<br />
bash: The GNU Bourne Again SHell<br />
coreutils: GNU core utilities<br />
cygwin: The UNIX emulation engine   1.5.24-2<br />
cygwin-doc: Utilities for finding files--fine, xargs, locate, updatedb<br />
gawk: GNU awk, a pattern scanning and processing language<br />
grep: Search and print textual input for lines which match a specified pattern<br />
gzip: The GNU compression utility<br />
login:  Sign on to a system<br />
man : Man, apropos and wahtis<br />
run: Start console programs with hidden console<br />
sed: The GNU sed stream editor<br />
tar: A GNU file archiving program<br />
which: Displasy where a particular program in your path is located</p>
<p><span id="more-796"></span>Database<br />
db4.5: Oracle Berkeley DB, the industry-leading open source, embeddable database engine - base program<br />
libdb4.5: ... - runtime<br />
libdb4.5-devel: ... - devel<br />
gdbm: GNU dbm database routines (utilities)   1.8.3-8<br />
libgdbm: ... - runtime<br />
libgdbm-devel: ... - devel<br />
Devel<br />
ELFIO: ELF file reader and producer implemented as a C++ library<br />
SWI-Prolog: Prolog Interpreter<br />
aalib-devel: An ascii art library<br />
apr1: The Apache Portable Runtime<br />
aprutil1: Additional utility library for use with the Apache Portable Runtime<br />
autoconf: Wrapper scripts for autoconf commands 4-1<br />
autoconf2.1: Stable version of the automatic configure script builder 2.13-3<br />
autoconf2.5: Development version of the automatic configure script builder 2.61-2<br />
automake: Wrapper scripts for automake and aclocal 2-1<br />
automake1.9: a tool for generating GNU-compliant Makefiles 1.9.6-2<br />
bashdb: Debugger for bash scripts 3.1_0.08-1<br />
binutils: The GNU assembler, linker and binary utilities 20060817-1<br />
bison: A parser generator that is compatile with YACC 2.3-1<br />
boost: Portable C++ libraries useful across a broad spectrum of applications. 1.33.1-3<br />
boost-devel: ...<br />
libboost: ...<br />
byacc: The Berkeley LALR parser generator 1.9-1<br />
cvs: Concurrent Version System 1.11.22-1<br />
cvsps: Generates patchset informtion from a CVS repository<br />
cvsutils: CVS client utilities for offline work<br />
cygport: Cygwin source packaging tool<br />
ddd: Ddd<br />
dejagnu: Framework for running test suites on software tools<br />
diffstat: Generate statistics on diff output.<br />
e2fsimage: Utility for creating ext2 filesytem images.<br />
e2fsprogs: Ext2 filesystem utilities<br />
eventlog: Structured event logging library<br />
expat: XML parser library written in C<br />
flex: A fast lexical analyzer generator<br />
gcc: C compiler upgrade helper   3.4.4-3<br />
gcc-core: C compiler   3.4.4-3<br />
gcc-g++: C++ compiler 3.4.4-3<br />
gdb: The GNU Debugger<br />
glib-devel: Gnome C function library<br />
gperf: Perfect hash function generator<br />
guile-devel: The GNU extension language and Scheme interpreter - development<br />
help2man: creates man pages from program output<br />
indent: C/C++ language source code formatting program<br />
ioperm: Support for ioperm()/iopl() functions<br />
libfcgi-devel: Headers and Libraries for FastCGI(fcgi)<br />
libncurses-devel: Libraries for terminal handling<br />
libiconv: GNU character set conversion library and utilities<br />
libtool1.5: A shared library generation tool<br />
libusb-win32: USB programming library<br />
libxml2: XML C parser and toolkit (runtime and apps)<br />
libxml2-devel: ... (devel)<br />
make: The GNU version of the 'make' utility 3.81-1<br />
mingw-runtime: MinGW Runtime<br />
mktemp: Allows safe temp file/dir creation from shell scripts<br />
pcre: Perl-Compatible Regular Expressions (devel)<br />
pkg-config: A utility used to retrieve information about installed libraries<br />
plotutils-devel: Header files and link libraries for plotutils dlls<br />
python-brlapi: Braille python bindings<br />
python-pyrex: Compile native-code modules for Python from python-like syntax<br />
ruby: Interpreted object-oriented scripting language<br />
speex-devel: An open-source, patent-free speech codec (Devel)<br />
swig: Simplified Wrapper Interface Generator<br />
tcm: Toolkit for Conceptual Modeling (TCM)<br />
xdelta: Computes changes between binary files.<br />
xerces-c-devel: A validating XML parser written in a portable subset of C++<br />
Doc<br />
GConf2-doc: GNOME configuration database system (API doc)<br />
atk-doc: Accessibility Toolkit library (API doc)<br />
cygwin-doc:<br />
docbook-xml44: DocBook XML DTD 4.4<br />
expat: XML parser library written in C<br />
libexpat0: ...<br />
man: Man, aprops and whatis<br />
texinfo: Documentation system for on-line information and printed output</p>
<p>Games<br />
ctris: Console mode tetris clone<br />
typespeed: Test your typing speed, and get your flinger's CPS<br />
Gnome<br />
GConf2: GNOME configuration database system (runtime)<br />
GConf2-devel:<br />
GConf2-doc:<br />
atk: Accessibility Toolkit library (runtime)<br />
atk-devel:<br />
atk-doc:<br />
audiofile: Digital audio file library (executables)<br />
glib2: GNOME C funciton library (runtime)<br />
glib2-devel:<br />
glib2-doc:<br />
gnome-common: Common development files for GNOME 2.x<br />
gnome-libs:<br />
gnome-vfs2: GNOME Virtual File System libraries (runtime)<br />
gonme-vfs2-devel:<br />
gtk-engines:<br />
gmlib: Graphics rendering library<br />
intltool: GNOME source internalization scripts<br />
libart_lgpl: GNOME 1.4 core libraries (libart)<br />
libaudiofile-devel:<br />
libaudiofile0: ... (runtime)<br />
libgnome: GNOME 1.4 core libraries (non UI)<br />
libgnomeui:<br />
libxml: XML C parser and toolkit (version1)<br />
libxml2: ... (runtime and apps)<br />
libxml2-devel:<br />
libxslt: The GNOME XSLT C library (runtime)<br />
libxslt-devel:<br />
libzvt: GNOME 1.4 core libraries (virtual terminal)<br />
pygtk2:<br />
pylibxml2:<br />
pylibxslt:<br />
python-libxml2:<br />
python-libxslt:<br />
startup-notification: Program startup notification library<br />
Graphics<br />
GraphicsMagick:<br />
ImageMagick: Image maniplulation software suite (utilities)<br />
aalib: An ascii art library<br />
aalib-devel: ... (devel)<br />
glitz: OpenGL image compositing library<br />
gnuplot: A command-line driven interactive function plotting utility<br />
imlib: Graphics rendering library<br />
jpeg: A library for manipulating JPEG image formt files<br />
lcms: A small-footprint, speed optimized color management engine<br />
opengl: OpenGL-related libraries<br />
ploticus: Command-line plot and graph generator<br />
Interpreters<br />
SWI-Prolog: Prolog Interpreter<br />
clisp: An ANSI Common Lisp implementation<br />
emacs: The extensible, customizable, self-documenting real-time dsiplay editor<br />
expat:<br />
libexpat0:<br />
expect: A program that 'talk' to other programs<br />
gawk:<br />
guile:<br />
m4:<br />
perl:<br />
python:<br />
ruby:</p>
<p>KDE<br />
qt3: C++ GUI application framework<br />
Libs<br />
ELFIO:<br />
boost:<br />
catgets: Catgets message catalog API<br />
compface: 48*48*1 image compression and decompression<br />
crypt: Encryption/Decryption utility and library)<br />
eventlog: Sturctured event logging library<br />
fftw3: Library for computing Fast Fourier Transforms<br />
freeglut: OpenSourced alternative to the OpenGL Utility Toolkit<br />
glib: Gnome C Function library<br />
glib2: GNOME C Function library (runtime)<br />
libltdl3: Libtool's dynamic loader<br />
libmcrypt: An encryption library<br />
libncurses8: Libraries for terminal handling (runtime)<br />
ncurses: Libraries for terminal handling (main package)        5.5-3<br />
mhash: Libray of hash algorithms<br />
openssl:<br />
popt: Library for parsing cmdline parameters<br />
readline: GNU readline and history libraries<br />
subversion:<br />
tcltk: TCL/Tk libraries<br />
zlib: The zlib compression and decompression library</p>
<p>Mail<br />
email<br />
exim:<br />
tin:<br />
Math<br />
bc: The GNU numeric processing language and reverse polish calculator<br />
clisp:<br />
gmp: a free    library for arbitrary precision arithmetic<br />
fftw3:<br />
mathomatic:<br />
octave:<br />
Mingw<br />
Net<br />
curl: Command line tool for tarnsferring files with HTTP, HTTPS, FTP, etc.<br />
irc: An Internet Relay Chat (IRC) client<br />
lftp:<br />
lighttpd:<br />
ping:<br />
whois: GNU whois<br />
ttcp:<br />
xinetd: The extended Internet services daemon<br />
Publishing<br />
Perl<br />
Python<br />
Numeric: Numeric Python module<br />
asciidoc: Text based document generation<br />
Security<br />
flawfinder: Examine source and look for security weaknesses<br />
Shells<br />
System<br />
util-linux: Random clollection of Linux utilities<br />
Text<br />
Utils<br />
ELFIO:<br />
bc:<br />
mt: Magnetic Tape manipulation utility<br />
ncdu: NCurses Disk Usage<br />
rpm: A package management system<br />
Web<br />
apache:<br />
curl:<br />
fcgi:<br />
lighttpd:</p>
<p>转载自：<a href="http://blog.chinaunix.net/u/16651/showart_454722.html">http://blog.chinaunix.net/u/16651/showart_454722.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/796/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XP下通过cygwin架设SSH服务</title>
		<link>http://www.187299.com/archives/794</link>
		<comments>http://www.187299.com/archives/794#comments</comments>
		<pubDate>Fri, 08 May 2009 15:21:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=794</guid>
		<description><![CDATA[综合两篇文章，成下文： 第一篇：http://hi.baidu.com/qiraosky/blog/item/35a7f144d9f3488ab3b7dc2e.html sshd服务是一种安全连接，它能让你访问服务器上的命令行界面。Windows本身没有提供该服务，所以我们可... ]]></description>
			<content:encoded><![CDATA[<p>综合两篇文章，成下文：</p>
<p>第一篇：<a href="http://hi.baidu.com/qiraosky/blog/item/35a7f144d9f3488ab3b7dc2e.html" target="_blank">http://hi.baidu.com/qiraosky/blog/item/35a7f144d9f3488ab3b7dc2e.html</a></p>
<p>sshd服务是一种安全连接，它能让你访问服务器上的命令行界面。Windows本身没有提供该服务，所以我们可以通过 cygwin 来进行安装。<br />
安装 cygwin</p>
<p>首先安装 cygwin。安装时间为 2006-10-8，Cygwin DLL版本为 1.5.21-1。除了默认的软件包之外，又增加了以下软件包。</p>
<p>* Admin<br />
o cron-3.0.1-19<br />
o cygrunsrv-1.17-1<br />
o shutdown-1.7-1<br />
o syslog-ng-1.6.11-1<br />
* Archive<br />
o unzip-5.50-5<br />
o zip-2.3-6<br />
* Devel<br />
o subversion-1.3.2-1<br />
* Editors:<br />
o vim-7.0.076-1<br />
* Interpreters<br />
o gawk-3.1.5-4<br />
o perl-5.8.7-5<br />
o expat-1.95.8-1<br />
* Libs<br />
* Net<br />
o lftp-3.5.1-1<br />
o openssh-4.4p1-1<br />
o openssl-0.98d-1<br />
o openssl097-0.9.7l-1<br />
o ping-1.0-1<br />
o netcat-1.10-2<br />
* Shells<br />
o ash-20040127-3<br />
o bsah-3.1-9<br />
o bash-completion-20060301-1<br />
o mc-4.6.1-2<br />
* Utils<br />
o patch-2.5.8-8<br />
o time-1.7-1<br />
* Web<br />
o wget-1.10.2-1<br />
<span id="more-794"></span><br />
安装</p>
<p>用管理员用户登录，启动 cygwin 命令行，执行以下命令。</p>
<p>$ ssh-host-config<br />
Generating /etc/ssh_host_key<br />
Generating /etc/ssh_host_rsa_key<br />
Generating /etc/ssh_host_dsa_key<br />
Generating /etc/ssh_config file<br />
Privilege separation is set to yes by default since OpenSSH 3.3.<br />
However, this requires a non-privileged account called 'sshd'.<br />
For more info on privilege separation read /usr/doc/openssh/README.privsep.</p>
<p>Shall privilege separation be used? (yes/no) yes<br />
Warning: The following function requires administrator privileges!<br />
Shall this script create a local user 'sshd' on this machine? (yes/no) yes<br />
Generating /etc/sshd_config file<br />
Added ssh to /cygdrive/c/WINDOWS/system32/drivers/etc/services</p>
<p>Do you want to install sshd as service?<br />
(Say "no" if it's already installed as service) (yes/no) yes</p>
<p>Which value should the environment variable CYGWIN have when<br />
sshd starts? It's recommended to set at least "ntsec" to be<br />
able to change user context without password.<br />
Default is "ntsec".  CYGWIN=binmode ntsec tty</p>
<p>The service has been installed under LocalSystem account.<br />
To start the service, call `net start sshd' or `cygrunsrc -S ssdh'.</p>
<p>Host configuration finished. Have fun!</p>
<p>配置 sshd</p>
<p>在 cygwin 的命令行中输入以下命令：</p>
<p>$ cd /etc<br />
$ chmod 666 sshd_config<br />
$ vi sshd_config</p>
<p>修改 sshd_config 的以下配置。</p>
<p>PermitRootLogin no       # 禁止root登录<br />
StrictModes yes          # CYGWIN=ntsec时的安全配置<br />
RhostsRSAAuthentication no   # 禁止 rhosts 认证<br />
IgnoreRhosts yes         # 禁止 rhosts 认证<br />
PasswordAuthentication no    # 禁止密码认证<br />
ChallengeResponseAuthentication no    # 禁止密码认证<br />
PermitEmptyPasswords no     # 禁止空密码用户登录</p>
<p>最后将 sshd_config 的权限修改回 644。</p>
<p>$ chmod 644 sshd_config</p>
<p>启动 sshd 服务器。</p>
<p>$ cygrunsrv -S sshd</p>
<p>生成公钥和密钥</p>
<p>由于我们上面的设置仅允许密钥方式认证，所以要为我们的用户生成一对公钥和密钥。</p>
<p>在 cygwin 的控制台中执行以下命令，生成 ssh1 的公钥和密钥。</p>
<p>$ ssh-keygen -t rsa1<br />
Generating public/private rsa1 key pair.<br />
Enter file in which to save the key (/home/charlee/.ssh/identity):<br />
Enterpassphrase (empty for no passphrase):  输入密码<br />
Enter same passphrase again:   再次输入密码<br />
Your identification has been sabed in /home/charlee/.ssh/identity<br />
Your public key has been saved in /home/charlee/.ssh/identity.pub</p>
<p>类似的方法，使用下面的命令生成 ssh2 的公钥和密钥。</p>
<p>$ ssh-keygen -t rsa<br />
$ ssh-keygen -t dsa</p>
<p>将公钥导入到认证公钥中：</p>
<p>$ cd .ssh<br />
$ cat identity.pub &gt;&gt; authorized_keys<br />
$ cat id_rsa.pub &gt;&gt; authorized_keys<br />
$ cat id_dsa.pub &gt;&gt; authorized_keys</p>
<p>因为我们在 /etc/sshd_config 的配置中使用了 StrictModes yes 的设置，所以要修改目录权限，命令如下。</p>
<p>$ chmod 755 /home/charlee</p>
<p>然后将密钥 identity、id_rsa、id_dsa 文件用某种方式复制到客户端。我使用的客户端是 Linux，因此只要将这三个文件复制到客户端的 $HOME/.ssh 目录下即可。</p>
<p>登录服务器。在客户端上输入以下命令，即可登录服务器。</p>
<p>$ ssh 192.168.0.2</p>
<p>常见问题</p>
<p>2008-12-11更新</p>
<p>Q: cygrunsrv -S sshd不能启动，报告</p>
<p>cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062:<br />
The service has not been started.</p>
<p>A: 很可能是/var/log的权限设置不正确。首先执行 mkpasswd 和 mkgroup 重新生成权限信息，再删除sshd服务，重新配置：</p>
<p>$ mkpasswd -l &gt; /etc/passwd<br />
$ mkgroup -l &gt; /etc/group<br />
$ cygrunsrv -R sshd<br />
$ ssh-host-config -y<br />
$ cygrunsrv -S sshd</p>
<p>Q: 用公钥登录时老是说Permission denied (publickey).，怎么办？</p>
<p>A: 可以在Windows的事件日志（我的电脑-&gt;右键-&gt;管理-&gt;事件查看器）中看到sshd产生的错误信息。常见的问题是 .ssh/authorized_keys权限设置不正确，该文件必须设置为 0644 才能正常登录。</p>
<p>补充：<br />
我是装了又装，还是无法启动sshd。<br />
出现这个错误<br />
cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062:<br />
The service has not been started.<br />
除了以上所说的，还有一个可能是cygwin1.dll冲突了。</p>
<p>在Windows事件查看器里看到以下信息：</p>
<p>事件 ID ( 0 )的描述(在资源( sshd )中)无法找到。本地计算机可能没有必要的注册信息或消息 DLL 文件来从远端计算机显示消息。您可能可以使用 /AUXSOURCE= 标识来检索词描述；查看帮助和支持以了解详细信息。下列信息是事件的一部分: sshd: PID 2124: `sshd' service started.</p>
<p>最后tail /var/log/sshd.log，看到里面有错误信息，Google之，发现以下文章<br />
<a href="http://jansel.javaeye.com/blog/345653" target="_blank">http://jansel.javaeye.com/blog/345653</a></p>
<p>cygwin安装问题，与cntlm冲突</p>
<p>关键字: cygwin cntlm<br />
安装了好多次cygwin没有成功，始终在执行到17%或者97%的地方停住。最后只好在安全模式下安装，没有想到竟然成功了。</p>
<p>返回到正常启动模式，发现如下问题：</p>
<p>Error代码<br />
*** fatal error - system shared memory version mismatch detected - 0x2D1E009C/ 0x8A88009C.<br />
This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start-&gt;Find/Search facility<br />
and delete all but the most recent version. The most recent version *should* reside in x:cygwinbin, where 'x' is the drive on which you have<br />
installed the cygwin distribution. Rebooting is also suggested if you<br />
are unable to find another cygwin DLL.</p>
<p>照着提示，把全部硬盘扫描了一遍，发现Cntlm竟然也用到了cygwin1.dll，不过版本比较低，是24的；而我自己安装的cygwin是25的，不兼容。把Cntlm的24版本替换为25版本之后，cygwin可以正常使用，Cntlm也MS没有问题。</p>
<p>一点感受：cygwin的错误提示做的真的不错。再想想自己的产品。</p>
<p>我没有装Cntlm，但用search everything查找，发现好多地方有cygwin1.dll<br />
D:dig<br />
D:APMServ5.2.6nginx<br />
D:APMServ5.2.6shell<br />
其中D:dig加到了PATH中，估计是这个cygwin1.dll比较旧导致的。<br />
把D:dig从PATH中移除，重启XP就可以启动了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/794/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

