Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > odd su issue

odd su issue
Thread Tools
Junior Member
Join Date: Nov 2003
Location: Bermuda
Status: Offline
Reply With Quote
Jan 5, 2004, 12:46 PM
 
I have a script that I want to run, and the script needs to run as root. I tried to sudo it, and it failed - I found that odd, but wasn't going to bother looking into it if I could just su to root and do it that way.

So I typed "su" and was prompted for the password - I typed in the password (the same I use for all of the installs on this machine) and it returned to me "Sorry".

I tried in the same terminal "login" and then root that way, and again it didn't like the password.

Is the issue that there is another root password that I am just totally unaware that I setup in the install process - or what am I doing wrong?

Thanks.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 5, 2004, 01:36 PM
 
Originally posted by OMGWTFBBQ:
So I typed "su" and was prompted for the password - I typed in the password (the same I use for all of the installs on this machine) and it returned to me "Sorry".

I tried in the same terminal "login" and then root that way, and again it didn't like the password.

Is the issue that there is another root password that I am just totally unaware that I setup in the install process - or what am I doing wrong?
This is the issue that there is no account with the short name "root", this account, is, by default, disabled on Mac OS X. I'm not sure if you're aware of how su works, but the command su actually creates a shell as another user on the system (It's a "pseudo" login), you can type "su username" to create a shell of any user on the system as long as you know their password. Typing "su" without a user name attempts to create a root shell, I'm not sure why you aren't able to use sudo, as this method just allows to you run a program as an administrator user (authenticating with your personal account's login and password).

I'd suggest enabling root from Netinfo.app in the Utilities folder via the "Security" menu and then trying to su again using the root account.

Give that a try and if not then we can try a few more things.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Junior Member
Join Date: Nov 2003
Location: Bermuda
Status: Offline
Reply With Quote
Jan 5, 2004, 02:18 PM
 
Ahh, that is the issue. I'm from a Unix or Windows background and still getting used to the Mac version of doing things.
The script I had wanted root, but if I comment out where it specifically looks for root, it will works fine under my regular username.

Thanks!
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 5, 2004, 03:18 PM
 
You do not ever need to enable to the root user on OSX. There's no reason to do so. If you need a root shell, do "sudo -s" instead of "su" or "su -".
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 5, 2004, 03:31 PM
 
Originally posted by Arkham_c:
You do not ever need to enable to the root user on OSX. There's no reason to do so. If you need a root shell, do "sudo -s" instead of "su" or "su -".
This would have been my answer also, but he was not able to authenticate using sudo. Does "sudo -s" authenticate any different than "sudo"?
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 5, 2004, 04:24 PM
 
Originally posted by [APi]TheMan:
This would have been my answer also, but he was not able to authenticate using sudo. Does "sudo -s" authenticate any different than "sudo"?
sudo is not asking for the install password. It's asking for the current password of the current admin user running sudo.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 5, 2004, 06:10 PM
 
Originally posted by Arkham_c:
sudo is not asking for the install password. It's asking for the current password of the current admin user running sudo.
Exactly, but he tried using sudo the first time and it rejected his password, so how would a root shell via "sudo -s" be any different authentication-wise?
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Dedicated MacNNer
Join Date: Jul 2002
Location: Boston, MA
Status: Offline
Reply With Quote
Jan 5, 2004, 09:06 PM
 
Originally posted by [APi]TheMan:
Exactly, but he tried using sudo the first time and it rejected his password, so how would a root shell via "sudo -s" be any different authentication-wise?
Can you sudo /bin/sh ? Should work fine.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 6, 2004, 12:46 PM
 
Originally posted by kampl:
Can you sudo /bin/sh ? Should work fine.
I'm not the one to ask, but I think that if that command works than it would be very strange for OMGWTFBBQ that he couldn't run the script using sudo.

The only thing that I can think of is that the script itself is returning the "Sorry" rather than the result of the sudo command.

"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Fresh-Faced Recruit
Join Date: Oct 2003
Status: Offline
Reply With Quote
Jan 13, 2004, 06:30 PM
 
To use sudo you need to have that username in the file /etc/sudoers, then run sudo and type your current password.

su works differently. You need to add your username to the "wheel" group in /etc/groups, but MacOSX seems to have some warning there not to do it. su will use the root password for authentication.

I may not quite understand--is sudo just rejecting the one script that you're trying to run, or failing all the time?
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -4. The time now is 08:39 PM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2