一,BIOS安全(硬件上的安全)
1,最基本最简单的安全配置,保障计算机硬件配置等不被别人更改.给BIOS设置密码,防止改变启动顺序从软盘或光盘启动.防止特殊的启动盘启动用户的系统,进入rescue或其他模式.改变或删除当前配置等.每一个细心的网管每个细节都不应该忽视!
2,禁止使用contral+alt+delete重起机器
编辑/etc/inittab文件,注释掉下面一行.
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
该成:(使用#)
# ca::ctrlaltdel:/sbin/shutdown -t3 -r now
二,帐号安全
口令,系统的第一道防线,目前大多数数攻击都是截获口令或猜测口令等口令攻击开始的.
/etc 目录下主要存放系统的配置文件.我们要对这个目录下的好多文件进行修改.
1,/etc/login.defs文件是login程序的配置文件.口令的长度和口令的有效期等可以在这里设置.
1 |
[root@tp ~]# vi /etc/login.defs |
3 |
PASS_MAX_DAYS 9999 密码被用最多天数 |
4 |
PASS_MIN_DAYS 0 密码被用最少天数 |
5 |
PASS_MIN_LEN 5 系统默认密码长度5,我们可以该成8或更多. |
6 |
PASS_WARN_AGE 7 密码有效期警告,超过7天将提示用户更换新的密码. |
2,/etc/profile文件是环境变量设置文件.在此文件设置环境变量将对所有用户生效.我们要在此文件设置自动注销帐户的时间.及命令的历史记录数.
[root@tp ~]# vi /etc/profile
…
HOSTNAME=`/bin/hostname`
HISTSIZE=1000 这里1000代表用户操作命令的历史记录.应尽量小一些.设置成0也可以,呵呵.
tmout=600 添加此行,如果系统用户在600秒(10分钟)内不做任何操作,将自动注销这个用户.
…
3,/etc/passwd文件存放系统用户名,用户标识(UID),组标识(GID)等的地方.我们要在这里找到并清除没有设置口令的用户.同时还要清除一些特别帐号(因为可能会存在潜在的危险).
1 |
[root@tp ~]# vi /etc/passwd |
2 |
root:x:0:0:root:/root:/bin/bash |
3 |
bin:x:1:1:bin:/bin:/sbin/nologin |
5 |
wh::500:501::/home/wh:/bin/bash |
仔细观察上面的一行(wh用户),在第二项,两个冒号中间什么都没有,而上面的的用户(如root用户)都是x. 这表明此用户没有密码.要不添加上,要不删掉.
4,特别帐号的处理
01 |
#如果不启动用sendmail,删除如下用户 |
02 |
[root@tp wh]# userdel adm |
03 |
[root@tp wh]# userdel lp |
04 |
[root@tp wh]# userdel sync |
05 |
[root@tp wh]# userdel shudown |
06 |
[root@tp wh]# userdel halt |
07 |
[root@tp wh]# userdel mail |
08 |
#如果不用X windows服务器.可有删除 |
09 |
[root@tp wh]# userdel news |
10 |
[root@tp wh]# userdel uucp |
11 |
[root@tp wh]# userdel operator |
12 |
[root@tp wh]# userdel games |
14 |
[root@tp wh]# userdel gopher |
15 |
[root@tp wh]# userdel ftp |
三,重要文件的安全设置.
首先要了解两个命令
1,chmod:改变文件的属主
2,chattr:改变文件属性
我们要做的是把重要文件的属主改成root并给相应的权限,还有就是改变文件的属性让它禁止被修改
我们来统计一下重要文件:(其实,只要你不想让其他用户更改的文件都可以这么做,我这里只是为安全而选择了下面的文件.)
1,/etc/passwd,passwd-,passwd.OLD,group,group- 用户,组的ID等信息文件.
2,/etc/shadow,shadow-,gshadow,gshadow- 用户,组密码加密文件.
3,/etc/xinetd.conf 网络守护进程主配置文件
4,/etc/inittab 系统在启动是会读取这个文件里的内容.
5,/etc/services 防止未经许可的删除或添加服务
6,/etc/rc.d/rc.sysinit 系统启动是需要读取的文件,
7,/etc/rc.d/init.d/*
以一个文件为例,其它都一样
[root@tp etc]# chmod 700 passwd
[root@tp etc]# chattr +i passwd
当chattr +i时就是禁止对文件进行修改,当我们要添加用户时,就会有麻烦,因为passwd文件禁止修改写入.所以我们还要该掉它的属性.chattr -i.
四,防止攻击系统安全设置
1,限制用户使用系统资源,主要包括资源最大进程数,内存使用量等.这样可以防止DOS类型攻击.
需要编辑文件
1 |
[root@tp /]# vi /etc/security/limits.conf |
(这三行是添加的)
* hard core 0 禁止创建core文件
* hard rss 5000 其他用户(除root)最多使用5M内存
* hard nproc 20 最多进程数限制在20
注:*表示所有登陆到linux的用户.
# End of file
[root@tp /]# vi /etc/pam.d/login
…
在文件末尾加入下面一行
session required /lib/security/pam_limits.so
2,限制控制台的访问 (控制台切换命令 chvt N)
[root@tp /]# vi /etc/securetty
…
我们注释掉
tty1
# tty2
# tty3
# tty4
# tty5
# tty6
只留下tty1,这时,root仅可在tty1终端登录
3,禁止外来ping请求.
[root@tp /]# vi /etc/rc.d/rc.local
…
在最后加入一行
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
4,防止IP地址欺骗
1 |
[root@tp /]# vi /etc/host.conf |
5,禁止su命令进入root(这一部我反复测试总是不成功,group组里的用户依然不能su成root用户.希望知道的朋友告诉我,谢谢)
[root@tp pam.d]# vi /etc/pam.d/su
…
在下面加入如下两行
auth sufficient /lib/security/pam_rootok.so debug
auth required /lib/security/pam_wheel.so group=xxx
这表示只有xxx组的用户可以su成root.
6,使用TCP_WRAPPER
在默认情况下linux系统允许所有请求,可用TCP_WRAPPER增强安全性,
在/etc/hosts.deny写入”ALL:ALL”禁止所有请求
01 |
[root@tp etc]# vi /etc/hosts.deny |
03 |
# hosts.deny This file describes the names of the hosts which are |
04 |
# *not* allowed to use the local INET services, as decided |
05 |
# by the '/usr/sbin/tcpd' server. |
07 |
# The portmap line is redundant, but it is left to remind you that |
08 |
# the new secure portmap uses hosts.deny and hosts.allow. In particular |
09 |
# you should know that NFS uses portmap! |
把允许访问的客户,或服务添加到/etc/hosts.allow,冒号左边为服务,冒号右边为授权的机器
1 |
[root@tp etc]# vi /etc/hosts.allow |
3 |
# hosts.allow This file describes the names of the hosts which are |
4 |
# allowed to use the local INET services, as decided |
5 |
# by the '/usr/sbin/tcpd' server. |
7 |
vsftp:211.101.46.253 注:仅如许IP地址为211.101.46.253的机器访问FIP服务器 |
7.删减登录信息
1 |
[root@tp ~]# rm -f /etc/issue |
2 |
[root@tp ~]# rm -f /etc/issue.net |
3 |
[root@tp ~]# touch /etc/issue |
4 |
[root@tp ~]# touch /etc/issue.net |
五,确保开启服务的安全性
我们先来看一下自己系统开启了多少服务.
1 |
[root@tp ~]# ps -eaf | wc -l |
我的是55
我们可以通过当前的进程里在来看一下都是什么服务
02 |
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ |
03 |
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND |
04 |
root 1 0.0 0.2 2592 560 ? S 21:02 0:00 init [3] |
05 |
root 2 0.0 0.0 0 0 ? SN 21:02 0:00 [ksoftirqd/0] |
06 |
root 3 0.0 0.0 0 0 ? S< 21:02 0:00 [events/0] |
07 |
root 4 0.0 0.0 0 0 ? S< 21:02 0:00 [khelper] |
08 |
root 5 0.0 0.0 0 0 ? S< 21:02 0:00 [kacpid] |
09 |
root 20 0.0 0.0 0 0 ? S< 21:02 0:00 [kblockd/0] |
10 |
root 30 0.0 0.0 0 0 ? S 21:02 0:00 [pdflush] |
11 |
root 31 0.0 0.0 0 0 ? S 21:02 0:00 [pdflush] |
12 |
root 33 0.0 0.0 0 0 ? S< 21:02 0:00 [aio/0] |
13 |
root 21 0.0 0.0 0 0 ? S 21:02 0:00 [khubd] |
14 |
root 32 0.0 0.0 0 0 ? S 21:02 0:00 [kswapd0] |
15 |
root 107 0.0 0.0 0 0 ? S 21:02 0:00 [kseriod] |
16 |
root 181 0.0 0.0 0 0 ? S< 21:03 0:00 [kmirrord] |
17 |
root 182 0.0 0.0 0 0 ? S< 21:03 0:00 [kmir_mon] |
18 |
root 190 0.0 0.0 0 0 ? S 21:03 0:00 [kjournald] |
19 |
root 1085 0.0 0.1 2604 444 ? S<s 21:03 0:00 udevd |
20 |
root 1611 0.0 0.0 0 0 ? S< 21:03 0:00 [kauditd] |
21 |
root 1745 0.0 0.0 0 0 ? S< 21:03 0:00 [kmpathd/0] |
22 |
root 1769 0.0 0.0 0 0 ? S 21:03 0:00 [kjournald] |
23 |
root 2250 0.0 0.2 2668 632 ? Ss 21:03 0:00 syslogd -m 0 |
24 |
root 2254 0.0 0.1 3352 472 ? Ss 21:03 0:00 klogd -x |
25 |
rpc 2274 0.0 0.2 2220 572 ? Ss 21:03 0:00 portmap |
26 |
rpcuser 2294 0.0 0.2 2108 756 ? Ss 21:03 0:00 rpc.statd |
27 |
root 2322 0.0 0.3 5344 992 ? Ss 21:03 0:00 rpc.idmapd |
28 |
root 2399 0.0 0.3 2612 816 ? S 21:03 0:00 /usr/sbin/smartd |
29 |
root 2409 0.0 0.2 3176 540 ? Ss 21:03 0:00 /usr/sbin/acpid |
30 |
root 2440 0.0 1.4 11192 3680 ? Ss 21:03 0:00 cupsd |
31 |
root 2497 0.0 0.6 5044 1712 ? Ss 21:03 0:00 /usr/sbin/sshd |
32 |
root 2526 0.0 0.3 2760 876 ? Ss 21:03 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid |
33 |
root 2536 0.0 0.2 1788 528 ? Ss 21:03 0:00 gpm -m /dev/input/mice -t imps2 |
34 |
htt 2565 0.0 0.1 1960 316 ? Ss 21:03 0:00 /usr/sbin/htt -retryonerror 0 |
35 |
htt 2566 0.0 1.1 8256 3024 ? S 21:03 0:00 htt_server -nodaemon |
36 |
canna 2578 0.0 6.8 19932 17628 ? Ss 21:03 0:00 /usr/sbin/cannaserver -syslog -u canna |
37 |
root 2590 0.0 0.4 7428 1204 ? Ss 21:03 0:00 crond |
38 |
xfs 2628 0.0 1.3 5692 3332 ? Ss 21:03 0:00 xfs -droppriv -daemon |
39 |
root 2638 0.0 0.2 2092 640 ? SNs 21:03 0:00 anacron -s |
40 |
root 2647 0.0 0.2 3712 740 ? Ss 21:03 0:00 /usr/sbin/atd |
41 |
dbus 2657 0.0 0.5 13296 1324 ? Ssl 21:03 0:00 dbus-daemon-1 --system |
42 |
root 2668 0.0 0.4 3156 1040 ? Ss 21:03 0:00 cups-config-daemon |
43 |
root 2679 0.0 1.7 6540 4424 ? Ss 21:03 0:00 hald |
44 |
root 2688 0.0 0.5 2916 1288 ? Ss 21:03 0:00 login -- root |
45 |
root 2689 0.0 0.1 1528 404 tty2 Ss+ 21:03 0:00 /sbin/mingetty tty2 |
46 |
root 2690 0.0 0.1 2048 404 tty3 Ss+ 21:03 0:00 /sbin/mingetty tty3 |
47 |
root 2691 0.0 0.1 3488 404 tty4 Ss+ 21:03 0:00 /sbin/mingetty tty4 |
48 |
root 2692 0.0 0.1 2368 404 tty5 Ss+ 21:03 0:00 /sbin/mingetty tty5 |
49 |
root 2693 0.0 0.1 3296 404 tty6 Ss+ 21:03 0:00 /sbin/mingetty tty6 |
50 |
root 3136 0.0 0.5 5920 1396 tty1 Ss+ 21:05 0:00 -bash |
51 |
root 3574 0.0 0.8 8400 2276 ? Ss 21:05 0:00 sshd: root@pts/0 |
52 |
root 3576 0.0 0.5 6896 1388 pts/0 Ss 21:05 0:00 -bash |
53 |
root 3608 0.0 0.4 6584 1216 pts/0 S+ 21:05 0:00 ntsysv |
54 |
root 4019 0.0 0.8 8408 2276 ? Rs 21:09 0:00 sshd: root@pts/1 |
55 |
root 4021 0.0 0.5 6912 1388 pts/1 Ss 21:09 0:00 -bash |
56 |
root 4084 0.0 0.2 2852 748 pts/1 R+ 21:17 0:00 ps -aux |
这些进程,服务,都是开机自动加载的!我们可以用命令来看一下,
[root@tp ~]# ntsysv
那些前面有*号的就是开机自动启动的服务.也就是说我们开机的话就要同时开启这么多的服务.(和我们windows里的服务是一样的,没用的完全可以关了).
我们要掌握一个原则:就是运行的服务越少,肯定系统就越安全.
上面看的是系统开机都会开启那些服务.那么那些服务是正在运行的呢?
01 |
[root@tp ~]# netstat -an |
02 |
Active Internet connections (servers and established) |
03 |
Proto Recv-Q Send-Q Local Address Foreign Address State |
04 |
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN |
05 |
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN |
06 |
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN |
07 |
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN |
08 |
tcp 0 0 :::80 :::* LISTEN |
09 |
tcp 0 0 :::22 :::* LISTEN |
10 |
tcp 0 0 :::443 :::* LISTEN |
11 |
tcp 0 880 ::ffff:192.168.0.1:22 ::ffff:192.168.0.5:2683 ESTABLISHED |
12 |
udp 0 0 0.0.0.0:32768 0.0.0.0:* |
13 |
udp 0 0 0.0.0.0:111 0.0.0.0:* |
14 |
udp 0 0 0.0.0.0:631 0.0.0.0:* |
15 |
udp 0 0 0.0.0.0:764 0.0.0.0:* |
带有LISTEN的代表正在开启的端口,开启的服务.
如果你对linux系统的启动过程了解的话.(建议先去看看,我以后也会写的)
我们进入这个目录
[root@tp ~]# cd /etc/rc.d
[root@tp rc.d]# ls
init.d rc rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local rc.sysinit
如果你的系统是X(图形化启动的话)运行级别是5,那就是rc5.d,我的是rc3.d,运行级别是3.(多用户模式)
是哪个模式就进入哪个目录,看一下
01 |
[root@tp rc.d]# cd rc3.d/ |
03 |
K01yum K16rarpd K35cyrus-imapd K50snmptrapd K84bgpd K96ipmi S13irqbalance S55sshd |
04 |
K02NetworkManager K20bootparamd K35dhcpd K50tux K84ospf6d K99readahead S13portmap S56rawdevices |
05 |
K03rhnsd K20netdump-server K35smb K50vsftpd K84ospfd K99readahead_early S14nfslock S56xinetd |
06 |
K05atd K20nfs K35vncserver K54dovecot K84ripd S00microcode_ctl S15mdmonitor S85gpm |
07 |
K05innd K20rstatd K35winbind K61ldap K84ripngd S01sysstat S18rpcidmapd S87iiim |
08 |
K05saslauthd K20rusersd K36dhcp6s K65kadmin K85mdmpd S05kudzu S19rpcgssd S90canna |
09 |
K10dc_server K20rwhod K36lisa K65kprop K85zebra S06cpuspeed S25netfs S90crond |
10 |
K10psacct K24irda K36mysqld K65krb524 K87auditd S08arptables_jf S26apmd S95anacron |
11 |
K10radiusd K25squid K36postgresql K65krb5kdc K87multipathd S08ip6tables S26lm_sensors S97messagebus |
12 |
K10xfs K28amd K45arpwatch K73ypbind K88opensm S08iptables S28autofs S98cups-config-daemon |
13 |
K12dc_client K30sendmail K45named K74nscd K89iscsi S09isdn S40smartd S98haldaemon |
14 |
K12FreeWnn K30spamassassin K46radvd K74ntpd K89netplugd S09pcmcia S44acpid S99local |
15 |
K12mailman K34dhcrelay K50netdump K74ypserv K90bluetooth S10network S54hpoj |
16 |
K15httpd K34yppasswdd K50snmpd K74ypxfrd K94diskdump S12syslog S55cups |
linux在开机时会读取/etc/rc.d/rcX.d(根据X的运行级别)
终止K开头的服务.
开启S开头的服务.
我们通过ntsysv命令所做的更改都会在这里体现出来.
好,现在应该到我们的重点了,就是要开启那些服务,关闭那些服务.
我把每一个服务都代表什么写出来,大家自己根据自己的需要来决定.
amd:自动安装NFS(网络文件系统)守侯进程
apmd:高级电源管理
Arpwatch:记录日志并构建一个在LAN接口上看到的以太网地址和IP地址对数据库
atd 运行用户用At命令调度的任务。也在系统负荷比较低时 运行批处理任务。
Autofs:自动安装管理进程automount,与NFS相关,依赖于NIS
Bootparamd:引导参数服务器,为LAN上的无盘工作站提供引导所需的相关信息
crond:Linux下的计划任务
Dhcpd:启动一个DHCP(动态IP地址分配)服务器
Gated:网关路由守候进程,使用动态的OSPF路由选择协议
gpm gpm为文本模式下的Linux程序如mc(Midnight Commander)提供了
鼠标的支持。它也支持控制台鼠标的拷贝,粘贴操作以及弹出式菜单。
Httpd:WEB服务器
Inetd:支持多种网络服务的核心守候程序
Innd:Usenet新闻服务器
keytable 该程序的功能是转载您在/etc/sysconfig/keyboards里说明的键盘
映射表,该表可以通过kbdconfig工具进行选 择。您应该使该程序
处于激活状态。
ldap LDAP代表Lightweight Directory Access Protocol, 实现了目录
访问协议的行业标准。
Linuxconf:允许使用本地WEB服务器作为用户接口来配置机器
Lpd:打印服务器
Mars-nwe:mars-nwe文件和用于Novell的打印服务器
mcserv Midnight Commander服务进程允许远程机器上的用户通过Midnight
Commander文件管理器操作本机文件。服务进程用PAM来验证用户,
需要给出“用户名/口令”以通过验证
named:DNS服务器
netfs:安装NFS、Samba和NetWare网络文件系统
network:激活已配置网络接口的脚本程序
nfs:打开NFS服务
nscd:nscd(Name Switch Cache daemon)服务器,用于NIS的一个支持服务,它高速缓存用户口令和组成成员关系
Pcmcia pcmcia主要用于支持笔记本电脑。
portmap:RPC portmap管理器,与inetd类似,它管理基于RPC服务的连接
postgresql:一种SQL数据库服务器
random 保存和恢复系统的高质量随机数生成器,这些随机数是系统一些随
机行为提供的
routed:路由守候进程,使用动态RIP路由选择协议
rstatd:一个为LAN上的其它机器收集和提供系统信息的守候程序
ruserd:远程用户定位服务,这是一个基于RPC的服务,它提供关于当前记录到LAN上一个机器日志中的用户信息
rwalld:激活rpc.rwall服务进程,这是一项基于RPC的服务,允许用户给每个注册到LAN机器上的其他终端写消息
rwhod:激活rwhod服务进程,它支持LAN的rwho和ruptime服务
sendmail:邮件服务器sendmail
smb:Samba文件共享/打印服务
snmpd:本地简单网络管理候进程
squid:激活代理服务器squid
syslog:一个让系统引导时起动syslog和klogd系统日志守候进程的脚本
Webmin webmin是基于web的集系统管理与网络管理于一身的强大管理工具。
利用webmin的强大功能,用户可以通过web浏览器来方便地设置自
己的服务器、dns、samba、nfs、本地/远程文件系统以及许多其他的
系统配置。
xfs:X Window字型服务器,为本地和远程X服务器提供字型集
xntpd:网络时间服务器
ypbind:为NIS(网络信息系统)客户机激活ypbind服务进程
yppasswdd:NIS口令服务器
ypserv:NIS主服务器
gpm:管鼠标的
identd:AUTH服务,在提供用户信息方面与finger类似
可能还有不全的解释,希望大家能补上.
六,日志的安全.
我在这里只讲解日志的安全问题,也就是通过日志来查看那些可疑的用户登陆过机器.不会详细介绍日志方面的知识.(关于linux日志我认为是很重要的东西,作为一名系统维护人员,必须对linux日志有一定了解.我也会马上详细写这方面的文章.)
三个重要的日志文件
/var/log/wtmp 记录每个用户登陆和推出时间的永久记录.
/var/run/utmp 记录当前登陆到系统的每个用户信息.
/var/log/lastlog 每个用户最后一次登陆的信息(最新的信息)
wtmp和utmp都是二进制文件,它们要用命令来查看内容.
1,命令who,查看utmp文件当前的每个用户的信息,它默认输出包括用户名,终端类型,登陆时间及远程主机.
如下:
[root@tp log]# who
root pts/0 May 4 22:10 (192.168.0.5)
如果指明了文件,则回显示自wtmp创建以来所有登陆的用户信息.
[root@tp log]# who /var/log/wtmp
root tty1 May 4 20:44
root pts/0 May 4 20:52 (211.101.46.195)
root tty1 May 4 21:05
root pts/0 May 4 21:05 (211.101.46.195)
root pts/1 May 4 21:09 (192.168.0.5)
root pts/0 May 4 21:38 (192.168.0.5)
root pts/0 May 4 22:10 (192.168.0.5)
2,命令w,查看utmp文件并显示当前系统中每个用户和它所运行的进程信息.
如:
[root@tp log]# w
23:00:48 up 54 min, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.0.5 22:10 0.00s 0.03s 0.00s w
3,users,显示当前当前登陆的用户数量.
如,
[root@tp log]# users
root root
这表明两个root用户在同时登陆这台机器.
4,last命令,用来显示wtmp文件第一次 创建以来所有登陆过的用户.
如:
02 |
root pts/1 192.168.0.5 Fri May 4 23:01 - 23:02 (00:00) |
03 |
root pts/0 192.168.0.5 Fri May 4 22:10 still logged in |
04 |
reboot system boot 2.6.9-34.EL Fri May 4 22:07 (00:59) |
05 |
root pts/0 192.168.0.5 Fri May 4 21:38 - down (00:27) |
06 |
reboot system boot 2.6.9-34.EL Fri May 4 21:36 (00:29) |
07 |
root pts/1 192.168.0.5 Fri May 4 21:09 - down (00:25) |
08 |
root pts/0 211.101.46.195 Fri May 4 21:05 - down (00:29) |
09 |
root tty1 Fri May 4 21:05 - down (00:30) |
10 |
reboot system boot 2.6.9-34.EL Fri May 4 21:03 (00:31) |
11 |
root pts/0 211.101.46.195 Fri May 4 20:52 - crash (00:11) |
12 |
root tty1 Fri May 4 20:44 - crash (00:18) |
13 |
reboot system boot 2.6.9-34.EL Fri May 4 20:32 (01:02) |
14 |
reboot system boot 2.6.9-34.EL Tue May 1 08:32 (3+13:02) |
15 |
reboot system boot 2.6.9-34.EL Tue May 1 08:27 (3+13:07) |
16 |
reboot system boot 2.6.9-34.EL Tue May 1 08:24 (3+13:10) |
17 |
reboot system boot 2.6.9-34.EL Tue May 1 08:13 (3+13:22) |
18 |
wtmp begins Tue May 1 08:13:04 2007 |
我们也可以指明用户
01 |
[root@tp log]# last root |
02 |
root pts/1 192.168.0.5 Fri May 4 23:01 - 23:02 (00:00) |
03 |
root pts/0 192.168.0.5 Fri May 4 22:10 still logged in |
04 |
root pts/0 192.168.0.5 Fri May 4 21:38 - down (00:27) |
05 |
root pts/1 192.168.0.5 Fri May 4 21:09 - down (00:25) |
06 |
root pts/0 211.101.46.195 Fri May 4 21:05 - down (00:29) |
07 |
root tty1 Fri May 4 21:05 - down (00:30) |
08 |
root pts/0 211.101.46.195 Fri May 4 20:52 - crash (00:11) |
09 |
root tty1 Fri May 4 20:44 - crash (00:18) |
10 |
wtmp begins Tue May 1 08:13:04 2007 |
5,命令ac,根据wtmp文件中每个用户进入和退出时间.(以小时计算),不用参数代表全部
[root@tp log]# ac
total 2.88
[root@tp log]# ac -d 代表每天总连接时间
Today total 2.89
[root@tp log]# ac -p 代表每个用户总连接时间
root 2.89
total 2.89
我们要养成经常查看日志来观察有无可疑用户等问题的存在.
七,防火墙
应该说防火墙还是很有必要安装并配置的,应为要说的太多,我会在另一篇文章里专门介绍.
八,备份
及时有效的备份会给使我们及时恢复系统在被破坏前的状态.篇幅有限,我同样会在另一篇文章里专门介绍.
via:linux系统安全详解