Chinaunix首页 | 论坛 | 博客
  • 博客访问: 382364
  • 博文数量: 87
  • 博客积分: 2810
  • 博客等级: 少校
  • 技术积分: 825
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 22:34
文章分类

全部博文(87)

文章存档

2010年(25)

2009年(43)

2008年(19)

分类:

2008-11-27 22:42:57

1. install
cd /usr/ports/security/sudo
make install clean
2. configure
编辑sudo的配置文件/usr/local/etc/sudousers 直接用visudo就可以了
visudo
在最后面添加如下一行,允许svn用户能以root权限,并且不需要root密码,执行adduser svn两个命令
svn     ALL = NOPASSWD: /usr/local/bin/svn, /usr/sbin/adduser
3. test
first
add a new user svn have no root perrmit
second
add the user to the sodu configure file sudousers use visudo
third
login with user svn
type the command adduser
adduser: ERROR: you must be the super-user (uid 0) to use this utility.
typethe command sudo adduser
$ sudo adduser
Username: svn2
Full name: svn2.svn
Uid (Leave empty for default):
Login group [svn2]:
Login group is svn2. Invite svn2 into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]:
Home directory [/home/svn2]:
Use password-based authentication? [yes]: y
Use an empty password? (yes/no) [no]: n 
Use a random password? (yes/no) [no]: n
Enter password:
Enter password again:
Lock out the account after creation? [no]: n
Username   : svn2
Password   : *****
Full Name  : svn2.svn
Uid        : 1005
Class      :
Groups     : svn2
Home       : /home/svn2
Shell      : /bin/sh
Locked     : no
OK? (yes/no): y
adduser: INFO: Successfully added (svn2) to the user database.
Add another user? (yes/no): n
Goodbye!
$ id svn2
uid=1005(svn2) gid=1005(svn2) groups=1005(svn2)
这就说明了sudo配置成功
参考文档:

Sudoers Manual
 
阅读(754) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~