From what I understand, the right place to put your own scripts is /usr/local/bin (for instance a script I use to back up some files). I notice that this folder is currently (by default) owned by root, and my normal user has no access to it. I am the only user on this computer. Shall I change this whole folder to my own user? Or is there another proper way to arrange permissions of /usr/local/bin?


By default, the owner and group of /usr/local and all subdirectories (including bin) should be root.root and the permissions should be rwxr-xr-x. This means that users of the system can read and execute in (and from) this directory structure, but cannot create or edit files there. Only the root account (or an administrator using sudo) should be able to create and edit files in this location. Even though there is only one user on the system, it's generally a bad idea to change permissions of this directory structure to writable to any user other than root.

I would suggest placing your script/binary/executable into /usr/local/bin using the root account. It's a good habit to get into. You could also place the script/binary/executable into $HOME/bin and make sure $HOME/bin is in your $PATH.

See this question for more discussion: Where should a local executable be placed?

  • 7
    Good answer; I thought maybe I'd add my 2 cents worth. Even if you are the only user now, this could change in the future, and it's a good idea to follow best practices all the time. If you have a personal script only for yourself, put it in ~/bin; if it's something others might use, put it in /usr/local/bin. Others could mean yourself, in a different account, too. And, remember, some of the rules protect you from yourself, to make it harder to delete important files. – Marty Fried May 2 '12 at 2:17

The usual place to put your own scripts is ~/bin, and then add this directory to your PATH.


Don't go through the trouble of trying to put things into directories potentially used by other parts of the system.

If you're the only user of the system, then just install under $HOME, for example in a $HOME/local hierarchy. Either that, or use a totally separate hierarchy rooted in, e.g., /opt or /sw or somesuch place (not used by base system or package managers).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.