<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[linuxの飘扬]]></title> 
<link>https://www.linuxfly.org/index.php</link> 
<description><![CDATA[Power by www.linuxfly.org]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[linuxの飘扬]]></copyright>
<item>
<link>https://www.linuxfly.org/post//</link>
<title><![CDATA[[原]linux下的trap命令]]></title> 
<author>linuxing &lt;emos#linuxfly.org&gt;</author>
<category><![CDATA[系统命令]]></category>
<pubDate>Mon, 18 May 2009 09:06:16 +0000</pubDate> 
<guid>https://www.linuxfly.org/post//</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;trap命令用于指定在接收到信号后将要采取的动作。常见的用途是在脚本程序被中断时完成清理工作。不过，这次我遇到它，是因为客户有个需求：从终端访问服务器的用户，其登陆服务器后会自动运行某个命令，例如打开应用（命令写在.bashrc等文件中），最后退出，并断开连接；期间是不能允许其使用Ctrl+C等中断退出应用，而回到Shell环境，否则可能会带来安全问题。<br/>&nbsp;&nbsp;&nbsp;&nbsp;当然，解决的方式有很多，如在应用中屏蔽中断信号、使用chroot方式访问等。但这些方法都有一些限制，如需要修改应用，让telnet等支持chroot方式（ssh可支持chroot）等。而使用trap也是一种比较好的解决方法。<br/>............<br/><br/>Tags - <a href="https://www.linuxfly.org/tags/trap/" rel="tag">trap</a>
]]>
</description>
</item><item>
<link>https://www.linuxfly.org/post//#blogcomment</link>
<title><![CDATA[[评论] [原]linux下的trap命令]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.linuxfly.org/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>