📄 385.html
字号:
[root@deep]# chattr +i /etc/passwd<br>
[root@deep]# chattr +i /etc/shadow<br>
[root@deep]# chattr +i /etc/group<br>
[root@deep]# chattr +i /etc/gshadow<br>
<br>
14. 阻止任何人su作为root.<br>
如果你不想任何人能够su作为root,你能编辑/etc/pam.d/su加下面的行:<br>
<br>
auth sufficient /lib/security/pam_rootok.so debug<br>
auth required /lib/security/pam_wheel.so group=isd<br>
<br>
意味着仅仅isd组的用户可以su作为root.<br>
然后,如果你希望用户admin能su作为root.就运行下面的命令。<br>
<br>
[root@deep]# usermod -G10 admin<br>
<br>
16. 资源限制<br>
对你的系统上所有的用户设置资源限制可以防止DoS类型攻击(denial of service attacks)<br>
如最大进程数,内存数量等。例如,对所有用户的限制象下面这样:<br>
编辑/etc/security/limits.con加:<br>
<br>
* hard core 0<br>
* hard rss 5000<br>
* hard nproc 20<br>
你也必须编辑/etc/pam.d/login文件加/检查这一行的存在。<br>
<br>
session required /lib/security/pam_limits.so<br>
<br>
上面的命令禁止core files“core 0”,限制进程数为“nproc 50“,且限制内存使用<br>
为5M“rss 5000”。<br>
<br>
17. The /etc/lilo.conf file<br>
<br>
a) Add: restricted<br>
加这一行到每一个引导映像下面,就这表明如果你引导时用(linux single),则需要一个password.<br>
<br>
b) Add: password=some_password<br>
当与restricted联合用,且正常引导时,需要用户输入密码,你也要确保lilo.conf<br>
文件不能被不属于root的用户可读,也免看到密码明文。下面是例子:<br>
编辑/etc/lilo.conf加:<br>
====<br>
boot=/dev/sda<br>
map=/boot/map<br>
install=/boot/boot.b<br>
prompt<br>
timeout=50<br>
Default=linux<br>
restricted ? add this line.<br>
password=some_password ? add this line.<br>
image=/boot/vmlinuz-2.2.12-20<br>
label=linux<br>
initrd=/boot/initrd-2.2.12-10.img<br>
root=/dev/sda6<br>
read-only<br>
[root@deep]# chmod 600 /etc/lilo.conf (不再能被其他用户可读).<br>
[root@deep]# /sbin/lilo -v (更新lilo配置).<br>
[root@deep]# chattr +i /etc/lilo.conf(阻止该文件被修改)<br>
<br>
18. 禁止 Control-Alt-Delete 重启动机器命令<br>
<br>
[root@deep]# vi /etc/inittab<br>
ca::ctrlaltdel:/sbin/shutdown -t3 -r now<br>
To<br>
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now<br>
[root@deep]# /sbin/init q<br>
<br>
19. 重新设置/etc/rc.d/init.d/目录下所有文件的许可权限<br>
[root@deep]# chmod -R 700 /etc/rc.d/init.d/*<br>
仅仅root可以读,写,执行上述所有script file.<br>
<br>
20. The /etc/rc.d/rc.local file<br>
默认地,当你login到linux server时,它告诉你linux版本名,内核版本名和服务器<br>
主机名。它给了你太多的信息,如果你就希望得到提示login: ,编辑<br>
/etc/rc.d/rc.local放#在下面的行前面:<br>
-- <br>
# This will overwrite /etc/issue at every boot. So, make any changes you<br>
# want to make to /etc/issue here or you will lose them when you reboot.<br>
#echo "" > /etc/issue<br>
#echo "$R" >> /etc/issue<br>
#echo "Kernel $(uname -r) on $a $(uname -m)" >> /etc/issue<br>
#<br>
#cp -f /etc/issue /etc/issue.net<br>
#echo >> /etc/issue<br>
-- <br>
然后,做下面的事情:<br>
[root@deep]# rm -f /etc/issue<br>
[root@deep]# rm -f /etc/issue.net<br>
[root@deep]# touch /etc/issue<br>
[root@deep]# touch /etc/issue.net<br>
<br>
21. 被root拥有的程序的位。<br>
移走那些被root拥有程序的s位标志,当然有些程序需要这个,用命令‘chmod a-s’完成这个。<br>
注:前面带(*)号的那些程序一般不需要拥有s位标志。<br>
<br>
[root@deep]# find / -type f ( -perm -04000 -o -perm -02000 ) -exec ls –lg {} ;<br>
-rwsr-xr-x 1 root root 33120 Mar 21 1999 /usr/bin/at<br>
*-rwsr-xr-x 1 root root 30560 Apr 15 20:03 /usr/bin/chage<br>
*-rwsr-xr-x 1 root root 29492 Apr 15 20:03 /usr/bin/gpasswd<br>
-rwsr-xr-x 1 root root 3208 Mar 22 1999 /usr/bin/disable-paste<br>
-rwxr-sr-x 1 root man 32320 Apr 9 1999 /usr/bin/man<br>
-r-s--x--x 1 root root 10704 Apr 14 17:21 /usr/bin/passwd<br>
-rws--x--x 2 root root 517916 Apr 6 1999 /usr/bin/suidperl<br>
-rws--x--x 2 root root 517916 Apr 6 1999 /usr/bin/sperl5.00503<br>
-rwxr-sr-x 1 root mail 11432 Apr 6 1999 /usr/bin/lockfile<br>
-rwsr-sr-x 1 root mail 64468 Apr 6 1999 /usr/bin/procmail<br>
-rwsr-xr-x 1 root root 21848 Aug 27 11:06 /usr/bin/crontab<br>
-rwxr-sr-x 1 root slocate 15032 Apr 19 14:55 /usr/bin/slocate<br>
*-r-xr-sr-x 1 root tty 6212 Apr 17 11:29 /usr/bin/wall<br>
*-rws--x--x 1 root root 14088 Apr 17 12:57 /usr/bin/chfn<br>
*-rws--x--x 1 root root 13800 Apr 17 12:57 /usr/bin/chsh<br>
*-rws--x--x 1 root root 5576 Apr 17 12:57 /usr/bin/newgrp<br>
*-rwxr-sr-x 1 root tty 8392 Apr 17 12:57 /usr/bin/write<br>
-rwsr-x--- 1 root squid 14076 Oct 7 14:48 /usr/lib/squid/pinger<br>
-rwxr-sr-x 1 root utmp 15587 Jun 9 09:30 /usr/sbin/utempter<br>
*-rwsr-xr-x 1 root root 5736 Apr 19 15:39 /usr/sbin/usernetctl<br>
*-rwsr-xr-x 1 root bin 16488 Jul 6 09:35 /usr/sbin/traceroute<br>
-rwsr-sr-x 1 root root 299364 Apr 19 16:38 /usr/sbin/sendmail<br>
-rwsr-xr-x 1 root root 34131 Apr 16 18:49 /usr/libexec/pt_chown<br>
-rwsr-xr-x 1 root root 13208 Apr 13 14:58 /bin/su<br>
*-rwsr-xr-x 1 root root 52788 Apr 17 15:16 /bin/mount<br>
*-rwsr-xr-x 1 root root 26508 Apr 17 20:26 /bin/umount<br>
*-rwsr-xr-x 1 root root 17652 Jul 6 09:33 /bin/ping<br>
-rwsr-xr-x 1 root root 20164 Apr 17 12:57 /bin/login<br>
*-rwxr-sr-x 1 root root 3860 Apr 19 15:39 /sbin/netreport<br>
-r-sr-xr-x 1 root root 46472 Apr 17 16:26 /sbin/pwdb_chkpwd<br>
[root@deep]# chmod a-s /usr/bin/chage<br>
[root@deep]# chmod a-s /usr/bin/gpasswd<br>
[root@deep]# chmod a-s /usr/bin/wall<br>
[root@deep]# chmod a-s /usr/bin/chfn<br>
[root@deep]# chmod a-s /usr/bin/chsh<br>
[root@deep]# chmod a-s /usr/bin/newgrp<br>
[root@deep]# chmod a-s /usr/bin/write<br>
[root@deep]# chmod a-s /usr/sbin/usernetctl<br>
[root@deep]# chmod a-s /usr/sbin/traceroute<br>
[root@deep]# chmod a-s /bin/mount<br>
[root@deep]# chmod a-s /bin/umount<br>
[root@deep]# chmod a-s /bin/ping<br>
[root@deep]# chmod a-s /sbin/netreport<br>
<br>
你可以用下面的命令查找所有带s位标志的程序:<br>
[root@deep]# find / -type f ( -perm -04000 -o -perm -02000 ) -exec ls -lg {} ;<br>
> suid-sgid-results<br>
把结果输出到文件suid-sgid-results中。<br>
<br>
为了查找所有可写的文件和目录,用下面的命令:<br>
[root@deep]# find / -type f ( -perm -2 -o -perm -20 ) -exec ls -lg {} ; > ww-files-results<br>
[root@deep]# find / -type d ( -perm -2 -o -perm -20 ) -exec ls -ldg {} ; > ww-directories-results<br>
<br>
用下面的命令查找没有拥有者的文件:<br>
[root@deep]# find / -nouser -o -nogroup > unowed-results<br>
<br>
用下面的命令查找所有的.rhosts文件:<br>
[root@deep]# find /home -name .rhosts > rhost-results<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -