分页: 1 / 2
Ubuntu禁用了root?
发表于 : 2011-03-02 1:49
由 ukid
是这样吗?sudo时候应该输入root密码而不是当前用户的密码,而Ubuntu却选择后者;su时又需要输入root密码,这样风格不一致让人迷糊,而且sudo输入当前用户迷你嘛是存在安全风险的,普通用户就可以用sudo破坏系统,似乎Red Hat的版本是严格按照切换到哪个用户就输入哪个用户的密码来操作的。
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 2:11
由 AutoXBC
你理解有误。sudo 是 su 到某个用户然后 do 他有权限 do 的事情,所以只需要那个用户的密码,至于可以 do 什么取决于 root 在 /etc/sudoers 中的设定。如果你所在的用户没被赋予破坏系统的权限,你 sudo 过去一样什么都做不了。
事实上 su 也不是你理解的需要 root 密码,取决与你想 su 到哪个用户,因为大家常常 su 到 root,所以会有 su 就是到 root 的误解。
su
1.作用
u的作用是变更为其它使用者的身份,超级用户除外,需要键入该使用者的密码。
2.格式
u [选项]... [-] [USER [ARG]...]
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 2:37
由 ukid
nobody@localhost:~$ sudo -i
[sudo] password for nobody:
root@localhost:~#whoami
root
第一段能再详细些吗?我这里从nobody切换到root,为什么问我要nobody的密码而不是root密码?
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 7:51
由 枫叶饭团
ubuntu 默认root密码是随机的,如果要root密码?用猜?
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 8:58
由 tenzu
如果你不是系统管理员,或者这台电脑不是你的私人物品,你是不应该拥有root权限的
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:18
由 jtshs256
没装sudo的路过……
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:20
由 ukid
枫叶饭团 写了:ubuntu 默认root密码是随机的,如果要root密码?用猜?
可是我用
root@localhost:~#passwd
重设了root密码,怎么改动才能让sudo问root密码呢?
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:31
由 灰色小狼
sudo不是切换到root再去做某件事,输入密码不过是对正在操作计算机的人进行一个身份验证,所以让sudo问root密码是不可能的,sudo跟root本来就毫不相干
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:41
由 懒蜗牛Gentoo
ukid 写了:nobody@localhost:~$ sudo -i
[sudo] password for nobody:
root@localhost:~#whoami
root
第一段能再详细些吗?我这里从nobody切换到root,为什么问我要nobody的密码而不是root密码?
因为nobody被赋予了临时变身成root的特权,你再创建的其他的普通用户试试,看还能不能sudo成root
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:48
由 灰色小狼
sudo allows a permitted user to execute a command as
the superuser or another user, as specified in the
sudoers file. The real and effective uid and gid are
set to match those of the target user as specified in
the passwd file and the group vector is initialized
based on the group file (unless the -P option was
specified). If the invoking user is root or if the
target user is the same as the invoking user, no
password is required. Otherwise, sudo requires that
users authenticate themselves with a password by
default (NOTE: in the default configuration this is the
user's password, not the root password). Once a user
has been authenticated, a time stamp is updated and the
user may then use sudo without a password for a short
period of time (5 minutes unless overridden in
sudoers).
sudo determines who is an authorized user by consulting
the file /etc/sudoers.
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:49
由 smallapple
ukid 写了:枫叶饭团 写了:ubuntu 默认root密码是随机的,如果要root密码?用猜?
可是我用
root@localhost:~#passwd
重设了root密码,怎么改动才能让sudo问root密码呢?
修改 /etc/sudoers,加上一行
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:51
由 leeaman
root不需要sudo的...sudo什么会问root密码,root等级比可以用sudo的sudoer高级的
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:51
由 灰色小狼
1.sudo可以使受限用户以超级用户或其他用户身份执行一个命令
2.在默认情况下,sudo要求用户输入自己的密码来证明身份
3.sudo通过/etc/sudoers来验证谁是授权用户
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 9:53
由 灰色小狼
If sudo is run by root and the SUDO_USER environment
variable is set, sudo will use this value to determine
who the actual user is.
如果root用户运行sudo,sudo会通过SUDO_USER来判定用户的真实身份
Re: Ubuntu禁用了root?
发表于 : 2011-03-02 17:02
由 chenxing
ukid 写了:是这样吗?sudo时候应该输入root密码而不是当前用户的密码,而Ubuntu却选择后者;su时又需要输入root密码,这样风格不一致让人迷糊,而且sudo输入当前用户迷你嘛是存在安全风险的,普通用户就可以用sudo破坏系统,似乎Red Hat的版本是严格按照切换到哪个用户就输入哪个用户的密码来操作的。
这是个老问题了,你用自己的密码可以root做的事情,是因为在配置文件中说了你是受信任的用户,不是所有的普通用户都能这样做。这样可以确保你在平时没有root权限,避免误操作。而在做系统管理时可以用sudo完成,也并不复杂。
一般来讲,sudo就是用你自己的密码的,因为是该用户被授权了以其它用户的名义做事情,该用户未必掌握其它用户的密码。而su是切换成其它用户,这两者并不是完全相同的。