LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 746|回复: 4

sudo和root的问题?

[复制链接]
发表于 2005-5-14 17:21:52 | 显示全部楼层 |阅读模式
用sudo执行程序,和用root执行程序,之间有区别吗?
发表于 2005-5-14 17:26:58 | 显示全部楼层
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

# Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now


peter    ALL=(ALL) ALL

如果是只有這一句就是一樣的了....peter的sudo就和root完全一樣了.
sudo可控制性?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-14 17:38:04 | 显示全部楼层
能不能介绍一下特点呢,或举个例子说明一下。
我用sudo根本体现不出和root的区别,还有,每个人的环境不同,有个人用户,有服务器的。
那这么样才能更好管理sudo呢,
或者说更好的控制运行权限
回复 支持 反对

使用道具 举报

发表于 2005-5-14 19:03:18 | 显示全部楼层

如果可以請選用google.com/linux搜索

Host_Alias ALLI = 192.168.7.112,shlinux
User_Alias ALLU = peter,lfm
Cmnd_Alias ALLC = /sbin/fdisk,/bin/mount,/sbin/shutdown
ALLU    ALLI = ALLC



其中
Host_Alias行中的ALLI為變數一定要大寫,其他的行也一樣,命令要告訴地址

ALLU    ALLI = ALLC

允許peter,lfm兩個用戶在192.168.7.112,或shlinux上運行
/sbin/fdisk,/bin/mount,/sbin/shutdown這些命令...

要說一樣是su -才對.
回复 支持 反对

使用道具 举报

发表于 2005-5-14 19:32:40 | 显示全部楼层
sudo只是在为指定特殊权限和安全目的而设,应谨着够用和尽量减少权限,不然偶尔发晕的时候就会sudo rm -rf / 同时*nix的架构也就决定了除必须的管理工作之外根本无须管理员权限
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表