Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Proper Use of UNIX Layer UNIX
I've noticed that over the months that I have been reading macosxhints.com, a lot of hints advise to do UNIX level things which are not proper. They usually get the job done, but poorly. Most of these involve hint giver's confusion over when to use the various Library directories. So I decided that although many users know this information, it may be a good idea to explicitly say it.

To see the rest of this hint, read on.

You should ONLY put stuff in your /Library directory when you MUST. Sometimes you have things that need to be configured for all users or for boot time, but I have seen a lot of hints that suggest to install user level things in the /Library directory.

The /Library directory in your home directory (/Users//Library) is where 99.9% of all your configuration files should go. This is where everything that pertains to the way you like to run your computer goes. Application preferences go in here, added preference panes usually go here, and the list goes on.

So before installing anything in a directory for which there is a system level one and a user level one, ask yourself carefully where it should go. Don't just follow a hint blindly. If you have to gain superuser status (through su or sudo (to which su is better!)), be very careful that you are doing things right.

I understand that most users are new to UNIX, and it can be confusing. Most of you are all learning UNIX together, by exploring and trying things -- inventing as you go. Which leads me to note that many of the UNIX command line suggestions I see on here have better and faster ways. Sometimes I see things that are just downright improper hacks that work, but poorly.

Anyway, I guess the point is just to make sure that everyone is wary of what is posted on macosxhints.com. Not everything is right, and some thought should be taken before following a hint's directions. The people that post the hints may be just as new to UNIX.

Happy Hacking! :)

P.S. - Hope I haven't offended anyone; I'm not trying to sound like a jerk, just offering my advice.

[Sudo Editor's Note: Although paploo is correct, it should be noted that hints you see anywhere on the Internet that deal with the Unix under-pinnings of your OS X should be dealt with caution. One thing that makes this site so great, is that hints by those less experienced are often modified, corrected and enhanced by those more in the know, so we can all learn together and feel like we are not out on our own while experiencing a revolution in OS's.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,360 views]  

Proper Use of UNIX Layer | 19 comments | Create New Account
Click here to return to the 'Proper Use of UNIX Layer' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Hehe...
Authored by: sharumpe on Mar 07, '02 11:20:19PM
Anyway, I guess the point is just to make sure that everyone is weary of what is posted on macosxhints.com.

Ummm, I think you mean wary. We don't want anyone to get weary of what is posted here. :)

Mr. Sharumpe

[ Reply to This | # ]
Hehe...
Authored by: rebug on Mar 08, '02 01:55:26AM

or leery.

The issue may be phoenetic or syntactic.



[ Reply to This | # ]
Hehe...
Authored by: outofcontrol on Mar 08, '02 01:45:15PM

Thanks for pointing that out. I guess I was weary when I should have been wary. All fixed now.

Plattapuss



[ Reply to This | # ]
Where to install.
Authored by: professor on Mar 07, '02 11:42:42PM

I think this hints sows more confusion than it clears up.
There are *three* places you might install some neat thing you find
on MacOSXHints (or elsewhere):
1) /Network/Library/
2) /Library/
3) /Users/<yourname>/Library/

You should install in 3) if the file pertains to *you* and not to some
other user(s) on the machine. Examples would be Preference files,
Configuration files, Services you intend to use, but which would be
irrelevant to your spouse . . .

You should install in 2) if you want *everyone* on the machine to
have access to it (eg, a Service your spouse *would* be interested in
using).

You should install in 3) if you want all the OSX machines on your LAN
to have access to it.

Often, it is best to install in 1) first, experiment with the new hack,
see if you like it, and THEN transfer to 2) to make it available to
everyone.

The real "hint" along the lines of the original post is that you should NOT install anything in

/System/Library/

but y'all knew that already and weren't even tempted.

Now, maybe I've gone and made you curious: "What if I . . . "

Sigh.



[ Reply to This | # ]
Where to install.
Authored by: Hes Nikke on Mar 08, '02 02:15:19AM

actuly that was confusing too just because you fliped around the order half way thorugh the post!

here it is corrected ;)

I think this hints sows more confusion than it clears up.
There are *three* places you might install some neat thing you find
on MacOSXHints (or elsewhere):
1) /Users/<yourname>/Library/
2) /Library/
3) /Network/Library/

You should install in 1) if the file pertains to *you* and not to some
other user(s) on the machine. Examples would be Preference files,
Configuration files, Services you intend to use, but which would be
irrelevant to your spouse . . .

You should install in 2) if you want *everyone* on the machine to
have access to it (eg, a Service your spouse *would* be interested in
using).

You should install in 3) if you want all the OSX machines on your LAN
to have access to it.

Often, it is best to install in 1) first, experiment with the new hack,
see if you like it, and THEN transfer to 2) to make it available to
everyone.

The real "hint" along the lines of the original post is that you should NOT install anything in

/System/Library/



[ Reply to This | # ]
nitpick
Authored by: macubergeek on Mar 09, '02 08:51:17AM

1) /Network/Library/
2) /Library/
3) /Users/<yourname>/Library/

You should install in 3) if you want all the OSX machines on your LAN
to have access to it.

*****Just a nitpic, I think you meant to say you should install in 1) to allow all the osx machines on your lan to have access to it.



[ Reply to This | # ]
Don't Criticize, CONTRIBUTE ...
Authored by: Anonymous on Mar 08, '02 12:05:43AM
Which leads me to note that many of the UNIX command line suggestions I see on here have better and faster ways. Sometimes I see things that are just downright improper hacks that work, but poorly.

These people are doing their best, paploo, and, as pointed out, our community has the ability to improve on these hints via user contributions.

If you see "downright improper hacks" that can be done "better and faster," then I suggest, instead of contributing a hint that tells us all what clueless newbies we are, that you instead contribute by telling us the "better", "faster", and supposedly "proper" way of doing things.

"If I care to listen to every criticism, let alone act on them, then this shop may as well be closed for all other businesses. I have learned to do my best, and if the end result is good then I do not care for any criticism, but if the end result is not good, then even the praise of ten angels would not make the difference." — Abraham Lincoln

Mike

P.S. To the sudo editor — you don't have to publish every hint you get, y'know.

[ Reply to This | # ]
verrrry interesting
Authored by: macubergeek on Mar 09, '02 09:02:13AM

I find this discussion very interesting. I'm a mac guy who got immersed in Solaris at work. In Solaris use of the su command IS logged in /var/log/sulog. I'm wondering why this would be different under Macos x?



[ Reply to This | # ]
verrrry interesting
Authored by: mervTormel on Mar 09, '02 01:26:12PM

sudo, on my rig, logs to /var/log/system.log

from man sudo:
--
sudo can log both successful an unsuccessful attempts (as
well as errors) to syslog(3), a log file, or both. By
default sudo will log via syslog(3) but this is changeable
at configure time.
--

i think you may be able to recompile sudo with some switches to alter the logging mechanisms.

a sudo -L lists the kinds of things compiled into your sudo

-mt



[ Reply to This | # ]
verrrry interesting
Authored by: bakednotfried on Mar 10, '02 02:08:56PM

sure, running the su command is logged, but then you are root and nothing you do from that point on (as root) is logged.

-- mike



[ Reply to This | # ]
solaris sites
Authored by: look on Mar 10, '02 04:05:02PM

I too am a long time 'Mac Guy' with an OT request. I recently have been using more and more Solaris at work and was wondering if you could recommend any websites or publications for an individual with unix knowledge but a more Mac style leaning. Sites like this one or VersionTracker are examples of what I am looking for. Any comments would be gretly appreciated.



[ Reply to This | # ]
verrrry interesting
Authored by: soloha on Mar 16, '02 12:55:27AM

where, whether and at what level logs are sent is determined by the /etc/syslog.conf file which syslogd reads at startup. It could be different for any machine you are on. The syslog.conf man page explains how to change any of the above mentioned logging attributes.



[ Reply to This | # ]
SU Better than SUDO!?!?!
Authored by: mudmonkey on Mar 08, '02 11:21:59AM

Before chastising people for trying, learn about your own system some.

Sudo is ALWAYS preferable to su. In fact, no one outside of the wheel group is typically allowed su. sudo was designed to fix many of the problems with su regarding security and logging. Remember, everything you do via sudo is logged. Want to know where you went wrong? Check the log. su provides little or no security checking unlike sudo.



[ Reply to This | # ]
No! (usually) (re: SU Better than SUDO?)
Authored by: sharumpe on Mar 08, '02 01:38:14PM

I'd go a step farther and say that, unless something is wrong or just plain won't work under sudo (rare), you shouldn't ever log in as root unless you are so filled with hubris that you think the BOFH stuff is all funny, and never offensive (standard for a sysadmin).

Maybe over the top, but the main point is that it is dangerous to play around as root unless you are a) sure about what you're doing; and/or b) willing to live with the consequences if not a).

:)
Mr. Sharumpe



[ Reply to This | # ]
No! (usually) (re: SU Better than SUDO?)
Authored by: mervTormel on Mar 09, '02 01:46:01PM

--
unless you are so filled with hubris that you think the BOFH stuff is all funny, and never offensive (standard for a sysadmin).
--

i take umbrage at that poke, sharumpe. that is not standard sysadmin behavior. perhaps you've had some bad experiences, but please don't perpetuate the mythology about admins. being a sysadmin is like herding cats. but most admins are good folk, and truly helpful. perhaps one's approach to an admin needs to be carefully considered. help them help you.

as to the su vs. sudo debate, i think the key here is what fighter pilots call "situational awareness." and that by dropping your guard, you can get your ass shot off.

as for any code anywhere you acquire it; 'tis best to eyeball it as best you can and if you don't understand parts, try and run small excerpts of code piece-meal so you can see their results.

-mt

--
It has been said that systems administration is hours of boredom interrupted by moments of sheer panic. Through the highs and lows of this existence, there is one constant: answering user requests.



[ Reply to This | # ]
give this guy a break!
Authored by: lastobelus on Mar 09, '02 09:11:28AM

Seems to me he was trying to be genuinely helpful.

There are a lot of things about unix that are learned conventions, that people learn by being in an apprenticeship situation or immersing themselves in the unix culture. Now there are a bazillion mac users who are in neither situation learning to use unix. I think its vital for people to point out when the unix way-of-doing-things is being distorted or corrupted.

If it turns out that their view of the way-of-doing-things is not the best or most accurate and it generates a discussion, so much the better. But don't blast the guy for speaking up. How else are people who aren't hardcore geeks going to become aware of unix conventions?



[ Reply to This | # ]
Not exactly accurate
Authored by: Colonel Panic on Mar 09, '02 09:38:55AM

I put most of the stuff in the /Library folder because if you put items in your ~/Library folder, you will have to copy the item to each of your users ~/Library folder. If you put the item in /Library, it is globally accessible. NEVER put stuff in your /System/Library folder, that is ONLY for Apple's use.



[ Reply to This | # ]
You did sound like a jerk.
Authored by: etwoy on Mar 10, '02 12:59:21AM
P.S. - Hope I haven't offended anyone; I'm not trying to sound like a jerk, just offering my advice.






Well I thought you did come across like a jerk.

There's more than one way to do most anything on the command line, and sometimes the most efficient way isn't the best way to explain something to someone who doesn't understand the commands being used all that well.

The only information you gave in this hint was the three Library folders and their purpose, hardly unix guru stuff....

If you have knowledge on better ways to do things, then just damn well post them and get off your high horse.



[ Reply to This | # ]
Well, if you want to get technical...
Authored by: xeroply on Mar 10, '02 11:53:35PM

As I understand it, the Library folders are not strictly part of the UNIX layer, but rather an Apple/NeXT -invented means of organizing things. Of course, the user architecture they are governed by is part of UNIX.

Also, I doubt very many users have anything living in their Network directory (including a Library folder) unless they have set up a NetInfo domain on an OS X server machine (if I understand it, that's how Network/ gets populated with specific shares that are mapped to folders like Library/ and Applications/)

Good note of caution, though. But enthusiastic users aren't the only ones needing it, if recent experiences with installers messing up permissions (or, uh, deleting partitions) are any indication.



[ Reply to This | # ]