<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1529329444272949524</id><updated>2024-11-01T03:56:50.325-07:00</updated><category term="Linux OS"/><category term="Python"/><category term="WebServer"/><category term="生活"/><category term="Django"/><category term="VPN"/><category term="电脑故障"/><category term="IT应用"/><category term="社会政治"/><category term="Code"/><category term="PHP"/><category term="VM"/><category term="blog google adsense"/><category term="wordpress"/><category term="多线程、学习"/><category term="投资"/><category term="电影"/><title type='text'>消逝的足迹，成长的路</title><subtitle type='html'>给自己重新开始的勇气！</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default?start-index=26&amp;max-results=25'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-9001385242978037044</id><published>2012-04-05T07:24:00.002-07:00</published><updated>2012-04-05T07:24:59.200-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="wordpress"/><title type='text'>再次恢复WP成功…</title><content type='html'>&lt;div style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #112032; font-family: Tahoma, Verdana, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 5px; padding-left: 0px; padding-right: 0px; padding-top: 5px;&quot;&gt;许久不用，发现原先使用的免费主机访问越来越慢了。 想再找个免费主机， 发现主机倒不少， 只是貌似绝大部分都将fsock给禁了，不爽…&lt;/div&gt;&lt;div style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #112032; font-family: Tahoma, Verdana, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 5px; padding-left: 0px; padding-right: 0px; padding-top: 5px;&quot;&gt;想起来还有个1年免费的EC2， 还有4个月到期，果断移过来～&lt;/div&gt;&lt;div style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #112032; font-family: Tahoma, Verdana, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 5px; padding-left: 0px; padding-right: 0px; padding-top: 5px;&quot;&gt;安装apache, php, wordpress… &amp;nbsp;备份再phpMyAdmin恢复MySQL，完成之后打开首页空白， 但后台看数据却是OK的，不明白神马情况。&lt;/div&gt;&lt;div style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #112032; font-family: Tahoma, Verdana, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 5px; padding-left: 0px; padding-right: 0px; padding-top: 5px;&quot;&gt;尝试后台下了个主题，换主题成功，再看，首页也OK了，数据恢复成功。 Over.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/9001385242978037044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/9001385242978037044' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/9001385242978037044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/9001385242978037044'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2012/04/wp.html' title='再次恢复WP成功…'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-4759211496460132019</id><published>2011-04-09T01:03:00.000-07:00</published><updated>2011-04-09T01:05:33.851-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><title type='text'>单独运行一个Django程序</title><content type='html'>&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;我需要运行一个单独的里程，定时从我的Django工程User数据库中取出信息，作一些操作。比如每天看是否有用户超时，等等。 因为你不是通过apache + mod_python 去访问的，所以需要手动在程序的开始import settings, &amp;nbsp;有两种方式：&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;1.&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px; line-height: normal;&quot;&gt;&lt;u&gt;Python语言&lt;/u&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;source&quot; style=&quot;background-color: #f9f7ed; color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;from&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #00aaaa; text-decoration: underline;&quot;&gt;django.conf&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;settings&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;settings&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;configure&lt;/span&gt;(&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_ENGINE&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;sqlite3&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_NAME&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;/var/www/vpn_ssh/proxy/database/register.db&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_USER&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aaaaaa; font-style: italic;&quot;&gt;# Not used with sqlite3.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_PASSWORD&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aaaaaa; font-style: italic;&quot;&gt;# Not used with sqlite3.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_HOST&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aaaaaa; font-style: italic;&quot;&gt;# Set to empty string for localhost. Not used with sqlite3.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;DATABASE_PORT&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aaaaaa; font-style: italic;&quot;&gt;# Set to empty string for default. Not used with sqlite3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;AUTH_PROFILE_MODULE&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #aa5500;&quot;&gt;&#39;register.SSH_User&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
)&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;内容从你原先工程里copy过来就OK了，要啥copy啥。&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;2.&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px; line-height: normal;&quot;&gt;&lt;u&gt;Python语言&lt;/u&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;source&quot; style=&quot;background-color: #f9f7ed; color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #00aaaa; text-decoration: underline;&quot;&gt;django.core.management&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;from&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #00aaaa; text-decoration: underline;&quot;&gt;foo&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;settings&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;django&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;core&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;management&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;setup_environ&lt;/span&gt;(&lt;span style=&quot;color: black;&quot;&gt;settings&lt;/span&gt;)&lt;/div&gt;直接import 你原先的settings，但我总把路径搞错，就采取了第一种比较直白的方式了。。。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 上面的搞定，就可以从原先工程里读取到用户数据了。不过我的工程里User使用profile进行扩展了，得到user对象后需要使用user.get_profile来取一下，结果取到个异常——SiteProfileNotAvailable， google半天， 貌似是需要在settings里加一个常量&lt;br /&gt;
AUTH_PROFILE_MODULE = &#39;register.SSH_User&#39;&lt;br /&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;直接加到文件头部的数组里，加完跑了一下，还是这个错。。。挠头。。。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;看看原先的工程里settings里面是没有这个值的，只在使用的时候，import register.SSH_User.&lt;br /&gt;
&lt;br /&gt;
模仿一把，把前面AUTH_PROFILE_MODULE从settings里去掉，加了个import。 还是有错。&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; font-size: 13px; line-height: 19px;&quot;&gt;纳闷老半天，又把AUTH_PROFILE_MODULE加上, 最终，二者同时存在的时候可以了。。。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/4759211496460132019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/4759211496460132019' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4759211496460132019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4759211496460132019'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/04/django.html' title='单独运行一个Django程序'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-2373560612060245445</id><published>2011-03-31T06:54:00.001-07:00</published><updated>2011-03-31T06:54:45.385-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="电脑故障"/><title type='text'>U盘安装Win7, Win7PE修复启动</title><content type='html'>&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font: normal normal normal 13px/19px Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.6em; padding-left: 0.6em; padding-right: 0.6em; padding-top: 0.6em;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MM买了一个ThinkPad E10. &amp;nbsp;预装WIN7 HOME版，正版的WIN7 HOME， 竟然无法更新，一开机先装更新，再还原更新，开个机要10分钟。。。受不鸟了，格了装“旗舰版”。 由于没有光驱，只能用U盘了。&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 不想网上说的那么麻烦，直接把一个带WINPE的Ghost WIN7 ISO 用UtralISO 刻录到U盘上。 选择USB－HDD+， 我同时在“便捷启动”里选择了写入WIN7/VISTA MBR， 貌似不写也成。 然后把本子设置成USB启动，或者临时选择USB设备启动都行。&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;进入WINPE系统之后，将GHOST镜像写到C盘， 很快搞定， 满心欢喜的重启，—— 找不到操作系统... 才想起来刚刚为了分区把引导分区删除了。用WINPE自带的启动项修复功能，没效果。google得知，需要WIN7PE来修复。&lt;br /&gt;
WIN7PE，推荐去下雨林木风的，&lt;a _mce_href=&quot;http://www.ylmf.asia/catalog.asp?tags=WIN7PE&quot; href=&quot;http://www.ylmf.asia/catalog.asp?tags=WIN7PE&quot;&gt;http://www.ylmf.asia/catalog.asp?tags=WIN7PE&lt;/a&gt;&amp;nbsp;有很多版本。&lt;br /&gt;
进入系统后， 在菜单里找到启动项修复，修复一下，OK了。 &amp;nbsp;去掉乱七8糟的东西之后，速度还算差强人意。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/2373560612060245445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/2373560612060245445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2373560612060245445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2373560612060245445'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/uwin7-win7pe.html' title='U盘安装Win7, Win7PE修复启动'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-2209237119822744531</id><published>2011-03-28T07:22:00.001-07:00</published><updated>2011-03-28T07:22:50.817-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Django 开发支付宝应用遇到的一些问题</title><content type='html'>&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;用Django开发了一个使用支付宝的应用。有些问题，迷惑了我好几天。。。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;我使用的是Django + Apache + mod_python.&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;1. 修改过代码，需要重启Apache, 因为使用mod_python貌似不会自动load&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;2. 支付完成之后，支付宝会调用notify_url, &amp;nbsp;并返回一些信息，可以根据这些信息判断是哪个订单支付成功了，多少钱，等等。 此时发现一个问题，处理notify_url请求的代码，修改之后总是不生效。其他部分代码重启Apache之后都立即生效了。开始总以为函数没有调用。 后来发现本地访问这个URL的时候，修改是生效的。猜测，支付宝端缓存了。不过没想明白，脚本应该是在服务器端执行的才对啊，纳闷中。。。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;3. 后来找到规律，修改大概等个几分钟就生效了。 于是每次都等，真是够呆的…. 这样调了两天，突然某次修改，发现等了半小时还没生效，以为见鬼了。 后来发现是脚本出错了，执行根本不成功。因为有个坏习惯，调试把DEBUG设成ON。于是认为有错，必然在访问的时候报出来。只是意识到，出错在访问都的浏览器里才能看到，而这次访问都不是我。。。这习惯得改&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;这几个问题折腾我好几天，看得见的BUG好改，看不见的就比较麻烦的。编程习惯相当重要。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/2209237119822744531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/2209237119822744531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2209237119822744531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2209237119822744531'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/django.html' title='Django 开发支付宝应用遇到的一些问题'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-3322221278751937090</id><published>2011-03-27T01:23:00.001-07:00</published><updated>2011-03-27T01:23:19.327-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="电影"/><title type='text'>推荐一部电影－－守望者：罪恶迷途</title><content type='html'>&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;a href=&quot;http://innercalm.info/wp-content/uploads/2011/03/U2520P28T3D3247480F326DT20110307152657.jpg&quot; style=&quot;color: #44a1d0; text-decoration: underline;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-178&quot; height=&quot;373&quot; src=&quot;http://innercalm.info/wp-content/uploads/2011/03/U2520P28T3D3247480F326DT20110307152657.jpg&quot; style=&quot;border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial;&quot; title=&quot;守望者&quot; width=&quot;550&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;人生的事，过去往往比将来更出人意料。留一点余地，也留一次回头看看的机会。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;近期难得的国产好电影，只是旁边坐一对小夫妻，不停的说“这是他长这么大看过的最烂的一部电影”，“不就是倒序么”。。。 &amp;nbsp; &amp;nbsp;这让我想起前段时间一个新闻——某人在电影院开枪杀了一哥们，原因是这哥们吃爆米花太大声。。。 &amp;nbsp;所以还是安分点的好，不喜欢看，可以走么。。。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;个人以为相当值得去电影院一看，好电影是需要行动支持的。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/3322221278751937090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/3322221278751937090' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3322221278751937090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3322221278751937090'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/blog-post.html' title='推荐一部电影－－守望者：罪恶迷途'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-7335074016206173324</id><published>2011-03-25T05:36:00.000-07:00</published><updated>2011-03-25T05:53:16.215-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>wordpress 3.1 Memory exhousted</title><content type='html'>&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;Today after I install wordpress plugin “All in one SEO”, and try to active it, I got an&amp;nbsp;&lt;span style=&quot;color: #333399;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;“Fatal error: Allowed memory size of 33554432 bytes exhausted”&lt;/span&gt;.&lt;/span&gt;&amp;nbsp;After google, find the an answer that only have to change the&lt;span style=&quot;color: navy;&quot;&gt;&amp;nbsp;“WP_MEMORY_LIMIT”&amp;nbsp;&lt;/span&gt;value in&amp;nbsp;&lt;span style=&quot;color: navy;&quot;&gt;/public_html/wp-setting.php&lt;/span&gt;&amp;nbsp;from 32M to 64M or some other bigger value.&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;But I can find “WP_MEMORY_LIMIT” in my wp-setting.php…&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;After reading the code, find that in wordpress 3.1, the constant is initialize in&lt;span style=&quot;color: navy;&quot;&gt;&amp;nbsp;“wp_initial_constants”&amp;nbsp;&lt;/span&gt;which can &amp;nbsp;be found&amp;nbsp;/public_html/wp-includes/default-constants.php.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: Simsun; line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: Simsun; line-height: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;1&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;// set memory limits&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;2&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;if ( !defined(&#39;WP_MEMORY_LIMIT&#39;) ) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;3&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( is_multisite() ) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;4&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define(&#39;WP_MEMORY_LIMIT&#39;, &#39;64M&#39;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #f810b0;&quot;&gt;5&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;6&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define(&#39;WP_MEMORY_LIMIT&#39;, &#39;32M&#39;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;7&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;8&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: Simsun; line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: Simsun; line-height: normal;&quot;&gt;Change the 32M to 64M or 128M, update the file. Then Login, Everything works as before.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/7335074016206173324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/7335074016206173324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/7335074016206173324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/7335074016206173324'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/wordpress-31-memory-exhousted.html' title='wordpress 3.1 Memory exhousted'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-3425804021398047506</id><published>2011-03-23T05:20:00.000-07:00</published><updated>2011-03-23T05:20:35.273-07:00</updated><title type='text'>gvim菜单不显示或者乱码问题(转)</title><content type='html'>&quot;在~/.gvimrc下加入这几句 (如果没有此文件，可以新建一个)&lt;br /&gt;set encoding=2byte-cp936&lt;br /&gt;source $VIMRUNTIME/delmenu.vim&lt;br /&gt;set langmenu=zh_CN.GB2312&lt;br /&gt;source $VIMRUNTIME/menu.vim&lt;br /&gt;set imcmdline&quot;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/3425804021398047506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/3425804021398047506' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3425804021398047506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3425804021398047506'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/gvim.html' title='gvim菜单不显示或者乱码问题(转)'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-690578759993705964</id><published>2011-03-19T00:04:00.001-07:00</published><updated>2011-03-19T00:04:31.893-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="生活"/><title type='text'>Blog搬家到innercalm.info</title><content type='html'>&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;最近不知道怎么又有了折腾下wordpress的欲望，其实blogpspot已经可以满足我的需求，只是“折腾是必须的”。 &amp;nbsp;上次折腾的的时候还是在好几年前，那时还没钱，借了花的钱来买域名和空间，差点还忘记还。。。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;现如今有工资了，然尔国内的空间已经不像以前那么方便了，手续一大堆，对于折腾的我来说，未免太过麻烦。于是想去国外买个，毕竟人家那还是开放的。 打听到godaddy经济实惠，于是买之，后来发现，在godaddy分到一个“合法”的IP是多么的困难。 又不想买个单独的IP，于是再退款…悲剧。话说人家信誉还是不错的，主机的钱如数退还，只是域名的不退，正好接着用。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;后来发现Host1Free的免费主机其实蛮不错的，德国的，功能基本都有，跑个wordpress完全够用，访问速度也还不错。 所谓塞翁失马，焉知非福。。。&lt;/div&gt;&lt;div style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;目前为止，安装完成，插件也装得差不多了。 选域名为innercalm是希望可以改掉自己浮躁的毛病，以些为一个（第N个）开始，一直向前。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/690578759993705964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/690578759993705964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/690578759993705964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/690578759993705964'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/bloginnercalminfo.html' title='Blog搬家到innercalm.info'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-8193785624067030515</id><published>2011-03-19T00:02:00.000-07:00</published><updated>2011-03-19T00:02:02.652-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>pexpect : pty.fork() failed: out of pty devices  sloved(问题解决)</title><content type='html'>&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font: normal normal normal 13px/19px Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.6em; padding-left: 0.6em; padding-right: 0.6em; padding-top: 0.6em;&quot;&gt;使用python, pexpect模块来执行系统命令, 但换到一个新的环境下的时候，发现执行 pexpect.spawn(&quot;xxx&quot;)的时候报异常了，错误为：&lt;br /&gt;
&lt;strong&gt;&lt;span _mce_style=&quot;color: #993300;&quot; style=&quot;color: #993300;&quot;&gt;pty.fork() failed: out of pty devices&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
操作系统的版本是一样的，都是CentOS 5.5, 猜测可能是系统配置的问题，后来发现果然是这样。&lt;br /&gt;
原因是没有挂载pts&lt;br /&gt;
&lt;span _mce_style=&quot;color: #993300;&quot; style=&quot;color: #993300;&quot;&gt;&lt;strong&gt;mount -vt devpts devpts /dev/pts&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
Over!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/8193785624067030515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/8193785624067030515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/8193785624067030515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/8193785624067030515'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/pexpect-ptyfork-failed-out-of-pty.html' title='pexpect : pty.fork() failed: out of pty devices  sloved(问题解决)'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-3898023482701697079</id><published>2011-03-06T03:35:00.000-08:00</published><updated>2011-03-06T03:35:04.256-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>CentOS + L2TP/IPSec + FreeRadius 教程 ( 五 ) -- FreeRadius Expiration</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp;前面设置了流量统计器来做用户认证的, 用户使用超过限制的流量之后,认证就会失败. 但没有在时间上对用户作为限制. freeradius提供了一个密码过期的功能.默认已经启用了,可以在&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;/etc/raddb/sites-enabled/default &amp;nbsp;里的 authroize 可以查到 expiration这一项, 证明这项认证已经启动了.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;freeradius会在用户登录的时候, 查找用户是否有Expiration的Atrributes. 如果有, 则将登录时间(获取当前系统时间) 与用户Expiration 的时间比较.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;所以如果想让某个用户在某一时间密码不再有效, 只需要在radius数据库中的radcheck中增加一条记录.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px;&quot;&gt;&lt;u&gt;SQL语言&lt;/u&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;source&quot; style=&quot;background-color: #f9f7ed; color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;INSERT&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;INTO&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;radius&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;radcheck&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&amp;nbsp;(&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;3&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;username&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;4&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;attribute&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #f810b0;&quot;&gt;5&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;op&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;6&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;`&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;7&lt;/span&gt;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;8&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;VALUES&lt;/span&gt;&amp;nbsp;(&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&#39;test&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&#39;Expiration&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&#39;==&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&#39;19 Mar 2011&#39;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
或者phpMyAdmin插入也一样.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYR0kpGnBroPsV_5u7-Xr_MpEWTraGz9c_EwZuD-ewmTdPGdlwrT0pnQAEPdTvdcqH_ISO3kdhqBWPfk4Cv6cHcEWlz4V0hjnxUfkDH69YYZF6r-j3RvOWwvhnWj1vtfg9OCFITX5S6kg/s1600/radius_expire.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYR0kpGnBroPsV_5u7-Xr_MpEWTraGz9c_EwZuD-ewmTdPGdlwrT0pnQAEPdTvdcqH_ISO3kdhqBWPfk4Cv6cHcEWlz4V0hjnxUfkDH69YYZF6r-j3RvOWwvhnWj1vtfg9OCFITX5S6kg/s640/radius_expire.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
然后, test用户在2011年三月19日就无法再登录了...&lt;br /&gt;
&lt;br /&gt;
注:感觉Expiration也可以配置在其他地方, 如某个配置文件中, 不一定非是数据库中. 无奈freeradius无详细文档,后续再研究...</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/3898023482701697079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/3898023482701697079' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3898023482701697079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3898023482701697079'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/centos-l2tpipsec-freeradius-freeradius.html' title='CentOS + L2TP/IPSec + FreeRadius 教程 ( 五 ) -- FreeRadius Expiration'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYR0kpGnBroPsV_5u7-Xr_MpEWTraGz9c_EwZuD-ewmTdPGdlwrT0pnQAEPdTvdcqH_ISO3kdhqBWPfk4Cv6cHcEWlz4V0hjnxUfkDH69YYZF6r-j3RvOWwvhnWj1vtfg9OCFITX5S6kg/s72-c/radius_expire.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-4653577984937457730</id><published>2011-03-04T23:51:00.000-08:00</published><updated>2011-03-04T23:51:23.469-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>CentOS + L2TP/IPSec + FreeRadius 教程 ( 四 ) -- 深入理解counter</title><content type='html'>&amp;nbsp;&amp;nbsp; 在前面的基础上, 已经安装好l2tp+freeradius了, 基本的流量控制也搞定了, 可以按月或按日来限制流量了,稍微深入研究下counter的功能..&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 以下面这个counter为例子,这个是个按月做流量限制的例子, 问题是如何以此为基础生成可以根据你所需要的时间长度来限制流量?&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: #fdfdfd; background-image: initial; background-origin: initial; color: black; font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px;&quot;&gt;&lt;u&gt;&lt;br /&gt;
&lt;/u&gt;&lt;/div&gt;&lt;div class=&quot;source&quot; style=&quot;background-color: #f9f7ed; color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;01&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;sqlcounter&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;monthlytrafficcounter&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;02&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;counter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;Monthly&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Traffic&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;03&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;check&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;Max&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Monthly&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Traffic&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;04&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reply&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;Monthly&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Traffic&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Limit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #f810b0;&quot;&gt;05&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;sqlmod&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;inst&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;sql&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;06&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;key&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;07&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reset&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;monthly&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;08&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;query&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&quot;SELECT (SUM(AcctInputOctets + AcctOutputOctets)) \&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;09&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM radacct WHERE UserName=&#39;%{%k}&#39; \&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #f810b0;&quot;&gt;10&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND UNIX_TIMESTAMP(AcctStartTime) &amp;gt; &#39;%b&#39;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;11&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;其实关键的问题就在reset这个字段, 上面这个例子里reset=monthly表示这个计数器会按月清空. 也就是说这些流量的统计会按月去清空一次. freeradius当然也提供了自定义的手段&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;我们可以将 reset的值改成我们想要的任意值.&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; 如:&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: #fdfdfd; background-image: initial; background-origin: initial; color: black; font-family: Consolas, &#39;Courier New&#39;, &#39;BitStream Vera Sans Mono&#39;, &#39;Lucida Console&#39;; font-size: 14px;&quot;&gt;&lt;u&gt;&lt;br /&gt;
&lt;/u&gt;&lt;/div&gt;&lt;div class=&quot;source&quot; style=&quot;background-color: #f9f7ed; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reset&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;h&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;#表示9小时&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reset&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;d&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;#表示9天&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;3&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reset&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;w&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;#表示9周&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px; line-height: normal;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;4&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;reset&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;m&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;#表示9个月&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px; line-height: normal;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;counter依旧用上面的代码应该没有问题,把里面相关名称改改就行. 详细的counter内容可以参考freeradius wiki的 &lt;a href=&quot;http://www.blogger.com/goog_1167058627&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: Verdana, Arial, sans-serif; font-weight: 800; line-height: 28px;&quot;&gt;&lt;a href=&quot;http://wiki.freeradius.org/Rlm_sqlcounter&quot;&gt;Rlm sqlcounter &lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;目前不知道用户超过流量之后, 有没有办法管理员及时知道,钩子之类的,再行研究吧...&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/4653577984937457730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/4653577984937457730' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4653577984937457730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4653577984937457730'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/centos-l2tpipsec-freeradius-counter.html' title='CentOS + L2TP/IPSec + FreeRadius 教程 ( 四 ) -- 深入理解counter'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-1495511126735391251</id><published>2011-03-04T04:49:00.000-08:00</published><updated>2011-03-04T04:49:04.448-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>CentOS + L2TP/IPSec + FreeRadius 教程 ( 三 ) -- 流量控制</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; 安装好&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 26px;&quot;&gt;&lt;a href=&quot;http://www.palfans.net/3-in-1-vpn-package/&quot; rel=&quot;bookmark&quot; style=&quot;color: #e64117; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; title=&quot;永久链接至：vpn三合一安装包 &quot;&gt;vpn三合一安装包&lt;/a&gt;的情况下, 我们就已经配置好了一个可以提供L2TP(OpenVPN, PPTP)+FreeRadius的服务器了, 可以在Windows下整一个客户端连接试试看是否成功.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 26px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 26px;&quot;&gt;&amp;nbsp;&amp;nbsp; 第二步是对用户的流量进行控制, 下面的步骤参考了&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;a href=&quot;https://blog.easisee.com/2010/09/freeradius-traffic-limit/&quot; style=&quot;font-weight: bold;&quot;&gt;FreeRADIUS 流量限制&lt;/a&gt;&amp;nbsp;这篇文章, 增加了自己理解的一部分内容.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 24px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 24px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;启用 Rlm sqlcounter&lt;/div&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: square; margin-bottom: 0px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;首先在 /etc/raddb/radiusd.conf ，去掉下面这一行的注释&lt;/div&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;$INCLUDE sql/mysql/counter.conf&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;#这里表示让freeradius启动counter(统计功能?)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;添加流量统计器&lt;/div&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: square; margin-bottom: 0px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;vim /etc/raddb/sql/mysql/counter.conf&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;在末尾添加如下代码&lt;/div&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;sqlcounter monthlytrafficcounter {&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;counter-name = Monthly-Traffic&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;check-name = Max-Monthly-Traffic&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;reply-name = Monthly-Traffic-Limit&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;sqlmod-inst = sql&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;key = User-Name&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;reset = monthly&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;query = &quot;SELECT (SUM(AcctInputOctets + AcctOutputOctets)) \&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FROM radacct WHERE UserName=&#39;%{%k}&#39; \&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;AND UNIX_TIMESTAMP(AcctStartTime) &amp;gt; &#39;%b&#39;&quot;&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;#这里是自定义的一个流量统计规则,例子中是按月统计. 可以看到query后面的那条SQL语句表示:从数据库的radacct表中,根据用户名将所有input和outpu流量累加&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;添加字典&lt;/div&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: square; margin-bottom: 0px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;vim /etc/raddb/dictionary&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;添加下面两行&lt;/div&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;ATTRIBUTE Max-Monthly-Traffic 3003 integer&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;ATTRIBUTE Monthly-Traffic-Limit 3004 integer&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;#增加字典,字典具体是干什么用的还不清楚,大概是将Max-Monthly-Traffic映射成一个integer的变量? 尚需研究下流程才能明白&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;启用Traffic Counter&lt;/div&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: square; margin-bottom: 0px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;vim /etc/raddb/sites-enabled/default&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;在authorize里添加monthlytrafficcounter(上面添加的流量统计器)，像下面这样&lt;/div&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;authorize {&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;...&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;monthlytrafficcounter&lt;/div&gt;&lt;div style=&quot;color: #333333; text-align: left;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;#这里是将刚刚定义的规则,加入到验证的的规则组中去,应该是表示用户接入时也会判断这个条件&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;添加CHECK ATTRIBUTE&lt;/div&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: square; margin-bottom: 0px; margin-left: 1.5em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;在数据库的radcheck(用户规则)里添加如下规则&lt;/div&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Max-Monthly-Traffic := 1073741824&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;// 1073741824 bytes=1 Gbyte, 填写时以byte为单位&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 24px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 24px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;这一步建议使用Web管理界面做，也方便以后管理&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;个人推荐用ARA (ASN RADIUS admin)，也可以用daloRADIUS&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;#这里我是直接用phpMyAdmin写入到MySQL数据库中的,因为两个Web管理都没用过,daloRadius摸不着头脑... 在radcheck表里插入如下项,表式给test用户每个月的流量是1G. 不过如其所说,这样不方便管理用户,应该学习下使用上述两个Web管理软件&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJK_J3PSuzK9nfN06mz97fMH2S20cfhNei0DqFTaegyjGIIzD5e4KHradpb_cUMZqjr3YyFXXF4g0lImSJrUPfK3s4I2wLlM7IhLKz545jb_fpDEI5QDsPxg45Au12Vkqo8bkEPFzyRjQ/s1600/sql_traffic_1g.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; color: #333333; float: left; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJK_J3PSuzK9nfN06mz97fMH2S20cfhNei0DqFTaegyjGIIzD5e4KHradpb_cUMZqjr3YyFXXF4g0lImSJrUPfK3s4I2wLlM7IhLKz545jb_fpDEI5QDsPxg45Au12Vkqo8bkEPFzyRjQ/s640/sql_traffic_1g.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;6. &amp;nbsp; 重启一下radiusd，万事大吉～&lt;/div&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; margin-bottom: 24px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;另外还要补充的一点是：&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;rlm sqlcounter的统计数据是在每次登陆时检查&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;因此使用过程中超流量不会强制下线，而是在下一次登陆时被拒绝&lt;/div&gt;&lt;div style=&quot;color: #333333; font-family: Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 16px; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; line-height: normal;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;#的确是登录是检查, 试了下设成1,用户就无法接入了.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; line-height: normal;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace;&quot;&gt;&lt;b&gt;到此, 初步的流量控制就OK了, 可以依照上面的流程再增加按年,按日限流量的,应该问题不大.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; line-height: normal;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Monaco, Consolas, &#39;Andale Mono&#39;, &#39;DejaVu Sans Mono&#39;, monospace; font-size: 13px; line-height: normal;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 27px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/1495511126735391251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/1495511126735391251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/1495511126735391251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/1495511126735391251'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/centos-l2tpipsec-freeradius_04.html' title='CentOS + L2TP/IPSec + FreeRadius 教程 ( 三 ) -- 流量控制'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJK_J3PSuzK9nfN06mz97fMH2S20cfhNei0DqFTaegyjGIIzD5e4KHradpb_cUMZqjr3YyFXXF4g0lImSJrUPfK3s4I2wLlM7IhLKz545jb_fpDEI5QDsPxg45Au12Vkqo8bkEPFzyRjQ/s72-c/sql_traffic_1g.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-2653398453657137591</id><published>2011-03-02T07:10:00.000-08:00</published><updated>2011-03-02T07:39:39.606-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="VM"/><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><title type='text'>CentOS + L2TP/IPSec + FreeRadius 教程 ( 二 )  -- VMWare+CentOS  PPTP 或L2TP 失败</title><content type='html'>&amp;nbsp;&amp;nbsp; 继续学习我的L2TP+FreeRadius, 自有想法之后, 即找到了异常强大的&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 18px; line-height: 26px;&quot;&gt;&lt;a href=&quot;http://www.palfans.net/3-in-1-vpn-package/&quot; rel=&quot;bookmark&quot; style=&quot;color: #e64117; font-weight: bold; outline-color: initial; outline-style: none; outline-width: initial;&quot; title=&quot;永久链接至：vpn三合一安装包 &quot;&gt;vpn三合一安装包&lt;/a&gt;&lt;/span&gt;,几乎一键搞定安装的所有事,省去诸多麻烦,实在需要致敬一下.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 装的很顺利,但当&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;我配置好HOST(WIN7)的客户端,设置好测试用户的时候,发现怎么都连接不上.先后试了PPTP和L2TP都是无法&lt;/span&gt;连接到服务器.. PPTP报Error:807, L2TP报Error:809, 搞了一晚上,快疯了.能查的都查:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; PING是通的&lt;br /&gt;
&amp;nbsp;&amp;nbsp; iptable设了&lt;br /&gt;
&lt;br /&gt;
后来实现没啥办法了,google之了,信息很少,偶然得到KB的的一篇文章:&lt;br /&gt;
&lt;br /&gt;
&lt;h1 style=&quot;color: #333333; font-family: Arial, Verdana, sans-serif; font-size: 12px; font-weight: bold; font: normal normal bold 17px/normal Arial, Verdana, sans-serif; line-height: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px; text-decoration: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://itknowledgeexchange.techtarget.com/virtualization-pro/vmware-network-drivers-do-not-pptp-or-l2tpass-go-do-not-collect-200/&quot; rel=&quot;bookmark&quot; style=&quot;color: #41627c; font: normal normal bold 17px/normal Arial, Verdana, sans-serif; text-decoration: underline;&quot; title=&quot;Permanent Link to VMware network drivers do not PPTP or L2tPass go. Do not collect $200!&quot;&gt;VMware network drivers do not PPTP or L2tPass go. Do not collect $200!&lt;/a&gt;&lt;/h1&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: Simsun; font-size: small; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;Landrew这哥们似乎花一个周末的时间, 发现可能是VMWare的虚拟网卡驱动对PPTP和L2TP的支持有问题...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;&amp;nbsp;上述结论仍待验证, 先去VPS上试试再说.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; line-height: 17px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;b&gt;已经验证, CentOS的防火墙干的,关掉防火墙再试, 一切OK. 脑子被驴踢了,浪费3个小时...&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/2653398453657137591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/2653398453657137591' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2653398453657137591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2653398453657137591'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/centos-l2tpipsec-freeradius.html' title='CentOS + L2TP/IPSec + FreeRadius 教程 ( 二 )  -- VMWare+CentOS  PPTP 或L2TP 失败'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-1757568512096149978</id><published>2011-03-01T06:31:00.000-08:00</published><updated>2011-03-01T06:31:22.489-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>python pexpect 增加用户失败分析 (adduser failed)</title><content type='html'>今日, 想使用下面一段代码利用 pexpect调用 useradd增加一个用户, 并设置组及过期时间等信息.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;source&quot;&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;01 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;pexpect&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;spawn&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;su&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;02 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;fout&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;file&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;/var/www/useradd.txt&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;w&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;03 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;logfile&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fout&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;04 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;expect&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;Password&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #f810b0;&quot;&gt;05 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;time&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sleep&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;0.1&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;06 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sendline&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;root pass&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;07 &lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;expect&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;#&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;color: black; font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;08&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sendline&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;&#39;/usr/sbin/useradd -s /bin/false -e &#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;formatTime&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&#39; -g sshlimitspeed &#39;&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #f810b0;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;从记录文件中我们可以看到,命令正确被执行了,但/etc/passwd里并没有增加相应用户.我确信, 手动调08行,这条useradd命令是肯定可以成功的...&lt;br /&gt;
&lt;br /&gt;
想来想去,猜测,pexpect是通过子进程来执行命令的, 执行结束之后结束进程. 上述代码中,执行完第8句应该就会结束子进程, 会不会是useradd进程还没生效, 他的爸爸就被杀了,于是他也跟着他爸爸一起完蛋了,还没来得及实现他人生的价值^_^&lt;br /&gt;
&lt;br /&gt;
于是加一句,让其等useradd执行完才结束, 如下:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;01&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;pexpect&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;spawn&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;su&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;02&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;fout&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;file&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;/var/www/useradd.txt&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;w&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;03&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;logfile&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;fout&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;04&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;expect&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;Password&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #f810b0;&quot;&gt;05&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;time&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;sleep&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;06&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;sendline&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;just2like@&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;07&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;expect&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;#&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;08&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;i&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;range&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;):&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #008800; font-style: italic;&quot;&gt;09&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;sendline&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;/usr/sbin/useradd -s /bin/false -e &#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;formatTime&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39; -g sshlimitspeed &#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #f810b0;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;adduser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;expect&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;#&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; font-size: 14px;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;[object HTMLOptionElement]&#39;, Consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px;&quot;&gt;结果如预期,搞定.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/1757568512096149978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/1757568512096149978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/1757568512096149978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/1757568512096149978'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/03/python-pexpect-adduser-failed.html' title='python pexpect 增加用户失败分析 (adduser failed)'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-5078470054318720153</id><published>2011-02-25T05:48:00.000-08:00</published><updated>2011-02-25T05:48:50.605-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><title type='text'>CentOS + L2TP/IPSec + FreeRadius 教程  ( 一 )</title><content type='html'>目标:&lt;br /&gt;
     1. 提供L2TP(VPN)链接服务&lt;br /&gt;
     2. 可以针对用户进行流量统计与限制&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    环境:&lt;br /&gt;
     CentOS5.5 + L2TP/IPSec + FreeRadius&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    边干边写, 第一天刚刚开始有点想发, 所以啥细节也没有, 只是明确下方向...</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/5078470054318720153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/5078470054318720153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/5078470054318720153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/5078470054318720153'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/02/centos-l2tpipsec-freeradius.html' title='CentOS + L2TP/IPSec + FreeRadius 教程  ( 一 )'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-3177541989436783087</id><published>2011-02-24T06:28:00.000-08:00</published><updated>2011-02-24T06:28:52.736-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Python Pexpect  End Of File (EOF)  Exception</title><content type='html'>&amp;nbsp;&amp;nbsp; I have written a simple python script which use pexpect to add a user and set his password.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; My code looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;pexpect.run(&#39;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;sudo /usr/sbin/useradd -s /bin/false&lt;/span&gt;)&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; passwd = pexpect.spawn(&#39;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;sudo /usr/bin/passwd&lt;/span&gt; &#39; + name)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; for repeat in (1,2):&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;passwd.expect(&#39;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;password:&lt;/span&gt;&#39;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; passwd.sendline(password)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; time.sleep(0.2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; It works on my own machine(Ubuntu 10.10). But on some other machine(CentOS 5.5), it always get an pexpect.EOF exception.&amp;nbsp;To solve this problem, you should change the second line of the code to:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; passwd.expect([&#39;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;password:&lt;/span&gt;&#39;,pexpect.EOF])&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; The exception told you there is and EOF, so the simplest thing is to expect it:)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/3177541989436783087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/3177541989436783087' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3177541989436783087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3177541989436783087'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/02/python-pexpect-end-of-file-eof.html' title='Python Pexpect  End Of File (EOF)  Exception'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-4011438273884909354</id><published>2011-02-23T16:21:00.000-08:00</published><updated>2011-02-23T16:21:20.115-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IT应用"/><category scheme="http://www.blogger.com/atom/ns#" term="电脑故障"/><title type='text'>Win7 自动拨号-- Windows 7 ADSL auto-dial</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp;以前的WIN7是可以自动拨号的, 至于怎么设置我自己也忘了. 重装系统后,不再自动拨号,每次都手动,颇为麻烦,于是设之.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Windows下, 拨号是个rasphone.exe来完成的. 于是简单了, 只要将这个程序加入到自动运行就可以了.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;首先拨号的方法是 &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;C:\Windows\System32\rasphone -d &quot;ADSL&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;然后就是将其加入到regedit中&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;新建个字符串, 名称随便如: ADSLRun &amp;nbsp;然后值为&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;C:\Windows\System32\rasphone -d &quot;ADSL&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;注意: &quot;ADSL&quot;是你拨号链接的名称.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/4011438273884909354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/4011438273884909354' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4011438273884909354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4011438273884909354'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/02/win7-windows-7-adsl-auto-dial.html' title='Win7 自动拨号-- Windows 7 ADSL auto-dial'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-3149215819169564714</id><published>2011-02-18T23:57:00.000-08:00</published><updated>2011-02-18T23:57:24.736-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>Django 处理中文， 使用VIM编辑 （LINUX）</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; 前面折腾的Django工程基本功能已经完成，今天想把以前英文的内容全部修改成中文，遇到一个问题，在一个templates页面里写中文时，Django无法识别，报错：&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 18px; line-height: 21px;&quot;&gt;UnicodeDecodeError。&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;只有一个文件有问题，其他没问题。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 18px; line-height: 21px;&quot;&gt;&amp;nbsp;&amp;nbsp; 经google, 发现原来这个文件保存的编码类型非utf-8，而Django默认的编码类型是utf-8, 于是出错。解决方法：&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 18px; line-height: 21px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;1.在shell 下&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 18px; line-height: 21px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt; file login.html&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #092e20; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 18px; line-height: 21px;&quot;&gt; 得到&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;login.html: UTF-8 Unicode text, with CRLF line terminators&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&amp;nbsp;&amp;nbsp; 2.如果不是UTF-8 使用 iconv 进行转换&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;[Look~]#&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;em style=&quot;color: #cc0033; font-style: normal; font-weight: normal;&quot;&gt;iconv&lt;/em&gt;&amp;nbsp;-f&amp;nbsp;&lt;em style=&quot;color: #cc0033; font-style: normal; font-weight: normal;&quot;&gt;ISO&lt;/em&gt;-&lt;wbr&gt;&lt;/wbr&gt;8859-1 -t&amp;nbsp;&lt;em style=&quot;color: #cc0033; font-style: normal; font-weight: normal;&quot;&gt;utf-8&lt;/em&gt;&amp;nbsp;login.html &amp;gt; new_login.html&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;[Look~]#&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0033;&quot;&gt;cp&lt;/span&gt; new_login.html login.html&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp; 然后打开网页显示，OK，可以看到熟悉的中文了。不过还是有问题，vim 打开文件，看到所有中文的地方，全是乱码。这个是VIM显示的问题，可以在vimrc中进行如下设置&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;set&lt;/span&gt; encoding=utf-8&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;set&lt;/span&gt; fileencodings=utf-8,chinese,latin-1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp;然后，一切就都像传说中那么爽了，HOHO。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/3149215819169564714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/3149215819169564714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3149215819169564714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/3149215819169564714'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/02/django-vim-linux.html' title='Django 处理中文， 使用VIM编辑 （LINUX）'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-7755299399254571700</id><published>2011-01-30T07:15:00.000-08:00</published><updated>2011-01-30T07:15:36.906-08:00</updated><title type='text'>Use Python Get Date, Output in format YY-MM-DD</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; Get Today first&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; import datetime&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; today = datetime.date.today()&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Then get a delta time &lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; oneday = datetime.timedelta(days=1)&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Add them together, we got tomorrow&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; today+=oneday&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; print it &lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; print today.strftime(&quot;%Y-%m-%d&quot;)&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Over!</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/7755299399254571700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/7755299399254571700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/7755299399254571700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/7755299399254571700'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/use-python-get-date-output-in-format-yy.html' title='Use Python Get Date, Output in format YY-MM-DD'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-5518316251838342777</id><published>2011-01-28T16:49:00.000-08:00</published><updated>2011-01-28T16:49:23.145-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="电脑故障"/><title type='text'>WIN7 Ubuntu10.10 双系统，重装WIN7， 修复启动</title><content type='html'>&amp;nbsp;&amp;nbsp; 电脑安装的是Ubuntu 10.10和WIN7 双系统，WIN7快要慢得报废了，于是想重装把WIN7.采用WIN7 GHOST盘，安装过程比WIN7 原版光盘顺利。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 一开始硬盘GHOST恢复，失败了，GHOST显示Internal Error, 并且直接把WIN7的启动项写坏了。。。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 翻啊翻，把大学时代留下来的GHOST　XP的盘翻出来了，光盘启动，进入 GHOST 11，找到硬盘上的GHOST镜像，选择恢复到C盘，成功了。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 完成之后重启，WIN7的启动项依然是无法使用。不过这时可以进入UBUNTU 10.10，那就好办，老办法&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;sudo update-grub&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 成功找到WIN7的启动项，修复成功，一切OK。</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/5518316251838342777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/5518316251838342777' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/5518316251838342777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/5518316251838342777'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/win7-ubuntu1010-win7.html' title='WIN7 Ubuntu10.10 双系统，重装WIN7， 修复启动'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-4653369850617591318</id><published>2011-01-23T07:26:00.000-08:00</published><updated>2011-01-23T07:26:54.670-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="生活"/><title type='text'>为什么总是荒废时间？</title><content type='html'>&amp;nbsp;&amp;nbsp; 话说最近的一些日子，时间还是很充裕，可是原本计划好的事情，往电脑面前一坐就被各种各样临时的借口给打断了。&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 总是为自己执行的不给力而烦恼，却总也改不了。 牛人曾经说过：认识到自己的缺点，就成功了一半。 我认识到了自己的缺点，但貌似剩下的一半也不好走么。&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 也许该睡一个好觉，再第N+1次从头开始。延着蠢材的路走到天黑，说不定会看到神马也不一定。</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/4653369850617591318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/4653369850617591318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4653369850617591318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4653369850617591318'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/blog-post.html' title='为什么总是荒废时间？'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-4406265747557299644</id><published>2011-01-21T07:38:00.000-08:00</published><updated>2011-01-21T07:38:08.080-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Django User Profile    Error: No such colum</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp;我使用Django 的User 模块来开发用户注册系统， 想给用户扩展一些自己的属性， 于是按照文档上的方法，扩展如下:&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-c&quot;&gt;&lt;br /&gt;
class SSH_User(models.Model):&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;user = models.OneToOneField(User)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;email = models.EmailField()&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;expire_date = models.CharField(&#39;expire_date&#39;,max_length=40)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;qq_id = models.CharField(&#39;qq_id&#39;,max_length=15)&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
并且修改了setting&lt;br /&gt;
&lt;br /&gt;
AUTH_PROFILE_MODULE=&#39;admin.SSH_User&#39;&lt;br /&gt;
&lt;br /&gt;
结果保存profile的时候 ， 提示数据库中没有qq_id这一行&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;no such colum : qq_id&lt;br /&gt;
&lt;br /&gt;
后来google到结果，&lt;br /&gt;
&lt;br /&gt;
sudo python manage.py reset YOURAPP&lt;br /&gt;
&lt;br /&gt;
再测， OK&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/4406265747557299644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/4406265747557299644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4406265747557299644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/4406265747557299644'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/django-user-profile-error-no-such-colum.html' title='Django User Profile    Error: No such colum'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-6247669535031985563</id><published>2011-01-19T06:51:00.000-08:00</published><updated>2011-01-19T06:51:21.894-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>User authentication in Django</title><content type='html'>&amp;nbsp;&amp;nbsp; If you want to wirte a user authentication module with Django. Then you don&#39;t have to. Because Django has one.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Check this:&lt;a href=&quot;http://docs.djangoproject.com/en/dev/topics/auth/&quot;&gt;http://docs.djangoproject.com/en/dev/topics/auth/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Actually, before if you do anything with Django, check if it is already done by Django at&amp;nbsp;&lt;a href=&quot;http://docs.djangoproject.com/&quot;&gt;http://docs.djangoproject.com&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/6247669535031985563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/6247669535031985563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/6247669535031985563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/6247669535031985563'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/user-authentication-in-django.html' title='User authentication in Django'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-2790110881228518318</id><published>2011-01-08T04:27:00.000-08:00</published><updated>2011-01-08T04:28:46.282-08:00</updated><title type='text'>Add SSH User and Password by python from web server</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 环境是CentOS 5.5 + Apache + Django ， 需要从Web提交的数据通过Python增加linux 用户。需要解决的问题如下：&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; 1. srcript 是由 apache 用户执行的， 首先需要apache用户有执行adduser 和 passwd的能力， 我直接将apache 加入到sudoer 里，并且设置为不需要密码&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;apache &lt;/span&gt;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta;&quot;&gt;ALL=(ALL) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NOPASSWD: ALL&lt;/span&gt; -- &amp;nbsp;这样不安全，目前只是为了简单&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;2. 获取到用户和密码的时候，下面就是python 加用户的事了， 一开始想用&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;code class=&quot;prettyprint lang-py&quot;&gt;&amp;nbsp;&amp;nbsp; os.system(&#39;xxx&#39;) 或者 os.popen(&#39;xxx&#39;)&amp;nbsp;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;但始终没有能解决， passwd需要输入两次密码的问题， 后来google得到一个方法， 使用pexpect实现USER增加的功能&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;def add_SSH_user(name,pwd):&lt;br /&gt;
&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if name and pwd:&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;run(&#39;sudo /usr/sbin/useradd -s /bin/false &#39; + name, withexitstatus=1)&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;passwd = pexpect.spawn(&quot;sudo /usr/bin/passwd &quot; + pwd)&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for repeat in (1,2):&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;passwd.expect(&quot;password: &quot;)&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;passwd.sendline(pwd) &amp;nbsp; &amp;nbsp; &amp;nbsp; #send the password to the sub process&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;time.sleep(0.1)&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint lang-py&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;搞定。。&lt;/span&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/2790110881228518318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/2790110881228518318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2790110881228518318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/2790110881228518318'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/add-ssh-user-and-password-by-python.html' title='Add SSH User and Password by python from web server'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1529329444272949524.post-6408106144169211729</id><published>2011-01-07T21:01:00.000-08:00</published><updated>2011-01-07T21:03:42.729-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux OS"/><category scheme="http://www.blogger.com/atom/ns#" term="WebServer"/><title type='text'>CentOS 5.5 Apache + Django</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp;I follow&amp;nbsp;&lt;a href=&quot;http://library.linode.com/frameworks/django-apache-mod-python/centos-5&quot;&gt;http://library.linode.com/frameworks/django-apache-mod-python/centos-5&lt;/a&gt;&amp;nbsp;to depoly Django on CentOS 5.5 + Apache.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; But It&#39;s not so easy for me . My Apache Cfg file is&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: helvetica, verdana, tahoma, arial, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;color: #333333; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;lt;VirtualHost&lt;/span&gt; &lt;span style=&quot;color: #ba2121;&quot;&gt;x.x.x.x:80&lt;/span&gt;&lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;ServerName&lt;/span&gt; x.x.x.x
    &lt;span style=&quot;color: green;&quot;&gt;ServerAdmin&lt;/span&gt; xxx@gmail.com
    &lt;span style=&quot;color: green;&quot;&gt;DocumentRoot&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;/var/www/vpn/register&lt;/span&gt;

    &lt;span style=&quot;color: green;&quot;&gt;PythonPath&lt;/span&gt; &lt;span style=&quot;color: #ba2121;&quot;&gt;&quot;[&#39;/srv/www/vpn/register&#39;] + sys.path&quot;&lt;/span&gt;
    &lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;lt;Location&lt;/span&gt; &lt;span style=&quot;color: #ba2121;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: green;&quot;&gt;SetHandler&lt;/span&gt; python-program
        &lt;span style=&quot;color: green;&quot;&gt;PythonHandler&lt;/span&gt; django.core.handlers.modpython
        &lt;span style=&quot;color: green;&quot;&gt;SetEnv&lt;/span&gt; DJANGO_SETTINGS_MODULE settings
        &lt;span style=&quot;color: green;&quot;&gt;PythonDebug&lt;/span&gt; &lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;Off&lt;/span&gt;
    &lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;

    &lt;span style=&quot;color: green;&quot;&gt;ErrorLog&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;/srv/www/ducklington.org/logs/error.log&lt;/span&gt; 
    &lt;span style=&quot;color: green;&quot;&gt;CustomLog&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;/srv/www/ducklington.org/logs/access.log&lt;/span&gt; combined
&lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&amp;lt;/VirtualHost&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;When I try to access the site, I alway get an error, say can&#39;t find module named register.urls. But there is a register.urls in my directory. Finally, I find the  problem is the PythonPath, you should add the parent directory of your project, for example, I Change mine to :&lt;/pre&gt;&lt;pre style=&quot;font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;PythonPath&lt;/span&gt; &lt;span style=&quot;color: #ba2121;&quot;&gt;&quot;[&#39;/srv/www/vpn&#39;] + sys.path&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #ba2121;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;OK, now I can see my simple web page. Try to add a user, store it in my database. Problems again, &quot;unable to open database file&quot;.&lt;/pre&gt;&lt;pre style=&quot;line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;The answer can be find here, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; white-space: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; line-height: normal; white-space: normal;&quot;&gt;&lt;a href=&quot;http://code.djangoproject.com/wiki/NewbieMistakes#DjangosaysUnabletoOpenDatabaseFilewhenusingSQLite3&quot;&gt;http://code.djangoproject.com/wiki/NewbieMistakes#DjangosaysUnabletoOpenDatabaseFilewhenusingSQLite3&lt;/a&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Just, &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Chmod 777 xxx&lt;/span&gt;&lt;/i&gt; &amp;nbsp; &amp;nbsp;^-^&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12.5px; line-height: 16px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #ba2121;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://wgrmmtmr.blogspot.com/feeds/6408106144169211729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1529329444272949524/6408106144169211729' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/6408106144169211729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1529329444272949524/posts/default/6408106144169211729'/><link rel='alternate' type='text/html' href='http://wgrmmtmr.blogspot.com/2011/01/centos-55-apache-django.html' title='CentOS 5.5 Apache + Django'/><author><name>WGR</name><uri>http://www.blogger.com/profile/14964464334657462001</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNDPOwt_Ui1O6k0z1qkk-b4K_vYDy--hw8NKllpT-DhSp-8liAz2AFCHD-UZn9FDF5tFiKsnX4tNFPpPF5l7ZlGmFrtuzq0wiAaQzF2LV2TdE1VDcJnyEOCRa6z9Mfk2w/s220/cute-round-face_16.png'/></author><thr:total>0</thr:total></entry></feed>