Is there a bin or sbin folder for the root user?

DominikHoffmann

Registered
If I come up with code or scripts specifically for use by the root user, where would I put it? I want to stay away from /bin/, /sbin, or /usr/bin/ thinking (rightly or not?) that those are for binaries that come with stock installs.

Dominik Hoffmann
 
wadesworld said:
Why not put them in a subdirectory of your home directory? If you want to, make it readable only by root.
It's not that I can't put the code anywhere I want. What I'd like to find out is whether there is a most appropriate place to put it.

Dominik Hoffmann
 
The answer is really nowhere. The security model for OS X is effectively root free, the standard mode of doing root things is via sudo. That means that having a /root directory like under some Linux distros is of no use.

So I would ask why you want to segregate those particular programs off? The most appropriate place would most likely be in a task specific location if the standard locations did not suit you.
 
lurk said:
So I would ask why you want to segregate those particular programs off? The most appropriate place would most likely be in a task specific location if the standard locations did not suit you.
The answer is that these programs/scripts are going to be cron jobs, which will have to be executed as root. I guess, I'll end up putting it into somewhere in ~admin.

Thanks very much to both of you for your feedback!

Dominik Hoffmann
 
Another reason to NOT put user apps in /bin or /sbin is OS updates might wipe them out.

Put them in a safe place (as in not to be overwritten from an update) then make soft links to a place accessibly by cron.
 
I made a folder /Library/CronJobs where I stick 'em. This was just so that I had a central place to add in scripts for cron jobs. Feel free to do the same.

BTW, anywhere on the hard drive is acessible by cron, Lycander, so long as you give the full path to the script/executable in the crontab.
 
Darkshadow said:
BTW, anywhere on the hard drive is acessible by cron, Lycander, so long as you give the full path to the script/executable in the crontab.
Permissions not with-standing?
 
Yes, because cron runs as root.

Though there may be problems if cron is running as a user other than root (from changing it in /etc/crontab or from a user's personal crontab) if that user doesn't have permissions to the script/executable at that path.
 
Back
Top