环境:Ubuntu 12.04 server。sudo权限分配使用visudo来管理。示例在/usr/share/doc/sudo/examples/sample.sudoers下有。因为Ubuntu 12.04中使用的是rsyslog(Remote System Log),是syslog的升级版,但是使用方法跟syslog相同,在网上找到的很多资料都说修改/etc/syslog.conf文件(这是很多其他版本的linux和早期版本中ubuntu中用的),实际上修改/etc/rsyslog.conf是一样的。1.配置/etc/rsyslog.conf
在其中加入一行:local2.debug /var/log/sudo.log(中间用tab分隔)2.root用户执行visudo修改/etc/sudoers文件:
在其中添加:##
# Override built-in defaults
##
Defaults syslog=auth
Defaults>ALL !set_logname
Defaults:FULLTIMERS !lecture
Defaults:millert !authenticate
Defaults@SERVERS log_year, logfile=/var/log/sudo.log
Defaults!PAGERS noexecDefaults logfile=/var/log/sudo.log3.重启rsyslog
service rsyslog restart
4.检验
可以看到在/var/log下面生成了sudo.log文件,对于错误的sudo操作的记录如下:tsli@ubuntu:/usr/lib$ sudo ls
[sudo] password for tsli:
tsli is not in the sudoers file. This incident will be reported.
相关阅读:Linux怎么添加用户成为sudoers http://www.linuxidc.com/Linux/2013-06/86098.htmLinux基础——sudoers文件的写法 http://www.linuxidc.com/Linux/2013-06/85347.htm定义Linux用户权限由你决定--sudo命令 http://www.linuxidc.com/Linux/2013-04/83580.htm自动添加sudo权限脚本 http://www.linuxidc.com/Linux/2012-11/74471.htmLinux配置sudo权限 http://www.linuxidc.com/Linux/2012-10/71795.htmsudo配置临时取得root权限 http://www.linuxidc.com/Linux/2012-09/69525.htmCentOS 系统sudo命令配置 http://www.linuxidc.com/Linux/2012-08/67841.htm更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2Android 编译环境配置搭建(Ubuntu 12.04)及环境导致编译错误QAUbuntu忘记登录密码相关资讯 ubuntu sudo Sudo
- Linux下sudo配置和用法 (今 07:51)
- Linux中sudo的用法和sudoers配置详 (08月21日)
- 输错密码?这个 sudo 会“嘲讽”你 (04月16日)
| - CentOS用户权限管理--su与sudo (08月31日)
- CentOS下的sudo相关配置的总结归纳 (06月23日)
- Linux操作系统配置sudo (12/15/2015 21:39:50)
|
本文评论 查看全部评论 (0)