Using chown

If you can't access files on your *nix or OS X boxen since they're owned by other people (such as root) you can change the permissions of those files with this simple command.

sudo chown -R username:group file

The -R option is recursive, so if you chown a folder it will change the permissions of all of the enclosed files and subdirectories. If you only need to change the permissions on a file then you can omit the -R, although it won't hurt if you do use it.

If you can't figure out your own username you're an idiot. As for the group, it depends on your setup, it can be users or your username, or whatever group you decide needs access to it. If you don't know what to set it as, just use your username. You must have a ':' in-between your username and group.

For the file, you can use a file, a directory, or just a wild card and go crazy.

Things not to do:

sudo chown -R nobody:nobody /*

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <span> <img>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options