How to configure sudo in debian or ubuntu
2010-04-28, Posted in Configure | 4 回复
Introduction
Sudo is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. The basic philosophy is to give as few privileges as possible but still allow people to get their work done.
Debian’s sudo package has the password timeout set to 15 minutes. This means that when you first enter your password, as long as you don’t wait more than 15 minutes between sudo commands, you won’t have to enter it again. The password timeout can be immediately expired with sudo -k.
Debian’s sudo is compiled with
--with-exempt=sudo
--with-secure-path="/usr/local/sbin:/usr/local/bin:/usr/sbin:
As a consequence, the PATH of the user is ignored except if the user is in group sudo.
Installing SUDO in Debian
# apt-get install sudo
sudo is configured entirely through the file /etc/sudoers. This file controls the commands which users are allowed to run.
# vim /etc/sudoers
add a line:
user ALL=(ALL) ALL
To run one command as root:
#sudo command
For more commands, run your shell with sudo.
#sudo sh (if sh is your shell.)
Be careful when you are root. When you are done, type exit
For more details about sudo options check man pages of sudo.Click here for sudo man page.
some random SUDO examples
# groups User_Alias ROOT = user1, user2, user3 User_Alias WEBMASTERS = user4, user5, user6 # commands Cmnd_Alias APACHE = /usr/local/sbin/kickapache Cmnd_Alias TAIL = /usr/bin/tail Cmnd_Alias SHUTDOWN = /sbin/shutdown Cmnd_Alias APT = /usr/bin/apt-get, /usr/bin/dpkg # privileges ROOT ALL = (ALL) ALL WEBMASTERS ALL = PASSWD : APACHE, TAIL admin ALL = NOPASSWD : /etc/init.d/apache
相关日志
- (中文) 重设置debian 6系统中mysql5.1的root密码
- (中文) Debian6下安装Mysql,Ubuntu下适用
- (中文) -bash: /bin/rm: Argument list too long解决办法
- Add a User on Ubuntu Server Or Debian Server
- (中文) debian或者Ubuntu添加虚拟网卡
- (中文) Debian安装配置Iptables防火墙 (3)
- NO_PUBKEY AED4B06F473041FA
- (中文) Debian从lenny升级到squeeze及常用的源 (1)
- (中文) Debian32位Linux系统大内存支持 (1)
- How to usage SNMP in debian
April 28th, 2010 on 16:04:22
嘿嘿,我又来学习了
April 28th, 2010 on 22:55:50
我也来看看`~ 还是看不懂`.呵呵`
May 1st, 2010 on 20:52:40
五一快乐啊!!
哈哈,来晚了,还不要介意
June 20th, 2010 on 18:13:11
添加你的文章链接到我的百度空间啦,希望不要介意。
懒得去man sudo看英文了,呵呵