warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Asked Answered
H

13

189

Every time I run this command rails server:

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 OS X by the way.

Hercule answered 17/10, 2010 at 6:22 Comment(4)
I had the same problem just after installing the software for a T-Mobile broadband USB dongle and was wondering whether it was responsible for doing it. Are you by any chance also using a dongle?Quamash
Yes I got it after installing a Virgin (Australia) mobile USB dongleGracioso
OMG, really? Thanks for this information! I have also noticed that after I try to run T-Mobile dongle software it f* my permissions.Spermatozoid
I am using an LTE dongle by AU (japanese carrier) which also requires some command line wizardry to get to work...Chavez
F
304

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.

Forzando answered 17/10, 2010 at 6:57 Comment(10)
if I type the command above, I get: sudo: /etc/sudoers is mode 0644, should be 0440 Segmentation faultHercule
@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...Forzando
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 stupidHercule
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.Hercule
@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.Forzando
I tried this, but when I do thin start it is still giving me that message. Did I miss something? Btw, the chmod command seems to have been run successfully. I even entered my admin pw when prompted and it went through. What am I missing ? Do I need to restart my computer ? I stopped and restarted the server.Lazulite
@marcamillion: it is hard to say what might be going wrong on your machine. You should look at the permissions on /usr/local/bin, of course, and maybe at the ACL values, if there are any.Forzando
sh-3.2# chmod go-w /usr/local/bin sh-3.2# brew install opencv /usr/local/Library/Homebrew/global.rb:64: warning: Insecure world writable dir /opt/local in PATH, mode 040777 /usr/local/bin/brew:74: warning: Insecure world writable dir /opt/local in PATH, mode 040777 don't work for meHesperus
@JackTurky: From what I can see, the warning is about /opt/local; if that's the case, changing the mode of /usr/local/bin won't help you.Forzando
I started getting the same warning after installing a piece of software that came with a wireless broadband dongle. Thanks for this post/answers.Conjunctive
A
66

I had the same error here MacOSX 10.6.8 - it seems ruby checks to see if any directory (including the parents) in the path are world writable. In my case there wasn't a /usr/local/bin present as nothing had created it.

so I had to do

sudo chmod 775 /usr/local

to get rid of the warning.

A question here is does any non root:wheel process in MacOS need to create anything in /usr/local ?

Avruch answered 10/10, 2011 at 13:39 Comment(1)
Yeah, 775 => root(7) group(7) others(5), 7 => read(4) + write(2) + execute(1), and 5 => read(4) + execute(1)Fillister
C
11

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.

Charlettecharley answered 17/10, 2010 at 6:58 Comment(0)
S
7

I have had the same issue in OSX. It can be fixed by running Disk Utilities to Repair Permissions. I agree with Peter Nixey: in my case it is caused when my 3G dongle installs or reinstalls its driver. Repairing Permissions afterward fixes the issue.

Smasher answered 22/7, 2012 at 13:42 Comment(0)
M
7

Am using Mountain Lion. What I did was Look for /usr/local and Get Info. On it there is Sharing and Permissions. Make sure that its only the user and Admin are the only ones who have read and write permissions. Anyone else should have read access only. That sorted my problem.

Its normally helpful is your Run disk utilities and repair permissions too.

Magnetometer answered 7/8, 2012 at 15:1 Comment(0)
K
4

Same here, apparently my /usr/local folder was world writable so I made it 755

# chmod 755 /usr/local

It also appeared that a Hauwei mobile dongle I had used had installed world writeable directories in /usr/local as well

Kioto answered 9/12, 2013 at 10:12 Comment(0)
C
4

You need to run

sudo chmod o-w -R /usr/local 
Candlepower answered 11/4, 2018 at 7:28 Comment(1)
for me -R must be directly after chmod sudo chmod -R o-w /usr/local/Lesko
B
3

If you're running OSX and getting this often, another good thing to consider is to use a built-in OSX permissions fixing tool. If you didn't change the mode of your directories, something else did and there's a chance that other directories have overgenerous permissions as well - this tool will reset them back all to factory defaults, which is a good security idea. There's a great guide on the Apple stackextange about this very process.

Briant answered 13/4, 2014 at 22:32 Comment(0)
M
3

in macOS run the following command in terminal

sudo chmod -R o-w /usr/local/bin
Myra answered 21/10, 2022 at 21:56 Comment(1)
After struggling a lot of time simply this cmd is worked for me. Thank you... For the above error simply this cmd is more than enough for M1 chip MacBook Pro.Celebrity
W
2

Even I came across similar problem. I use KDE on ubuntu 12 and while playing around in my home folder I had accidently changed permissions for Group and Others as "can view and modify content" by right clicking in my home folder and then properties and forgot all about it.

My warning was:

warning: Insecure world writable dir /home/my_home_folder in PATH, mode 040777

So in my case it was the home folder. I did undid the modifications of permissions and I stopped getting those warnings when running the rails server or rake tasks to run my tests.

Wagonette answered 5/9, 2012 at 12:39 Comment(0)
D
1

I'm also having the exact same problem with both /usr/local/bin and /etc/sudoers on OSX Snow lepard.Even when i logged in as admin and tried to change the permissions via the terminal, it still says "Operation not permitted". And i did the following to get the permission of these folders.

From the terminal, I accessed /etc/sudoers file and using pico editor i added the following code: username ALL=(ALL) ALL Replace "username" with your MAC OS account name

Denton answered 18/1, 2011 at 20:57 Comment(0)
A
1

This should resolve your problem: chmod go-w {/path/of/user}

Antiphlogistic answered 21/10, 2017 at 5:52 Comment(0)
C
0

I had the same error here MacOSX 10.11 - it seems ruby checks to see if any directory (including the parents) in the path are world writable. In my case there wasn't a /usr/local/bin present as nothing had created it.

Run this command in your terminal. Try this

sudo chmod 775 /usr/local

After this if you have any password on your mac , then you have to enter the password . Now this issue will be fix.

Chism answered 29/8, 2016 at 19:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.