views:

58

answers:

2

I get this everytime I run: rails server

I get: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

I searched for a solution here and they said to type: chmod go-w /usr/local/bin

But I get this error: chmod: Unable to change file mode on /usr/local/bin: Operation not permitted

I am using OSX btw.

A: 

You will need to have root access to do this. If you aren't already the administrative user, login as the administrator. Then use 'sudo' to change the permissions:

sudo chmod go-w /usr/local/bin

Obviously, that will mean you can no longer install material in /usr/local/bin except via 'sudo', but you probably shouldn't be doing that anyway.

Jonathan Leffler
if I type the command above, I get: sudo: /etc/sudoers is mode 0644, should be 0440Segmentation fault
Xandman
@Xandman: I don't know what is up with the segmentation fault; programs should not do that (especially not security related ones like sudo). Clearly, someone has been tampering with file permissions on your system - I recommend reading them the riot act. In the mean time, you're probably faced with a chicken and egg situation; you can't use 'sudo' until you fix the permissions on /etc/sudoers, and you can't fix the permissions on /etc/sudoers without using 'sudo'. I'm not sure what the best fix is...
Jonathan Leffler
I guess I should hang myself then. Been tinkering with my MAC since I switched from windows. Tried to make this a windows laptop. I probably did something stupid
Xandman
Thanks for the comment Jonathan, you gave me an idea to check the permissions. I repaired the permissions with Disk Utility and when I ran the command: sudo chmod go-w /usr/local/bin it won't through.
Xandman
@Xandman: No need for the hanging until you've proven yourself to be a repeat offender. You say "it won't go through" - in what way is it not working? With 'sudo', you provide your own password (with 'su', you provide the password of the target user - root, typically). To sort some of this out, you may need to enable the root login (System Preferences as an administrator, IIRC), and go fix permissions as root. That does assume you now know enough not to hang yourself accidentally. Or it might be better to redo the installation from scratch; it depends how much you modified the permissions.
Jonathan Leffler
A: 

Try: sudo chmod go-w /usr/local/bin

The /usr/local/bin directory is owned by the root (i.e. administrator) account, so even if you can write to it, you can't change the permissions on it. The sudo command means "run the following command as root", and works a lot like clicking that lock icon in the System Preferences dialogs.

Jander