Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

sudo command broken! (UNIX people-- please help a stupid newb :( )

Macbook Pro 5,2, Mac OS X (10.6.2)

Posted on Feb 14, 2010 6:21 AM

Reply
Question marked as Best reply

Posted on Feb 14, 2010 7:46 AM

PJameson wrote:
Note: This is currently crossposted in Using 10.6; please forgive me. I didn't realize that there's a UNIX forum, and I can't figure out how to delete posts on these forums for the life of me.


I reported your post. It should be deleted shortly.

Hello all! I broke my sudo! I'm sure that all the fun topics on these forums start with "Well, I saw these lines of code on a forum somewhere..." and this one does too. I'll go ahead and place the error output here (as I think that's all that's really needed to know to fix this), but the stuff I was trying to run is also below.


I would be far more interested in seeing what your sudoers file now looks like than the error output.

I presume this means that I need to go into said file and fix something, but because of the fear that sudo inspires (let's call it "sudo stigma"), I'd really appreciate it if somebody could tell me the right thing to do 🙂


Post the contents of your sudoers file.

I was trying to fix VirtueDesktops for 10.5 (to see if the posted 10.5 fix would work for 10.6, of course). VirtueDesktops is a pre-10.5 Spaces-like virtual desktop manager, with cool features and iCandy that I must have, not for functionality, just because I'm a dangerous mix of superficial and OCD. The code was posted to the OSX86 forums, and was:


sudo su
chmod 755 /Applications/VirtueDesktops.app/Contents/MacOS/VirtueDesktops
echo "%admin ALL=(ALL) NOPASSWD: /Applications/VirtueDesktops.app/Contents/MacOS/VirtueDesktops" >> /private/etc/sudoers


A little knowledge is a dangerous thing. Apparently, whomever posted that to the OSX86 forums didn't know what they were doing. You never do "sudo" and "su". That's just wrong. You would probably want to do "sudo bash" and that would give you a shell as the root user.

To fix your sudoers file, just edit /private/etc/sudoers and remove that last line. You will probably have to navigate to /private/etc using the Finder (type Shift ⌘ G to get there). Select "sudoers" and do "Get Info" in the Finder. Change the access for "Everyone" to "Read and Write". Edit the file and remove that last line. Put the permissions back the way you found them. Sudo should now be fixed.

It seems as though the original author of VirtueDesktops now has a program called Hyperspaces that works with Spaces and should do what you want.
11 replies
Question marked as Best reply

Feb 14, 2010 7:46 AM in response to PJameson

PJameson wrote:
Note: This is currently crossposted in Using 10.6; please forgive me. I didn't realize that there's a UNIX forum, and I can't figure out how to delete posts on these forums for the life of me.


I reported your post. It should be deleted shortly.

Hello all! I broke my sudo! I'm sure that all the fun topics on these forums start with "Well, I saw these lines of code on a forum somewhere..." and this one does too. I'll go ahead and place the error output here (as I think that's all that's really needed to know to fix this), but the stuff I was trying to run is also below.


I would be far more interested in seeing what your sudoers file now looks like than the error output.

I presume this means that I need to go into said file and fix something, but because of the fear that sudo inspires (let's call it "sudo stigma"), I'd really appreciate it if somebody could tell me the right thing to do 🙂


Post the contents of your sudoers file.

I was trying to fix VirtueDesktops for 10.5 (to see if the posted 10.5 fix would work for 10.6, of course). VirtueDesktops is a pre-10.5 Spaces-like virtual desktop manager, with cool features and iCandy that I must have, not for functionality, just because I'm a dangerous mix of superficial and OCD. The code was posted to the OSX86 forums, and was:


sudo su
chmod 755 /Applications/VirtueDesktops.app/Contents/MacOS/VirtueDesktops
echo "%admin ALL=(ALL) NOPASSWD: /Applications/VirtueDesktops.app/Contents/MacOS/VirtueDesktops" >> /private/etc/sudoers


A little knowledge is a dangerous thing. Apparently, whomever posted that to the OSX86 forums didn't know what they were doing. You never do "sudo" and "su". That's just wrong. You would probably want to do "sudo bash" and that would give you a shell as the root user.

To fix your sudoers file, just edit /private/etc/sudoers and remove that last line. You will probably have to navigate to /private/etc using the Finder (type Shift ⌘ G to get there). Select "sudoers" and do "Get Info" in the Finder. Change the access for "Everyone" to "Read and Write". Edit the file and remove that last line. Put the permissions back the way you found them. Sudo should now be fixed.

It seems as though the original author of VirtueDesktops now has a program called Hyperspaces that works with Spaces and should do what you want.

Feb 14, 2010 8:49 AM in response to etresoft

The sudoers file is suppose to be edited using visudo
which assumes you know how to use the vi editor.

Since you are most likely the ONLY user on the system,
the worry that someone else might be editing the file
is not an issue.

But the visudo also provides sanity checks on your
changes that are suppose to protect you from yourself.

The fun part now, is how do you fix the sudoers file when
you can not use sudo to get access to the sudoers file 🙂

Hopefully etresoft's Get Info trick will work. If that does not
work, come on back and we can discuss ways of breaking into
your system via single user mode, or using Target Disk Mode
from another Mac, or enabling root (yuck), etc...

Feb 14, 2010 3:05 PM in response to BobHarris

Thanks for the help! Actually, editing the sudoers file wasn't too bad. I changed permissions with Get Info. TextEdit wouldn't let me save it, even with the updated permissions, but I found I could move the file, delete the file, etc., so I figured it was TextEdit's own hangup. I retried with a source editor called Komodo, which gave me a "force save" option that worked.

Now the sudo command outputs:

sudo: /etc/sudoers is mode 0666, should be 0440


More random forums (we never learn, right?) tell me that I should have luck with:


chmod -R 0440 /etc/sudoers


Which, unfortunately, gives me:


chmod: Unable to change file mode on /etc/sudoers: Operation not permitted


So, presumably the problem is with permissions? I was thinking that accessing root would remedy the problem (single-user wouldn't work for this, right?), but iTunes is importing my library atm (fresh system install), so since I have a few hours before I can restart, I figured I would run this by you guys first. After all, my track record today isn't too good ><

Also, not to get off topic, but regarding HyperSpace:

It's a solid program, but it lacks a lot of the functionality that VirtueDesktop had. It's great for augmenting Spaces (which I think a lot of us were disappointed with; virtual desktops in Linux have felt more functional and intuitive for pretty much the past decade), but it doesn't have VirtueDeskop's eye candy or ability to map desktop switching to, frankly, silly things. I saw the developer stated he wanted to implement a lot of VirtueDesktop into HyperSpace's final release, but it doesn't look like he had time :/ Let's just say that I'm anxiously awaiting 2.0.

Again, thanks for the patience + help!

Feb 14, 2010 6:20 PM in response to PJameson

Hi PJameson, I'm the developer of Hyperspaces (and previously, VirtueDesktops). I won't stray too far off topic (you've tried a disk utility permissions repair, right?) but I wanted to say that you are correct: I did want to implement many of Virtue's features in Hyperspaces.

In the interests of shipping a product (so that I get paid, and can eat) I dropped a lot of the more advanced features from Hyperspaces 1.x. I'll be reintroducing smaller stuff up until 2.0, where I hope to reach the same level of features as Virtue used to have.

Are there any features in particular that you miss more than others?

Feb 15, 2010 4:36 AM in response to PJameson

All done! Thanks to BobHarris for stopping me from going overboard (BONUS: now I have an idea of what the chmod command is for 😀 ). In fact, I've learned a lot by messing up my computer (isn't that how it always works?). Also, if anyone sees this, and happens to know a website they can recommend for learning basic navigation, file manipulation, etc., in UNIX, I'd love a link!


To Tony:

Wow, my thread's basically met celebrity status! Well, regarding HyperSpaces, just a few ideas:

1) I know you've probably heard this again, and again, but eveeeeeeeeeeeryone and their mum wants cube transitions. I mean, seriously, you sit your pricey little Mac down next to some punk's Dell Latitude or whatever, and you're getting screen envy over Ubuntu.... What the crap?

I'm just speculating, but I'm betting those transitions are resource hogs. Since HyperSpaces is really just to improve your efficiency at using Spaces, I can see why it's missing. After all, what good is it to be able to manage your virtual desktops really well and, at the same time, getting type lag (or even just the time it takes for Cube transitions to just transition-- I understand that's one of the biggest complaints about Compiz Fusion's cube transition). Still, considering how many Mac users (myself hyper-included) are obsessed with eye candy, and seeing that HyperSpaces is shareware, I bet you/your company/whoever could make a killing with 3D cube transitions. I think it's valuable too though-- seeing the cube helps me keep my desktops straight (as opposed to an ugly pager).

This is probably way too much for your plate, but if implementing fancy transitions into HyperSpaces is counterproductive, it could always come out as a stand-alone (or possibly a plug-in infrastructure? Even more trouble than it's worth, I know). As I mentioned, HyperSpaces seems to be about productivity; which is great and useful, but the 3D cube could sell well. You could just call it "Cube," and have an ultra Web 2.0-y, Aqua-y website, maybe rip off Compiz's skydomes...can you picture this? I know I can 🙂 All I'm saying is icandy like that, well, it sells itself.

2) If you could implement some way to say, launch an AppleScript on the event of loading a desktop, we could do a lot. Really, this is the second killer feature. We all want crazy things when it comes to our desktops; with AppleScript we could pretty much run amok and do whatever ridiculous things we wanted.

3) Then there's the sensors. Personally, I treat my MBP with a lot of love (well, the hardware that is), so I'm not really gunning for this, but I think a lot of people who are missing this are just upset about not having the coolest-acting machine on the block anymore.

Overall though, I think HyperSpaces is on the right track. Spaces really gave us infrastructure that virtual desktop managers for Macs didn't used to have-- for example, launching a program in a certain desktop as a start-up item is GREAT (my favorite part about Compiz/KDE is how I can launch a computer, zoom out on my little cube, and there's just a face running XBMC +all the time+. There's also a XBMC plugin that can launch applications, so you can sort-of switch between this netbook-y, iphone-y interface for dummies; then switch back to a normal looking desktop when it's "work time").


This is probably more of the same, but feel free to e-mail me if you have anything else you'd like to ask me. And thanks on part of the community; I'm sure I'm not alone when I say VirtueDesktops was one of our all-time favorites!

Message was edited by: PJameson

Feb 15, 2010 6:28 AM in response to PJameson

I don't know about 'celebrity'!

1. Transitions are coming in a future release - it's not a question of efficiency, it's really still a question of time. Most of the features from Virtue are transferable to Leopard/Snow Leopard - this was one that I personally felt wasn't as important as the core functions I've implemented in 1.0. I agree that eye candy sells, but it needs something solid behind it too 🙂 It won't be as fully-featured as Compiz's sky dome and cube in the initial versions though.

2. Yep - acknowledged. I've had a number of requests for this, and it will make a comeback.

3. Heh - yes, sensor inputs are a little more worrying to me. The smackbook stuff damaged more than a few laptops when overzealous whackers thumped their very expensive laptops a little too hard. Light sensors I have no issue with - there's no real physical damage to the laptop via that. Either way, I'll need to write up some legal doodads to protect me if I head down this path.

I don't really comment on timelines - the features I've noted above are features I've already started work on for a future release of Hyperspaces (not the upcoming version 1.1).

Anyhow - thanks for the feedback! It's always refreshing to get a detailed response to an open-ended question like that 🙂

Feb 15, 2010 11:17 AM in response to KJK555

KJK555 wrote:
+"Also, if anyone sees this, and happens to know a website they can recommend for learning basic navigation, file manipulation, etc., in UNIX, I'd love a link!"+

This ought to keep you out of trouble for a while. 🙂


Keep in mind that UNIX is powerful - and with great power comes great responsibility.

Feb 15, 2010 12:17 PM in response to etresoft

+"Keep in mind that UNIX is powerful - and with great power comes great responsibility."+

Agreed.

Those links I provided lead to materials that contain accurate instructions and data,
which has to be a better source than the x86 forums.

Of course you know, you can't be inducted in the Geek Hall of Shame until you wipe all your
data with a single UNIX command (yes, I have done it!). 😉

As any Geek worth his salt will tell you:
"That's what good backups are for"

Kj ♘

sudo command broken! (UNIX people-- please help a stupid newb :( )

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.