UbuntuLinuxsudo logging Configuration

Source: Internet
Author: User
Environment: Ubuntu12.04server. The permission of sudo is assigned to mongodo for management. Examples are available in/usr/share/doc/sudo/examples/sample. sudoers. Because the rsyslog (RemoteSystemLog) is used in Ubuntu12.04 and is an upgraded version of syslog, but the method of use is the same as that of syslog. Many materials found on the internet refer to modifying/etc/syslog. con.

Environment: Ubuntu 12.04 server.

The permission of sudo is assigned to mongodo for management. Examples are available in/usr/share/doc/sudo/examples/sample. sudoers.

Because rsyslog (Remote System Log) is used in Ubuntu 12.04 and is an upgraded version of syslog, but the usage method is the same as that of syslog. Many information found on the internet says to modify/etc/syslog. conf file (this is used in many other versions of linux and later versions of ubuntu), actually modify/etc/rsyslog. conf is the same.

1. Configure/etc/rsyslog. conf
Add a line: local2.debug/var/log/sudo. log (separated by tab in the middle)

2. the root user executes the mongodo modification/etc/sudoers file:
Add:

##
# Override built-in defaults
##
Defaults syslog = auth
Defaults> ALL! Set_logname
Ults: FULLTIMERS! Lecture
Ults: millert! Authenticate
Defaults @ SERVERS log_year, logfile =/var/log/sudo. log
Defaults! PAGERS noexec

Defaults logfile =/var/log/sudo. log

3. Restart rsyslog
Service rsyslog restart

 


4. Inspection
We can see that the sudo. log file is generated under/var/log. The following is a record of the wrong sudo operation:

Tsli @ ubuntu:/usr/lib $ sudo ls
[Sudo] password for tsli:
Tsli is not in the sudoers file. This incident will be reported.

Reading:

Linux how to add users to become sudoers http://www.linuxidc.com/Linux/2013-06/86098.htm

Linux basics -- sudoers file writing http://www.linuxidc.com/Linux/2013-06/85347.htm

Defining Linux User Permissions is up to you -- sudo command http://www.linuxidc.com/Linux/2013-04/83580.htm

Automatically add sudo permission script http://www.linuxidc.com/Linux/2012-11/74471.htm

Linux configure sudo permission http://www.linuxidc.com/Linux/2012-10/71795.htm

Sudo configuration temporary get root privileges http://www.linuxidc.com/Linux/2012-09/69525.htm

CentOS sudo command configuration http://www.linuxidc.com/Linux/2012-08/67841.htm

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.