[问题]sudo无法使用

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

[问题]sudo无法使用

#1

帖子 lingai521 » 2008-07-15 14:50

各位大虾:
小弟俺刚接触ubuntu,今天装了8.04版,我也么去修改什么文件,到后来sudo不能使用了,不知道是出了什么问题,提示如下:
>>> sudoers file: syntax error, line 12 <<<
sudo: parse error in /etc/sudoers near line 12

我该怎么去修改才能使用sudo???????????急!!!!!
希望哪位大虾指导。
头像
solcomo
帖子: 2838
注册时间: 2007-04-25 13:12

#2

帖子 solcomo » 2008-07-15 15:01

进入recovery mode
visudo
看看/etc/sudoers的第12句有什么问题
♜♞♝♛♚♝♞♜
♟♟♟♟♟♟♟♟
♙♙♙♙♙♙♙♙
♖♘♗♕♔♗♘♖

☠☯⚔⚓☣☦☃☕
☹☻☪☭☬⚖⚛⚜
ℜℳℬ™ ℋℯℓ℘ ℳℭ
sƂɐʍ рǀɹoʍ əɥʇ oS
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

#3

帖子 Nile » 2008-07-15 15:02

先su root

再visudo,12行语法错了
Thinkpad T400
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

[问题]sudo无法使用

#4

帖子 lingai521 » 2008-07-15 15:09

recovery mode
bash: recovery:找不到命令
头像
solcomo
帖子: 2838
注册时间: 2007-04-25 13:12

#5

帖子 solcomo » 2008-07-15 15:17

按3楼的方法
要不还得重启
♜♞♝♛♚♝♞♜
♟♟♟♟♟♟♟♟
♙♙♙♙♙♙♙♙
♖♘♗♕♔♗♘♖

☠☯⚔⚓☣☦☃☕
☹☻☪☭☬⚖⚛⚜
ℜℳℬ™ ℋℯℓ℘ ℳℭ
sƂɐʍ рǀɹoʍ əɥʇ oS
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

[问题]sudo无法使用

#6

帖子 lingai521 » 2008-07-15 15:26

:~$ su root
口令:
su:鉴定故障
victory@ares:~$ visudo
visudo: /etc/sudoers: Permission denied
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

Re: [问题]sudo无法使用

#7

帖子 Nile » 2008-07-15 15:33

lingai521 写了::~$ su root
口令:
su:鉴定故障
victory@ares:~$ visudo
visudo: /etc/sudoers: Permission denied
确定你输入的是root密码
Thinkpad T400
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

#8

帖子 lingai521 » 2008-07-15 15:38

但是我安装ubuntu的时候没有要设置root用户密码,不知道默认密码是多少,空的也是那样的提示
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

#9

帖子 Nile » 2008-07-15 15:41

没辙了

重启进recovery mode吧
Thinkpad T400
delectate
帖子: 18311
注册时间: 2008-01-09 22:41

#10

帖子 delectate » 2008-07-15 15:44

lingai521 写了:但是我安装ubuntu的时候没有要设置root用户密码,不知道默认密码是多少,空的也是那样的提示
没设置肯定鉴定错误啊

sudo passwd root

设置root密码再试试
delectate
帖子: 18311
注册时间: 2008-01-09 22:41

#11

帖子 delectate » 2008-07-15 15:46

先执行 su
输入口令
再gedit /etc/sudoers

我这里12行是空的,什么都没有,不知道lz你哪里有什么错误……

贴一下:


# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

#12

帖子 lingai521 » 2008-07-15 15:47

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD:
ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
"/etc/sudoers.tmp" 33 lines, 797 characters


打开了,画面是这样的,请指导。
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#13

帖子 BigSnake.NET » 2008-07-15 15:52

修改 sudoers 文件必须用 root 身份
成为 root 有两个办法, 一个是su,需要root密码,但是默认没有设所以不能使用su。第二个办法是用sudo,但是sudo已经出故障了。

所以唯一的办法是重启进 recovery mode , 然后用 visudo 修改 sudoers
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
lingai521
帖子: 38
注册时间: 2008-07-15 14:45

[问题]sudo无法使用

#14

帖子 lingai521 » 2008-07-15 16:00

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD:
ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Entries for Smb4K users.
# Generated by Smb4K. Please do not modify!
User_Alias SMB4KUSERS = victory
Defaults:SMB4KUSERS env_keep += "PASSWD USER"
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_kill
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_umount
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_mount
# End of Smb4K user entries.
~
我要怎么样修改才可以用啊
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

Re: [问题]sudo无法使用

#15

帖子 BigSnake.NET » 2008-07-15 16:02

lingai521 写了:# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD:
ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Entries for Smb4K users.
# Generated by Smb4K. Please do not modify!
User_Alias SMB4KUSERS = victory
Defaults:SMB4KUSERS env_keep += "PASSWD USER"
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_kill
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_umount
SMB4KUSERS ares = NOPASSWD: /usr/bin/smb4k_mount
# End of Smb4K user entries.
~
我要怎么样修改才可以用啊
多了行 ALL
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
回复