You are not logged in.

#1 2010-10-29 13:16:45

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

sudo doesn't work, reporting error in sudoers file, wierd behaviour

Trying to do something with sudo, it returns:

>>> /etc/sudoers: syntax error near line 5 <<<
sudo: parse error in /etc/sudoers near line 5
sudo: no valid sudoers sources found, quitting

My /etc/sudoers:

Defaults   env_reset

root   ALL=(ALL) ALL
alex   ALL=(ALL) ALL

Defaults:alex timestamp_timeout=0

Where is my error?

Last edited by Mr. Alex (2010-10-29 14:20:42)

Offline

#2 2010-10-29 13:19:50

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

What's that "alex" doing in the defaults line?

Offline

#3 2010-10-29 13:55:13

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

It's there for disabling 15 minutes "sudo" acception without alex password.

Offline

#4 2010-10-29 14:08:04

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

I misread, that's indeed correct syntax. Sorry, can't help you further I'm afraid.

Offline

#5 2010-10-29 14:11:43

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

Try to comment every single line and check out. Have you edited the file in the last time?

Offline

#6 2010-10-29 14:18:32

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

> Try to comment every single line and check out.

Tried to comment one, then another... Until I commented all of them. Still error near line 5...

> Have you edited the file in the last time?

Yes, just today, after installing Arch (I was reinstalling it).

Just noticed that I have "/etc/sudoers.d" directory which contains nothing. Maybe I should do something with it?

Offline

#7 2010-10-29 14:26:35

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

Mine is empty, too. do you have a sudoers.pacnew? try this one.

EDIT:

I dunno whether it makes a difference or not,...did you use visudo? Maybe it troubles editing 'manually' via "<editor> /etc/sudoers".

Last edited by linux-ka (2010-10-29 14:30:21)

Offline

#8 2010-10-29 14:30:46

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

No, I don't. Can you post your sudoers file for me to try?

Offline

#9 2010-10-29 14:33:14

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

this is my current sudoers.pacnew....looks a bit weird. the early versions have been more clear...

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                           /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##

my current sudoers file:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# 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

Last edited by linux-ka (2010-10-29 14:34:59)

Offline

#10 2010-10-29 14:44:04

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

I tried this and it returns error near line 68 this time.
What version of sudo do you have in your system? Mine is 1.7.4.p4-1.

Offline

#11 2010-10-29 15:00:29

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

Try hitting enter on the last line of the file

Online

#12 2010-10-29 15:05:38

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

That helped! Thanks! I pretty sure I didn't have this "sudo" peculiarity before...
Do all the Arch config files need this "enter in the end of file"?

Last edited by Mr. Alex (2010-10-29 15:11:09)

Offline

#13 2010-10-29 15:26:00

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

No, but I guess thats why you should use visudo to edit sudoers tongue

## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.

Offline

#14 2010-10-29 20:01:28

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: sudo doesn't work, reporting error in sudoers file, wierd behaviour

btw, I've got:

Sudo version 1.7.4p4

Offline

Board footer

Powered by FluxBB