# hostname teacher.uplook.com
# vim /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=teacher.uplook.com

# vim /etc/hosts

127.0.0.1               teacher.uplook.com teacher localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.3.2     teacher.uplook.com

# date -s "2013-08-09 09:56:00"

# mail

# date -s "2013-08-09  10:20:22"
# date 
# at  10:21
> ls  /
ctrl+d  结束
# atq
# at 10:50
> echo hello
> cp /etc/passwd /test/pass
ctrl+d  结束

# atq
5       2013-08-09 10:50 a root
# at -c 5
# at -r 5
# atq

# useradd tom

------------------------
cron

# crontab -e 

30   20    *   *   *   /sbin/init  0
# crontab -l
# crontab -r

# vim /etc/crontab
# cd /etc/cron.daily/

# cd /test
# vim program.sh

#!/bin/bash
touch /test/file1
time=`date`
echo $time >>/test/file1

# chmod a+x  program.sh 

# crontab -e
* *  *  *  *      /test/program.sh

# watch -n 1 cat /test/file1

-----------------------------
# su - tom
$ crontab -e
* * * * *  /bin/cp  /etc/passwd  /home/tom
$ cd /home/
$ watch -n 1 ls /home/tom
移除已经设置的计划任务
$ crontab -r
查看已经设置的计划任务
$ crontab -l

# cat /etc/cron.deny
把tom加入到黑名单
# echo "tom"  >> /etc/cron.deny

# su - tom
$ crontab -e
You (tom) are not allowed to use this program (crontab)
See crontab(1) for more information

# echo "tom"  > /etc/cron.allow
# cat /etc/cron.allow
tom
# su - tom
$ crontab -e

# su - mike
$ crontab -e
You (mike) are not allowed to use this program (crontab)
See crontab(1) for more information
----------------------------------
日志

# ps aux |grep syslog
root      3491  0.0  0.1   1728   568 ?        Ss   06:37   0:00 syslogd -m 0
root     19188  0.0  0.1   3920   684 pts/2    R+   13:37   0:00 grep syslog

主配置文件
# vim /etc/syslog.conf 

# tail -0f /var/log/messages
打开另一个终端 
# service network restart

# tail -0f /var/log/secure
让其他人登录到自己的机器
-----------------------
自定义日志
# cd /etc/ssh
# vim sshd_config

 33 #SyslogFacility AUTHPRIV
 34 SyslogFacility local1

# vim /etc/syslog.conf
local1.*               /var/log/sshlog

ssh服务重启
# service sshd restart
syslog服务重启
# service syslog restart

# cd /var/log/
# ls
# tail -0f /var/log/sshlog
让其他人登录到自己的机器,看日志内容变化。

----------------------
[root@teacher ~]# service iptables stop
[root@teacher ~]# getenforce
Permissive
[root@teacher ~]# vim /etc/selinux/config
改成 SELINUX=disabled 

在远程日志服务器 192.168.3.3

[root@teacher ~]# cd /etc/sysconfig
[root@teacher sysconfig]# vim syslog
  6 SYSLOGD_OPTIONS="-m 0 -r"

日志服务重启
[root@teacher sysconfig]# service syslog restart

--------------------
发送端:另一台机器 192.168.3.2
# vim /etc/ssh/sshd_config
 33 SyslogFacility AUTHPRIV
ssh服务重启
# service sshd restart

备份配置文件
[root@teacher ~]# cp /etc/syslog.conf  /etc/syslog.conf.bak
修改配置文件
[root@teacher ~]# vim /etc/syslog.conf
把所有的服务的所有日志都记录到ip地址为 192.168.3.3机器上
*.*            @192.168.3.3
重启日志服务
[root@teacher ~]# service syslog restart

-----------------------
远程日志服务器 

[root@teacher ~]# tail -0f /var/log/secure

window xp上,使用xshell 来访问192.168.3.2
登录成功以后,可以在远程日志服务器看到登录的日志。
--------------------------------------------------
---------------------------------
rhel6  远程日志

远程日志服务器  192.168.3.3

# vim /etc/rsyslog.conf
修改
$ModLoad imtcp.so
$InputTCPServerRun 514
日志服务重启
# service rsyslog restart

查看514端口是否处于监听状态
# netstat -altunp |grep :514
------------
发送端   192.168.3.2
# vim /etc/rsyslog.conf
修改内容
*.* @192.168.3.3:514
服务器重启
# service rsylog restart

----------------------
远程日志服务器 

# tail -0f /var/log/secure

window xp上,使用xshell 来访问192.168.3.2
登录成功以后,可以在远程日志服务器看到登录的日志。