<?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>wd and cc &#187; ssh</title>
	<atom:link href="http://wdicc.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://wdicc.com</link>
	<description>Happy every day...</description>
	<lastBuildDate>Wed, 01 Feb 2012 03:27:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>自动连接 ssh 并输入密码</title>
		<link>http://wdicc.com/autossh-and-auto-enter-password/</link>
		<comments>http://wdicc.com/autossh-and-auto-enter-password/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 09:11:27 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[expect]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://wdicc.com/autossh-and-auto-enter-password/</guid>
		<description><![CDATA[这年头不翻墙就看不到真像了，前几天整了个 ssh 代理，就研究了下自动登录。 ssh 自动登录首选就是使用 key 了，可对方不干，那就只能使用密码了。自动输入密码可以用 expect。查这个的时候发现了一个 expect-lite，发现也挺有意思的，他把写 expect 脚本简单化了，比如想 send xxx，那就用 >xxxx 就行了，想 expect yyy 那就]]></description>
			<content:encoded><![CDATA[<p>这年头不翻墙就看不到真像了，前几天整了个 ssh 代理，就研究了下自动登录。</p>
<p>ssh 自动登录首选就是使用 key 了，可对方不干，那就只能使用密码了。自动输入密码可以用 expect。查这个的时候发现了一个 expect-lite，发现也挺有意思的，他把写 expect 脚本简单化了，比如想 send xxx，那就用 >xxxx 就行了，想 expect yyy 那就 <yyy 就好了，等等这些，呵呵。不过我后来没用这个，还是用的标准的 expect，代码如下。</p>

<div class="wp_syntax"><div class="code"><pre class="expect">spawn autossh -M 20000 -p SSH_PORT -N -D 7070 YOUR_NAME@YOUR_SERVER
set timeout 60
expect {
     assword: {
         stty -echo
         send &quot;YOUR_PASS\r&quot;
         stty echo
         #exp_continue
     }
    incorrect {
         send_user &quot;invalid password or account\n&quot;
         exit
     }
    timeout {
         send_user &quot;connection to host timed out\n&quot;
         exit
     }
    eof {
         send_user &quot;connection to host failed\n&quot;
         exit
     }
}
if {[fork]!=0} exit
disconnect</pre></div></div>

<p>那里面那个 autossh 能自动给你重连，没仔细研究。那个 20000 后面的参数都是给 ssh 的，具体含意可以看 ssh 的 man。</p>
<p>最主要是最后那两行，能做到连接上之后主程序就退出了，不占用你的终端，而不影响 ssh 的连接。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/autossh-and-auto-enter-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ssh 之穿越与反穿越</title>
		<link>http://wdicc.com/ssh-proxy/</link>
		<comments>http://wdicc.com/ssh-proxy/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 07:09:45 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://wdicc.com/ssh-proxy/</guid>
		<description><![CDATA[有时候我们不得不和网管对着干，去想办法去穿越某些防火墙，访问到我们要访问的资源。例如下面的情况，A 和 C 之间是有个墙的，不通。可有个 B 能访问到 C，而 A 又能访问到 B ，那我们可以通过你 ssh 做代理穿越那个墙。 A -&#62; &#124; -&#62; C \-&#62; B -&#62; C 在A 上面执行下面的命令 ssh -f -N -g -L 8888:C_ip:80 B_ip参数的含义：-f 放到后台-N 不在对方机器请求 shell-g 能使得别的机器能连接 A 的那个端口-L 就是代理，具体看 man 这样，在 A 上面访问 8888 端口，就能访问到 C 的 80 端口了。 那如果是下面的网络情况，那怎么办？A 能访问到 C，但是 C 不能直接访问 A。 A [...]]]></description>
			<content:encoded><![CDATA[<p>有时候我们不得不和网管对着干，去想办法去穿越某些防火墙，访问到我们要访问的资源。例如下面的情况，A 和 C 之间是有个墙的，不通。可有个 B 能访问到 C，而 A 又能访问到 B ，那我们可以通过你 ssh 做代理穿越那个墙。</p>
<p>A -&gt; | -&gt; C<br /> \-&gt; B -&gt; C</p>
<p>在A 上面执行下面的命令</p>
<p>ssh -f -N -g -L 8888:C_ip:80 B_ip<br />参数的含义：-f 放到后台<br />-N 不在对方机器请求 shell<br />-g 能使得别的机器能连接 A 的那个端口<br />-L 就是代理，具体看 man </p>
<p>这样，在 A 上面访问 8888 端口，就能访问到 C 的 80 端口了。</p>
<p>那如果是下面的网络情况，那怎么办？A 能访问到 C，但是 C 不能直接访问 A。</p>
<p>A -&gt; C<br />C-&gt; | -&gt; A</p>
<p>在 A 上面执行下面的命令</p>
<p>ssh -f -N -R 9999:A_ip:80 C_ip<br />-R 是反向代理, -g 在这里好像不好用不知道为什么</p>
<p>从 C 上面访问自己的 9999 端口，就会访问到 A 的 80 端口。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/ssh-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NB 的 ssh proxycommand</title>
		<link>http://wdicc.com/cow-ssh-proxycommand/</link>
		<comments>http://wdicc.com/cow-ssh-proxycommand/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 03:32:37 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxycommand]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://wdicc.com/?p=643</guid>
		<description><![CDATA[是从水木上面学来的。还参考了这个。 如果你工作的环境是下面这样的，那 ssh 的 proxycommand 对你会很有用。 your pc -> gw server -> work server 一般公司的服务器的网络都会设置安全级别，防止出现安全问题。那个 gw 也叫跳板机。需要在 gw 机器上面有 nc 。 修改 .ssh/config 文件，加上 Host gw Hostname gw.abc.com Host work Hostname work.abc.com User wd ProxyCommand ssh gw nc -q 0 %h %p 2>/dev/null 这样直接 ssh work 就好了。 那个 -q 0 可能有些版本的 nc 不支持。去掉就好了。那个 %h 表示 [...]]]></description>
			<content:encoded><![CDATA[<p>是从水木上面学来的。还参考了<a href="http://benno.id.au/blog/2006/06/08/ssh_proxy_command">这个</a>。</p>
<p>如果你工作的环境是下面这样的，那 ssh 的 proxycommand 对你会很有用。</p>
<p>your pc -> gw server -> work server</p>
<p>一般公司的服务器的网络都会设置安全级别，防止出现安全问题。那个 gw 也叫跳板机。需要在 gw 机器上面有 nc 。</p>
<p>修改 .ssh/config 文件，加上<br />
Host gw<br />
  Hostname gw.abc.com</p>
<p>Host work<br />
  Hostname work.abc.com<br />
  User wd<br />
  ProxyCommand ssh gw nc -q 0 %h %p 2>/dev/null</p>
<p>这样直接 ssh work 就好了。</p>
<p>那个 -q 0 可能有些版本的 nc 不支持。去掉就好了。那个 %h 表示 hostname，那个 %p 表示 port，可以直接写死。其它的 man ssh_config 吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/cow-ssh-proxycommand/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>使用公匙密匙来登录ssh</title>
		<link>http://wdicc.com/public-key-in-ssh/</link>
		<comments>http://wdicc.com/public-key-in-ssh/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 03:19:35 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[urxvt]]></category>
		<category><![CDATA[公匙]]></category>
		<category><![CDATA[密匙]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/2006/09/26/249/</guid>
		<description><![CDATA[ssh一种更加安全的登录方式是使用rsa/dsa方式来做验证。密码口令很可能被猜出来，但是用dsa方式验证的ssh，除非他弄到你的私匙，否则肯定是安全的。 ssh-keygen命令可以用来生成rsa/dsa方式的公匙密匙。 ssh-keygen或者ssh-keygen -t rsa生成rsa方式的密匙。ssh-keygen -d 或者 ssh-keygen -t dsa生成dsa方式的密匙。具体rsa和dsa的区别看 这里 。 上面的命令会在~/.ssh文件夹中生成公匙（id_*sa.pub）和密匙（id_*sa），将pub文件中的内容copy到远程服务器你的home目录下面的.ssh目录中的authorized_keys[2]这个文件中，有没有最后的那个2要看你用的是ssh1还是ssh2方式，通常都有2。 然后就是远程服务器的这些文件需要有正确的权限，.ssh目录是700，authorized_keys2文件是644。 此后再登录服务器的时候应该就不需要输入密码了。 有一个小tip，就是给服务器的ip设置一个好记的形式，那么多的ip记住不容易阿，而且每次还得一个一个输入。具体方法就是修改hosts文件，添加类似下面的内容就可以了，相当于自己做了一个dns，呵呵。 #销售server 218.x.2.128 s128 xs xiaoshou #db server 218.x.23.189 s189 db oracle 这样，以后访问s128或者s189就可以了，当然后面的xs、xiaoshou、db、oracle也都是别名，都可以用来访问。 还有一个tip，是关于term的。如果用的是urxvt，访问的远程服务器的时候可能会遇到“unknow terminal : rxvt-unicode” 类似的错误，如果出现了类似错误，会导致在服务器端vim和ls都没有颜色。解决方法是在.Xdefaults文件中添加URxvt.termName: xterm，或者.bash_profile里面自己设置一下TERM类型。]]></description>
			<content:encoded><![CDATA[<p>ssh一种更加安全的登录方式是使用rsa/dsa方式来做验证。密码口令很可能被猜出来，但是用dsa方式验证的ssh，除非他弄到你的私匙，否则肯定是安全的。</p>
<p>ssh-keygen命令可以用来生成rsa/dsa方式的公匙密匙。<br />
ssh-keygen或者ssh-keygen -t rsa生成rsa方式的密匙。ssh-keygen -d 或者 ssh-keygen -t dsa生成dsa方式的密匙。具体rsa和dsa的区别看 <a href="http://www-128.ibm.com/developerworks/cn/linux/security/openssh/part1/index.html">这里</a> 。</p>
<p>上面的命令会在~/.ssh文件夹中生成公匙（id_*sa.pub）和密匙（id_*sa），将pub文件中的内容copy到远程服务器你的home目录下面的.ssh目录中的authorized_keys[2]这个文件中，有没有最后的那个2要看你用的是ssh1还是ssh2方式，通常都有2。</p>
<p>然后就是远程服务器的这些文件需要有正确的权限，.ssh目录是700，authorized_keys2文件是644。</p>
<p>此后再登录服务器的时候应该就不需要输入密码了。</p>
<p>有一个小tip，就是给服务器的ip设置一个好记的形式，那么多的ip记住不容易阿，而且每次还得一个一个输入。具体方法就是修改hosts文件，添加类似下面的内容就可以了，相当于自己做了一个dns，呵呵。<br />
#销售server<br />
218.x.2.128 s128 xs xiaoshou<br />
#db server<br />
218.x.23.189 s189 db oracle<br />
这样，以后访问s128或者s189就可以了，当然后面的xs、xiaoshou、db、oracle也都是别名，都可以用来访问。</p>
<p>还有一个tip，是关于term的。如果用的是urxvt，访问的远程服务器的时候可能会遇到“unknow terminal : rxvt-unicode” 类似的错误，如果出现了类似错误，会导致在服务器端vim和ls都没有颜色。解决方法是在.Xdefaults文件中添加URxvt.termName: xterm，或者.bash_profile里面自己设置一下TERM类型。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/public-key-in-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用ssh的rsa和dsa验证登陆linux</title>
		<link>http://wdicc.com/use-rsa-and-dsa/</link>
		<comments>http://wdicc.com/use-rsa-and-dsa/#comments</comments>
		<pubDate>Mon, 24 Apr 2006 16:49:17 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/?p=151</guid>
		<description><![CDATA[参考地址：http://www.5ilinux.com/ssh01.html 按照文档中的方法，使用SecureCRT生成公匙密匙，然后上传公匙，没问题。 用putty使用这个密匙的时候就出问题了，验证不了。 然后用putty生成公匙密匙，上传公匙，验证不了。 后来用openssh自带的ssh-keygen生成了公匙密匙，然后用putty的keygen转换了一下，用putty登陆就可以了。]]></description>
			<content:encoded><![CDATA[<p>参考地址：http://www.5ilinux.com/ssh01.html</p>
<p>按照文档中的方法，使用SecureCRT生成公匙密匙，然后上传公匙，没问题。</p>
<p>用putty使用这个密匙的时候就出问题了，验证不了。</p>
<p>然后用putty生成公匙密匙，上传公匙，验证不了。</p>
<p>后来用openssh自带的ssh-keygen生成了公匙密匙，然后用putty的keygen转换了一下，用putty登陆就可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/use-rsa-and-dsa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>限制ssh访问的ip</title>
		<link>http://wdicc.com/limite-ssh-access-ip/</link>
		<comments>http://wdicc.com/limite-ssh-access-ip/#comments</comments>
		<pubDate>Mon, 24 Apr 2006 16:43:45 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/?p=150</guid>
		<description><![CDATA[★ 需求 最近公司服务器上面某个用户的帐号密码被修改了好几次。查看了一下，确实有人用他的帐号从外网ip（国外的ip）登陆过，猜想可能是他自己的电脑中木马或者什么病毒了。用户自己没有安全意识是很头痛的一个问题，其实给他们新建帐号的时候使用的都是简单密码，但是似乎都没有人上服务器自己修改，但是你又不能要求你的用户如何如何（比如给自己电脑装防火墙、杀毒软件etc），因为那是人家自己的事情。那么我就想，有没有一个方法可以限制某个用户只能从某个ip（或者ip列表）登陆呢？下面是一些解决方法。 ★ 解决方案 1) 通过修改/etc/ssh/sshd_config文件，让sshd只监听内网ip。这样只有内网ip才能登陆ssh。但是这样的话就不能远程维护服务器了，有点得不偿失得感觉。 2) 通过修改/etc/hosts.allow和/etc/hosts.deny来限制某个ip的登陆。这个方式其实和上面得类似，你也不知道hacker会从哪个ip登陆，所以你没办法deny他得ip，deny他得时候可能连你自己也deny了。 3) 可以通过/etc/ssh/sshd_config文件来实现。 &#160; &#160; AllowUsers &#160; &#160; &#160; &#160; &#160; &#160; This keyword can be followed by a list of user name patterns, &#160; &#160; &#160; &#160; &#160; &#160; separated by spaces.&#160; If specified, login is allowed only for us- &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>★ 需求</p>
<p>最近公司服务器上面某个用户的帐号密码被修改了好几次。查看了一下，确实有人用他的帐号从外网ip（国外的ip）登陆过，猜想可能是他自己的电脑中木马或者什么病毒了。用户自己没有安全意识是很头痛的一个问题，其实给他们新建帐号的时候使用的都是简单密码，但是似乎都没有人上服务器自己修改，但是你又不能要求你的用户如何如何（比如给自己电脑装防火墙、杀毒软件etc），因为那是人家自己的事情。那么我就想，有没有一个方法可以限制某个用户只能从某个ip（或者ip列表）登陆呢？下面是一些解决方法。</p>
<p><span id="more-150"></span>★ 解决方案</p>
<p>1) 通过修改/etc/ssh/sshd_config文件，让sshd只监听内网ip。这样只有内网ip才能登陆ssh。但是这样的话就不能远程维护服务器了，有点得不偿失得感觉。</p>
<p>2) 通过修改/etc/hosts.allow和/etc/hosts.deny来限制某个ip的登陆。这个方式其实和上面得类似，你也不知道hacker会从哪个ip登陆，所以你没办法deny他得ip，deny他得时候可能连你自己也deny了。</p>
<p>3) 可以通过/etc/ssh/sshd_config文件来实现。</p>
<p> &nbsp; &nbsp; AllowUsers<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This keyword can be followed by a list of user name patterns,<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; separated by spaces.&nbsp; If specified, login is allowed only for us-<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; er names that match one of the patterns.&nbsp; Only user names are<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; valid; a numerical user ID is not recognized.&nbsp; By default, login<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is allowed for all users.&nbsp; If the pattern takes the form US-<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ER@HOST then USER and HOST are separately checked, restricting<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logins to particular users from particular hosts.&nbsp; The allow/deny<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directives are processed in the following order: DenyUsers,<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllowUsers, DenyGroups, and finally AllowGroups.</p>
<p>PATTERNS<br />
 &nbsp; &nbsp; A pattern consists of zero or more non-whitespace characters, `*&#8217; (a<br />
 &nbsp; &nbsp; wildcard that matches zero or more characters), or `?&#8217; (a wildcard that<br />
 &nbsp; &nbsp; matches exactly one character).&nbsp; For example, to specify a set of decla-<br />
 &nbsp; &nbsp; rations for any host in the “.co.uk” set of domains, the following pat-<br />
 &nbsp; &nbsp; tern could be used:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host *.co.uk</p>
<p> &nbsp; &nbsp; The following pattern would match any host in the 192.168.0.[0-9] network<br />
 &nbsp; &nbsp; range:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host 192.168.0.?</p>
<p> &nbsp; &nbsp; A pattern-list is a comma-separated list of patterns.&nbsp; Patterns within<br />
 &nbsp; &nbsp; pattern-lists may be negated by preceding them with an exclamation mark<br />
 &nbsp; &nbsp; (`!&#8217;).&nbsp; For example, to allow a key to be used from anywhere within an<br />
 &nbsp; &nbsp; organisation except from the “dialup” pool, the following entry (in au-<br />
 &nbsp; &nbsp; thorized_keys) could be used:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from=”!*.dialup.example.com,*.example.com”</p>
<p>比如不允许test用户从192.168.0.x登陆，那么可以添加一行</p>
<p>denyusers test@192.168.0.</p>
<p>按照上面的PATTERNS说明，似乎可以加叹号来排除某个ip，但是尝试过没有成功，不知道什么原因了。</p>
<p>按照文档，deny是级别最高的，而设置了allow之后，就只能allow的用户访问了，所以如果想限制某个用户只能从某个ip段登陆，用这个似乎实现不了。</p>
<p>4) 使用ssh得RSA/DSA key。</p>
<p>参考地址:http://www.5ilinux.com/ssh01.html </p>
<p>用ssh-keygen命令生成一对公匙密匙，然后把密匙给用户，并且限制ssh只能通过RSA方式认证。这样会导致所有ssh用户都得用这种方式登陆了，会更加郁闷。</p>
<p>这种方式可以在用户得authorized_keys2文件中，加入from=”!192.168.1.158,*”来让用户只能通过158登陆。（这个没有做过验证）</p>
<p>PATTERNS<br />
 &nbsp; &nbsp; A pattern consists of zero or more non-whitespace characters, `*&#8217; (a<br />
 &nbsp; &nbsp; wildcard that matches zero or more characters), or `?&#8217; (a wildcard that<br />
 &nbsp; &nbsp; matches exactly one character).&nbsp; For example, to specify a set of decla-<br />
 &nbsp; &nbsp; rations for any host in the “.co.uk” set of domains, the following pat-<br />
 &nbsp; &nbsp; tern could be used:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host *.co.uk</p>
<p> &nbsp; &nbsp; The following pattern would match any host in the 192.168.0.[0-9] network<br />
 &nbsp; &nbsp; range:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host 192.168.0.?</p>
<p> &nbsp; &nbsp; A pattern-list is a comma-separated list of patterns.&nbsp; Patterns within<br />
 &nbsp; &nbsp; pattern-lists may be negated by preceding them with an exclamation mark<br />
 &nbsp; &nbsp; (`!&#8217;).&nbsp; For example, to allow a key to be used from anywhere within an<br />
 &nbsp; &nbsp; organisation except from the “dialup” pool, the following entry (in au-<br />
 &nbsp; &nbsp; thorized_keys) could be used:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from=”!*.dialup.example.com,*.example.com”</p>
<p>5) 用pam。</p>
<p>参考地址:http://www.linuxmine.com/1078.html </p>
<p>看看/etc/pam.d/login文件，有没有pam_access.so的设置。我的debian系统中，ssh相关的都在/etc/pam.d/ssh文件中设置。加入一行</p>
<p>account&nbsp; required &nbsp; &nbsp; &nbsp; pam_access.so</p>
<p>然后修改他的配置文件/etc/security/access.conf文件。加入一行</p>
<p>-:wd:192.168.1. EXCEPT 192.168.1.158</p>
<p>这样，wd用户从192.168.1.x（192.168.1.158除外）的登陆权限被去掉了。也就是说，wd这个用户就只能从158这个ip以及外网ip登陆了。</p>
<p>大功告成。 <img src='http://wdicc.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/limite-ssh-access-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

