Results 1 to 10 of 10
  1. #1


    Member Since
    Oct 14, 2010
    Posts
    28
    Specs:
    MacBook Air 10.7, iMac 21" 10.7
    Question Terminal commands getting error messages.
    I have been trying to edit the sudoers file for some time now, and have been getting error messages on multiple occurrences. I run "su root" first to become root user, as "visudo" has to be run that way. I type the Administrator password for my computer, and "su: sorry" comes up. I assumed maybe I had type it wrong, but the problem repeatedly came up. The password for logging in to the Admin account works fine, but not in Terminal. I tried going in to the Admin account and running "su root", but the same thing occurred.

    I also noticed when I run a sudo command I get an error message saying "sudo: /etc/sudoers is mode 0777, should be 0440
    Segmentation fault"
    I'm not particularly sure what this is.

    Any help would be greatly appreciated.

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    sudo visudo works fine for me. Have you changed the permissions on the /etc/sudoers file as those permissions listed (777) give everyone read, write and execute permissions?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    It appears to me that the permission of the sudoers file was changed to 777. Also it appears that someone tried to execute (run) the sudoers file by doing sudo /etc/sudoers, instead of sudo visudo as suggested. As for the su root, the root account has been disabled, so you can not log in to it.

    I don't believe you need to edit the sudoers file, because I think you should be able to anything that you want to do by doing:

    sudo command
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

  4. #4


    Member Since
    Oct 14, 2010
    Posts
    28
    Specs:
    MacBook Air 10.7, iMac 21" 10.7
    Question
    Quote Originally Posted by vansmith View Post
    sudo visudo works fine for me. Have you changed the permissions on the /etc/sudoers file as those permissions listed (777) give everyone read, write and execute permissions?
    Hmm... I tried changing the permissions but still no luck. I get no error messages when doing that, but when visudo is run the same error occurs. (visudo: /etc/sudoers.tmp: Permission denied) I had read that "etc/sudoers.tmp" is a file that visudo creates when modifying the sudoers file, and normally deletes after a successful run but I have never ran visudo until now.

  5. #5

    XJ-linux's Avatar
    Member Since
    Jul 02, 2007
    Location
    Going Galt...
    Posts
    3,450
    Specs:
    MacBookAir5,2:10.9.5-MacMini3,1:10.9.5-iPhone6,1:8.4.1
    On my system I use the command:
    sudo visudo
    I don't specify the file name or path

    Example:
    MacGyver:~ username$ visudo
    visudo: /etc/sudoers: Permission denied
    visudo: /etc/sudoers: Permission denied
    MacGyver:~ username$ sudo visudo
    Password:
    visudo: /etc/sudoers.tmp unchanged
    MacGyver:~ username$ sudo visudo /etc/sudoers
    usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
    MacGyver:~ username$ cd /etc
    MacGyver:etc username$ ls -la | grep sudoers
    -r--r----- 1 root wheel 1242 Oct 20 19:22 sudoers

    You might check to make sure your permissions are the same and if not, use the command:
    sudo chmod 0440 /etc/sudoers
    sudo chown root:wheel /etc/sudoers
    Never judge a man, untill you have walked a mile in his shoes...
    That way you'll be a mile away from him, and you'll have his shoes.

  6. #6


    Member Since
    Oct 14, 2010
    Posts
    28
    Specs:
    MacBook Air 10.7, iMac 21" 10.7
    Exclamation
    Thanks for the input, this is where I'm at. I tried running "sudovisudo" but found no luck. Any command that uses "sudo" falls back on the error message I have constantly repeating: "computername:~ username$ sudo chmod 0440 /etc/sudoers
    sudo: /etc/sudoers is mode 0777, should be 0440
    Segmentation fault"

    Running any sudo command causes this problem.

    I'm not sure how to check if the permissions are the same, so I just did "sudo chmod 0440 /etc/sudoers" to make sure it was, but I got error "sudo: /etc/sudoers is mode 0777, should be 0440
    Segmentation fault", the same as always when using "sudo".
    Since it appears that I have in some way been "locked out" of running sudo commands, I tried doing that last command without the sudo part but the operation was not permitted, as expected.

    Running "sudo chown root:wheel /etc/sudoers" doesn't work because of the same error message, but "chown root:wheel /etc/sudoers" does, or appears to work.

  7. #7

    XJ-linux's Avatar
    Member Since
    Jul 02, 2007
    Location
    Going Galt...
    Posts
    3,450
    Specs:
    MacBookAir5,2:10.9.5-MacMini3,1:10.9.5-iPhone6,1:8.4.1
    You may need to enable actual su access to the root user account to correct it.

    Enable root account in Snow Leopard | Snow Leopard Tips

    See if you can run the chmod 0440 command after you enable root. The commands are the same but without the "sudo" part at the beginning...

    chmod 0440 /etc/sudoers
    chown root:wheel /etc/sudoers

    Then disable root access, log off, and then back on again to check the results.
    Never judge a man, untill you have walked a mile in his shoes...
    That way you'll be a mile away from him, and you'll have his shoes.

  8. #8


    Member Since
    Oct 14, 2010
    Posts
    28
    Specs:
    MacBook Air 10.7, iMac 21" 10.7
    Unhappy
    Ok, so I did as the link you showed me said and enabled the root user - no problems there. But when I went in to Terminal and ran "su root" it stillsays that the password is wrong. It wasn't mistyped, I made sure of that, and I reset the root password many times, checking for errors. The commands had the same outcomes as before, (errors).
    Maybe I deleted a system file or corrupted something important? It seems that I'm the only one to ever have a problem like this.... Can you think of any other reasons it possibly couldn't be working? Thanks for the help.

  9. #9


    Member Since
    Oct 14, 2010
    Posts
    28
    Specs:
    MacBook Air 10.7, iMac 21" 10.7
    Lightbulb
    Oops... sorry. It appears I have figured it out. Apparently I was not being allowed to "su" root because of the current privileges of my account. Once I changed it to admin, I was able to su root and run the commands that you gave me without sudo. Then I logged out, logged back in and ran visudo, this time successfully eiting the sudoers file. Thanks a lot .

  10. #10

    XJ-linux's Avatar
    Member Since
    Jul 02, 2007
    Location
    Going Galt...
    Posts
    3,450
    Specs:
    MacBookAir5,2:10.9.5-MacMini3,1:10.9.5-iPhone6,1:8.4.1
    I never thought to ask whether your user was an Admin user. Good catch!
    Never judge a man, untill you have walked a mile in his shoes...
    That way you'll be a mile away from him, and you'll have his shoes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Terminal Commands
    By LucasMan in forum OS X - Operating System
    Replies: 6
    Last Post: 02-25-2015, 04:02 AM
  2. Help with Terminal Commands
    By cjgarof in forum OS X - Operating System
    Replies: 3
    Last Post: 10-29-2011, 05:42 PM
  3. Terminal commands
    By Alex99 in forum OS X - Operating System
    Replies: 1
    Last Post: 11-22-2010, 11:03 AM
  4. Terminal commands
    By eggman in forum Switcher Hangout
    Replies: 8
    Last Post: 01-12-2009, 10:05 PM
  5. Terminal Commands
    By Destructive in forum OS X - Development and Darwin
    Replies: 11
    Last Post: 02-19-2008, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •