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

<channel>
	<title>臭皮匠 &#187; shell</title>
	<atom:link href="http://guogoul.com/category/technology/shel/feed/" rel="self" type="application/rss+xml" />
	<link>http://guogoul.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Oct 2010 00:24:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ssh攻击的发现以及预防</title>
		<link>http://guogoul.com/2008/12/04/ssh_hacker/</link>
		<comments>http://guogoul.com/2008/12/04/ssh_hacker/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 14:16:48 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/12/04/ssh%e6%94%bb%e5%87%bb%e7%9a%84%e5%8f%91%e7%8e%b0%e4%bb%a5%e5%8f%8a%e9%a2%84%e9%98%b2/</guid>
		<description><![CDATA[&#8220;HACKER&#8221; 利用 ssh攻击的目的是想暴力破解服务器的密码，然后控制你的服务器。通常可以从以下两种方式发现：
1. 假如你的服务器突然间一直ssh连接失败,但多次尝试,偶尔还能连接上.
2. 系统日志里面有大量的验证失败的ssh连接请求.
    ubuntu系统是在/var/logs/auth.log里面.
如何进行简单预防:
1.禁用root帐号访问ssh
  做法:只要在/etc/ssh/sshd_config  : PermitRootLogin no
2.RSA公钥认证:
  做法:只要在/etc/ssh/sshd_config  : PasswordAuthentication no
3.修改默认端口:
  一般的攻击都只针对默认22端口.你只要修改到其它端口上就ok.
 做法:只要在/etc/ssh/sshd_config   ort 9922
 注意:别让自己的防火墙把自己的ssh请求给阻挡在外（我就吃过这个亏）

4.一般以上三个方案就ok了，为了安全还可以安装denyhosts。denyhosts可以检查系统日志，检查来访失败的ip,然后把ip列入黑名单。具体请看官方文档
]]></description>
		<wfw:commentRss>http://guogoul.com/2008/12/04/ssh_hacker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>linux系统管理员笔记(1)</title>
		<link>http://guogoul.com/2008/10/14/linux_admin_1/</link>
		<comments>http://guogoul.com/2008/10/14/linux_admin_1/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 14:34:03 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/10/14/linux_admin_1/</guid>
		<description><![CDATA[一些目录
1./etc
   /etc/motd: 成功登录后自动输出的内容，比如你用ssh登录一台机器后所输出提示信息，系统管理员可以把这个地方做为一个黑板，提提醒每个登录本机的用户一些信息，如何时系统会关机之类的信息。
  /etc/mtab: 显示当前安装的文件系统列表，由mount命令自动更新，与/etc/fstab不同是 mtab是fstab 执行的结果
  /etc/login.defs: 登录命令的配置文件,包括邮件地址，PATH路径，错误日志等设置
  /etc/securetty:确认安全终端，就是哪个终端可以用root登录.假如/etc/securetty是个空文档，则根用户就不能从任务的设备登录系统。只能以普通用户登录，再用su命令转成根用户。假如/etc/securetty文档不存在，那么根用户能够从任何地方登录。这样会引发安全问题，所以/etc/securetty文档在系统中是一定要存在的。
  /etc/shells: 列出所有可用的shell
  /etc/skel:用来存放初始一人用户时的一些基本配置。
2./var
  /var/cache: 一些程序的缓存比如/var/cache/man:表示man程序的缓存记录
 /var/lib: 系统正常运行时要改变的文件
 /var/lock: 锁定文件，当一个程序被锁定时，其它程序将不再使用这个文件
 /var/log: 各种程序的log文件。比如系统的一些启动日志之类，这个目录不停的增长，可以定期删除一下
 /var/spool: 队列工作的目录，每个不同的spool在/var/spool下有自己的工作目录。例如 ： /var/spool/mail; /var/spool/cron
 /var/tmp:允许大的，长时间保存的临时文件。
3./proc 文件系统是一个假的文件系统。它不存在在磁盘某个磁盘上。而是由核心在内存中产生
4.注意要用vipw,vigr来修改passwd文件与group文件，不要直接编辑。
思路（1）;
如果你要有多台机器，且系统要求一样，可以把/usr或者/home等目录中的数据保存到一台机器上，然后再把他其它机器的/usr,/home/,ntfs到这台机器上。
]]></description>
		<wfw:commentRss>http://guogoul.com/2008/10/14/linux_admin_1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(5)</title>
		<link>http://guogoul.com/2008/08/30/bashshell_5/</link>
		<comments>http://guogoul.com/2008/08/30/bashshell_5/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 15:55:53 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技巧]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/30/bashshell_5/</guid>
		<description><![CDATA[1.echo 参数，-n表示输出后不换行。 -e表示转化转义字符
2.
序列 	意义 
\a 	响铃。 
\b 	退格。
\c 	强制换行。
\e 	退出。
\f 	清除屏幕Form feed.
\n 	换行。
\r 	回车。
\t 	水平制表符。
\v 	垂直制表符。
\\ 	反斜杠。
\ONNN 	值为八进制值NNN（0到3个八进制数字）的8比特字符。
\NNN 	值为八进制值NNN（1到3个八进制数字）的8比特字符。
\xHH 	值为十六进制值（1或者2个十六进制数字）的8比特字符。
2.’-’ 可以表示程序需要从管道读取就可以达到目的
3.
分配给文件以文件描述符:
exec fdN&#62; file
分配文件描述符N给 file 进行输出：
exec fdN&#60; file
分配文件描述符N给 file 进行输入。
关闭文件描述符: exec fd&#60;&#38;-
4.here docment就像php的定界符

5.FILE == &#62;FILE 2&#62;&#38;1 把标准输出和标准错误重定向到FILE文件中.
6.for循环的结构语法
for NAME [in list];do commands;done
7.while循环的语法结构。
while control-command;do consequent-commands;done
8.until与while刚好相反当条件为真的时候退出。
until test-command;do consequent-commands;done
9.菜单生成与for的语法相似
select word [in list];do respective-commands;done
10.shift内建命令
其应用主要用于随过的参数输入的处理参数的遍历
shift后面跟 一个数字N做参数。原来的$1就变成$(N+1) $#变成$#-N+1
11.变量的定义
declare OPTION(s) VARIABLE=value
OPTION: -a 数组 -f [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/30/bashshell_5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(4)</title>
		<link>http://guogoul.com/2008/08/25/bashshell_4/</link>
		<comments>http://guogoul.com/2008/08/25/bashshell_4/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 14:51:13 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cut]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/25/bashshell_4/</guid>
		<description><![CDATA[1.if学习语法:if TEST-COMMANDS;then CONSEQUENT-COMMANDS;fi
test-commands表达式:



Primary
意义




[ -a FILE ]
                              
 如果 FILE 存在则为真。
                 [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/25/bashshell_4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(3)</title>
		<link>http://guogoul.com/2008/08/25/bashshell_3/</link>
		<comments>http://guogoul.com/2008/08/25/bashshell_3/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 00:08:47 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/25/bashshell_3/</guid>
		<description><![CDATA[1.算术操作符



操作符
意义




VAR++ and VAR&#8211;
变量自增和变量自减


++VAR and &#8211;VAR
变量前置加和前置减


- and +
一元减和加


! and ~
逻辑和按位取反


**
求幂


*, / and %
乘，除，求余


+ and -
加，减


&#60;&#60; and &#62;&#62;
左移和右移


&#60;=, &#62;=, &#60; and &#62;
比较操作符


== and !=
相等和不相等


&#38;
位与


^
位异或


&#124;
位或


&#38;&#38;
逻辑与


&#124;&#124;
逻辑或


expr ? expr : expr
条件赋值


=, *=, /=, %=, +=, -=, &#60;&#60;=, &#62;&#62;=, &#38;=, ^= and &#124;=
赋值


,
表达式间的分隔符



2.建立和移除别名aliasunalias,注意：别名不能被子进程继承
3.用set来设置选项显示所有的选项: set -o,注-号开启选项，+关闭选项例如： set -o noclobber: 文件不能被overwrite
4.touch用来建立一个空文件的好方法,touch主要用于改变文件改变的时间戳
5.grep: 以行为单位搜索那些包含给出模板列表的输入文件。当在一行中找到匹配，默认把行拷到标准输出grep中的正则: \&#60;表地单词的开始, \&#62;表示单词的结束grep -w匹配单词
6.字符族:使用语法:[:CLASS:]&#8220;alnum&#8221;,&#8221;alpha&#8221;,&#8221;ascii&#8221;,“blank”,&#8221;cntrl&#8221;,&#8221;digit&#8221;,&#8221;graph&#8221;,&#8221;lower&#8221;,&#8221;print&#8221;,&#8221;punct&#8221;,&#8221;space&#8221;,&#8221;upper&#8221;,&#8221;word&#8221;,&#8221;xdigit&#8221;
7.awk (分析的是每一行的输入)FS:域分割符代表内建的变量oRS:行分割符oFS:输出分割符=:赋值printf,print:输出BEGIN: 开始的定义以及输出处理END: 结束时的处理.
]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/25/bashshell_3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(2)</title>
		<link>http://guogoul.com/2008/08/23/bashshell_2/</link>
		<comments>http://guogoul.com/2008/08/23/bashshell_2/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 15:21:30 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/23/bashshell_2/</guid>
		<description><![CDATA[1.注意：当运行脚本文件时,系统会建立一个子shell来运行文件中命令。函数和别名等只有子shell使用。当那个shell退出，父shell重新得到控制的时候，所有的东西都被清空，脚本对shell状态所作的改变耶全部清除。如果不想建在子shell中运行脚本可以直接： source script_name.sh这里脚本不需要可执行权限。命令在当前shell力执行，所以任何对环境的改变，将在脚本结束时同样起作用2.脚本选择:第一行决定了启动的shell，第一行的开始2个字符应该是#!，然后紧跟解释后面命令的shell的路径。空白行也被认为是一行，所以不要让你的脚本以空白行开始。
 #!/bin/bash3.注释:以#开头在一个良好的脚本中，第二行经常注明要完成的任务。然后为了明确每一大块命令将被加上注释。4.脚本调试调试参数:



短符号
长符号
结果




set -f
set -o noglob
禁止特殊字符用于文件名扩展。


set -v
set -o verbose
打印读入shell的输入行。


set -x
set -o xtrace
执行命令之前打印命令。



可以在文件里面直接定义#!/bin/bash -xv,或者在执行时候指定.bash -xv scripte_name.sh
5.一些环境中的特殊脚本文件.
/etc/profile:当用&#8211;login选项或者以SH来调用交互模式时，bash读取/etc/profile的指令。通常是一些设置shell变量PATH,USER,MAIL,HOSTNAME,HISTSIZE
/etc/bashrc: 由于其它的shell也有可会读出/etc/profile，这样的话把bash的脚本直接放到bashrc上更安全点.~/.bash_profile:个别的为用户配置环境。~/.bash_login: 只有在你登录进系统才执行的特殊的设置~/.profile: 没有~/.bash_profile和~/.bash_login文件的情况下被读取。~/.bashrc：在使用一个非登陆shell,比如使用x终端登录进图行模式。些时bash会搜索~/.bashrc.
~/.bash_logout: 登出系统时候的特别指令.
                        6.查看环境变量指令 printenv7.变量设置以及引用. MYVAR=&#8221;value&#8221; (指定变量MYVAR的值) echo $MYVAR（输出MYVAR这个变量的值）8.一个变量定义后仅仅在当前shell内产生，属于本地变量，子shell进程不会意识到这个的存在。为了把变量传递给子shell,需要用export命令输出出来.不过在子shell的改变对父shell没有影响.
9.保留变量



变量名字
定义




CDPATH
一个由冒号分割的目录列表作为内建命令 cd 的搜索路径。
     [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/23/bashshell_2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-简单基础(1)</title>
		<link>http://guogoul.com/2008/08/22/bashshell_1/</link>
		<comments>http://guogoul.com/2008/08/22/bashshell_1/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 23:40:15 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/22/bashshell_1/</guid>
		<description><![CDATA[用linux环境也有快一年多的历史了，对于shell只是用到时候查一下文档，并没有系统化。接下来想抽时间系统的学习一下。先从简单开始吧。
1.查看系统中所有的shell
cat /etc/shells
2.查看用户的默认shell
 cat /etc/passwd
 3.切换shell
 直接输入shell名就可以。
 例如：mia:~&#62; tcsh
 [mia@post21 ~]$
4.当用户登录时机器自动运行的shell
 4.1/etc/profile
 4.2~/.bash_profile,~/.bash_login or~/.profile： 读取第一个存在的可读取的文件
 4.3 ~/.bash_logout 登出的时候。
 错误消息将会显示如果配置文件存在但是不能读取。一个文件不存在，Bash将搜索下一个。5,非登录应用一个非登陆shell就是不需要进行系统的认证。比如，通过一个图标打开一个终端，或者一个菜单项目，那样就是非登陆shell
 读取的文件：  ~/.bashrc
  此文件通常指向 ~/.bash_profile：if [ -f ~/.bashrc]; then . ~/.bashrc; fi 
7.远程调用 以 rshd 调用时读取的文件:~/.bashrc 
8.默认情况下历史命令和历史扩展式开启的。历史在shell退出时都保存在 HISTFILE 指向的文件中。默认情况下，HISTFILE 指向 ~/.bash_history
  9.wc统计文件的字数，与行数。
习题:(如果我做的不对，或者方法不佳请留言,还有一些没写答案，请高手支招)
  1.bash 程序位于你系统的什么位置？
  which bash
  2.使用 &#8211;version 选项来找到你正在运行的版本。
    [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/22/bashshell_1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

