- 论坛徽章:
- 0
|
The regular useradd/userdel commands won't generate any syslog messages. So if you want the commands logged using the syslog mechanism specifically, you must replace the regular useradd/userdel with something that will do it.
For example:
# mv /usr/sbin/useradd /usr/sbin/useradd.real
# vi /usr/sbin/useradd
-----
#!/usr/bin/sh
/usr/sbin/useradd.real "$@"
RESULT=$?
if [ $RESULT -eq 0 ]; then
logger -t useradd -p local0.notice -i "\"useradd $*\" executed successfully by $(whoami)"
else
logger -t useradd -p local0.notice -i "Failed \"useradd $*\" attempt by $(whoami)"
fi
return $RESULT
----
# chmod a+x /usr/sbin/useradd
... and similarly for userdel.
|
评分
-
查看全部评分
|