66

When I run Ruby commands like gem -v I get this error:

/Users/kristoffer/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4: warning: Insecure world writable dir /Users/kristoffer in PATH, mode 040777

1.6.2

First of all I don't understand what this means. /Users/kristoffer is not in my path according to echo $PATH. The result of echo $PATH is:

/Users/kristoffer/.rvm/gems/ruby-1.9.2-p180/bin:/Users/kristoffer/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/kristoffer/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/kristoffer/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

As you can see, the PATH is pretty clean. Just the default path + what RVM added.

I've seen the other posts similar to this where the recommended way to solve the issue is to run chmod go-w path/to/folder

However, I'm pretty sure that it's a bad idea to make my Home folder non-writeable, right? I've repaired permissions using Disk Utility and it didn't find anything wrong with the permissions on my Home folder.

Any idea of what the problem is and how I can fix it?

kristofferR
  • 763
  • 1
  • 6
  • 5
  • I think you definitely don't want your home dir world-writeable. Running the chmod would be a good idea. Since your home directory is world writeable, any folders under that (several of which are in your path) could be modified, so maybe that is why you are getting that error. – cam May 31 '11 at 19:11

6 Answers6

118

Your home folder should only be writable by you, not by anyone else. The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor.

To fix your home folder, run chmod go-w /Users/kristoffer. If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly.

BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership.

Gordon Davisson
  • 118,432
  • 16
  • 123
  • 151
  • 1
    Ah, thanks! That fixed the problem. I was worried about running `chmod go-w` because I thought it removed write permissions for all users, including me. – kristofferR Jun 01 '11 at 15:43
  • 1
    Shouldn't this have a -R for recursive? – NDBoost May 22 '12 at 14:20
  • 5
    @Mike: No, that would break any folders that're supposed to be writable by others (mainly ~/Public/Drop Box). If there are any other inappropriately-writable folders inside his home, they will have to be fixed as well, but `-R` would be (slightly) overkill. – Gordon Davisson May 22 '12 at 15:13
  • I run ```chmod go-w /Users/[my name]```, but I got the msg ```chmod: cannot access '/Users/[my name]': No such file or directory``` – Ckt22 Dec 31 '21 at 16:50
  • @Ckt22 You need to use whatever the actual path to your home directory is. You can use `echo ~` to print the path, or just use `chmod go-w ~` and it should take care of it for you. – Gordon Davisson Dec 31 '21 at 18:18
  • @GordonDavisson I run ```sudo chmod go-w ~ /home/keaton```, and then run ```rails s```, the result is still stuck in the same problem: ```/usr/lib/ruby/vendor_ruby/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /mnt/c in PATH, mode 040777 /usr/bin/ruby2.5: warning: shebang line ending with \r may cause problems Your Ruby version is 2.5.1, but your Gemfile specified 2.6.6``` – Ckt22 Jan 01 '22 at 10:23
  • @Ckt22 According to the error message, the problem isn't the permissions on your home directory, it's `/mnt/c` that's the problem. This sounds like you're using Ubuntu under Windows, which I'm not familiar with. Also, the shebang error indicates you have at least one file with Windows-style line endings (rather than Unix-style), which is likely to cause trouble. – Gordon Davisson Jan 01 '22 at 10:29
  • @GordonDavisson Yes, I using Ubuntu under Windows, What file should I modify or fix? – Ckt22 Jan 01 '22 at 11:42
  • After I changed the default Ruby version of RVM to the version required by the repo, the problem was solved. unknown reason. – Ckt22 Jan 01 '22 at 13:13
14

I kept getting this in my prompt.

enter image description here

I couldn't get it quite right with my command prompt but this ended up working.

enter image description here

Michael J. Calkins
  • 32,082
  • 15
  • 62
  • 91
  • 1
    Thanks for the screenshot! It works. When I migrated my HDD to the SSD somehow "everyone" can Read&Write my user folder. Switching everyone to No Access fixes the warning. – Alex Le Sep 19 '13 at 07:43
6
chmod 755 /Users/<username>

Should fix the problem...

Gabriel Reiser
  • 402
  • 5
  • 10
  • I run ```chmod 755 /Users/[my name]```, but I got the msg ```chmod: cannot access '/Users/[my name]': No such file or directory``` – Ckt22 Dec 31 '21 at 16:49
5

Recently this just happened to me and it has to do with a bug in upgrading to Mac OSX 10.9.3. Looks like the upgrade changes the permissons to the User folder. Here's an explanation and a fix:

http://derflounder.wordpress.com/2014/05/16/users-folder-being-hidden-with-itunes-11-2-installed-and-find-my-mac-enabled/

andrewmarkle
  • 221
  • 3
  • 9
1

it says that the directory Users/username is insecure, you can fix that by running sudo chmod go-w Users/username

shashisp
  • 2,879
  • 7
  • 19
  • 29
1

I found a solution. Like user2952657, I got this warning with vagrant up after upgrading to OSX 10.9.3. Updating iTunes to 11.2.1 was all I needed to do to get the warning to stop.

Russia Must Remove Putin
  • 374,368
  • 89
  • 403
  • 331
esod
  • 335
  • 2
  • 9