New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Terminal commands getting error messages.


Post Reply New Thread Subscribe

 
Thread Tools
sc8ing

 
Member Since: Oct 14, 2010
Posts: 28
sc8ing is on a distinguished road
Mac Specs: MacBook Air 10.7, iMac 21" 10.7

sc8ing is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,775
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is online now
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
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac 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

rman is offline
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!
QUOTE Thanks
sc8ing

 
Member Since: Oct 14, 2010
Posts: 28
sc8ing is on a distinguished road
Mac Specs: MacBook Air 10.7, iMac 21" 10.7

sc8ing is offline
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.
QUOTE Thanks
XJ-linux

 
XJ-linux's Avatar
 
Member Since: Jul 02, 2007
Location: Going Galt...
Posts: 3,351
XJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond repute
Mac Specs: MacBookAir5,2:10.9.4-MacMini3,1:10.9.4-iPhone6,1:7.1.2

XJ-linux is offline
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

"Those who don't understand Unix are condemned to reinvent it, poorly." Henry Spencer
QUOTE Thanks
sc8ing

 
Member Since: Oct 14, 2010
Posts: 28
sc8ing is on a distinguished road
Mac Specs: MacBook Air 10.7, iMac 21" 10.7

sc8ing is offline
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.
QUOTE Thanks
XJ-linux

 
XJ-linux's Avatar
 
Member Since: Jul 02, 2007
Location: Going Galt...
Posts: 3,351
XJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond repute
Mac Specs: MacBookAir5,2:10.9.4-MacMini3,1:10.9.4-iPhone6,1:7.1.2

XJ-linux is offline
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.

"Those who don't understand Unix are condemned to reinvent it, poorly." Henry Spencer
QUOTE Thanks
sc8ing

 
Member Since: Oct 14, 2010
Posts: 28
sc8ing is on a distinguished road
Mac Specs: MacBook Air 10.7, iMac 21" 10.7

sc8ing is offline
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.
QUOTE Thanks
sc8ing

 
Member Since: Oct 14, 2010
Posts: 28
sc8ing is on a distinguished road
Mac Specs: MacBook Air 10.7, iMac 21" 10.7

sc8ing is offline
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 .
QUOTE Thanks
XJ-linux

 
XJ-linux's Avatar
 
Member Since: Jul 02, 2007
Location: Going Galt...
Posts: 3,351
XJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond reputeXJ-linux has a reputation beyond repute
Mac Specs: MacBookAir5,2:10.9.4-MacMini3,1:10.9.4-iPhone6,1:7.1.2

XJ-linux is offline
I never thought to ask whether your user was an Admin user. Good catch!

"Those who don't understand Unix are condemned to reinvent it, poorly." Henry Spencer
QUOTE Thanks

Post Reply New Thread Subscribe


« Backing Up to a File ? | Reformatting Mac OS X - - iLife Included? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Need Terminal Key Commands! junkman OS X - Operating System 0 01-29-2009 04:14 PM
Terminal commands eggman Switcher Hangout 8 01-12-2009 10:05 PM
Terminal Commands Destructive OS X - Development and Darwin 11 02-19-2008 09:41 PM
Terminal Commands for Hidden Settings in Leopard goobimama OS X - Operating System 2 12-03-2007 10:38 AM
Automated Terminal Commands sarahsboy18 OS X - Operating System 3 09-09-2005 07:39 PM

All times are GMT -4. The time now is 11:35 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?