Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 13 down vote accepted

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?

share|improve this answer
5  
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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