Linux登陆档应用示例

实验环境:
1,远程Client ip为192.168.1.130,以及Server192.168.1.128;
2,便于管理日志,并且安全。
实验步骤:

1,配置Server,重启服务
[root@localhost ~]# vi /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console
*.*                                                     @192.168.1.130
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure
# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog
# Log cron stuff
cron.*                                                  /var/log/cron
# Everybody gets emergency messages
*.emerg                                                 *
# Save news errors of level crit and higher in a special file.
重启服务:
[root@localhost ~]# /etc/init.d/syslog restart

2,配置Client,重启服务
[root@localhost ~]# vi /etc/sysconfig/syslog
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-m 0 -r"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
#    once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
#
SYSLOG_UMASK=077
# set this to a umask value to use for all log files as in umask(1).
# By default, all permissions are removed for "group" and "other".
重启服务:
[root@localhost ~]# /etc/init.d/syslog restart

3,观察syslogd
[root@localhost ~]# netstat  -tulnp | grep syslogd
udp        0      0 0.0.0.0:514                 0.0.0.0:*                               3618/syslogd

相关推荐