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.

Is it a bad idea to keep scripts in /root? Simple bash scripts that have the following permissions:

-rw-r--r--

They execute fine when ran as root, but is this bad practice? It's a multi-user system, that needs sudo to execute the scripts in question when not logged in as root....

share|improve this question

closed as primarily opinion-based by slm, Timo, Anthon, Zelda, strugee Feb 23 at 7:55

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

There is no one answer to your question as you can put them anywhere you like. It's a matter of taste and (aesthetic) opinion which do not boil down to one single correct answer.

I'd probably put them somewhere under /usr/local. For scripts meant to be run only by the superuser, I'd probably put them in /usr/local/sbin. For scripts meant to be used regular users of your system, I'd put them in /usr/local/bin.

From a historical perspective /usr/local still sounds like a good place to put things which are, eh, "local".

share|improve this answer
    
Would the permissions need to be changed if I were to put them in /usr/local? I take it they would if a user other than root would want to execute them? –  nom Feb 23 at 5:10
    
Proper permissions for executable scripts have the executable bit set, so 0755 sounds appropriate in this case. See also the answer for where to put things for superuser and where to put things for the rest of the bunch. –  Sami Laine Feb 23 at 6:24

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