2010年12月16日 星期四

Linux 基本安全設置 (關閉不必要服務)

Linux 基本安全設置

1 . 檢查有什麼Service 正在運行 , 沒有必要的Service 便把其關閉

指令: netstat –anpltu | grep –vw ESTABLISHED

[root@luckyland-hk ~]# netstat -anpltu |grep -vw ESTABLISHED
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      2689/hpiod
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      29911/mysqld
tcp        0      0 0.0.0.0:106                 0.0.0.0:*                   LISTEN      2778/xinetd
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      12684/smbd
tcp        0      0 127.0.0.1:783               0.0.0.0:*                   LISTEN      2932/spamd.pid
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2292/portmap
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      3287/perl
tcp        0      0 0.0.0.0:818                 0.0.0.0:*                   LISTEN      2332/rpc.statd
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      20792/vsftpd
tcp        0      0 127.0.0.1:3350              0.0.0.0:*                   LISTEN      3262/sesman
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      7751/smtpd
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      12684/smbd



2 . 如果IP 來源為 127.0.0.1 可以不用理會 , 因為該服務只在本機運行

3 . 其他的Services 需要細心去查閱是不必要 , 如是把其閉關

指令:
chkconfig – - level service name  off (disable the dedicate service )
Chkconfig - - list  ( showing the running service  )
chkconfig service name on  (enable the service during reboot )


4 . grep –w portno /etc/services





限制su 使用

1 . 限制只有wheel group 的用使用者才可以使用su 指令\


1 . chgrp wheel /bin/su
2 . chmod 4750 /bin/su
 Ls –l /bin/su

3 . vi /etc/group

Find wheel , add the user name at the end of the line “ , “ 分隔開

沒有留言:

張貼留言