What's the difference between /etc and /private/etc?

Thread Tools Search this Thread
Operating Systems OS X (Apple) What's the difference between /etc and /private/etc?
# 1  
Old 06-15-2011
What's the difference between /etc and /private/etc?

Hello, whilst editing sudoers at 07:24 this morning via visudo I noticed that there are two files which get changed simultaneously as shown below. Then in fact what I noticed is that /private/etc contains exactly what /etc contains.

Why is this? What is the difference between these two directories? Why do they contain a mirror of eachother?
mbp:~ m$ ls -l /etc/sudoers
-r--r-----  1 root  wheel  1325 Jun 15 07:24 /etc/sudoers
mbp:~ m$ ls -l /private/etc/sudoers
-r--r-----  1 root  wheel  1325 Jun 15 07:24 /private/etc/sudoers
mbp:~ m$ sudo visudo

Thanks, Michelle
# 2  
Old 06-15-2011
It's OSX's UNIX core. Apparently /etc/, /var/ and so forth are all supposed to be symlinks to things inside /private/. That's why they change simultaneously; it's actually the same dir. Apple's UNIX implementation is a bit eccentric.

As for why they chose to do it this way, if I had to guess, it's so they could lump all the UNIX stuff together in one folder and keep it strictly apart from everything else.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 06-15-2011
ls -l /

You'll see, among other things (or should see):

lrwxr-xr-x@ 1 root wheel 11B Mar 7 18:05 etc -> private/etc
lrwxr-xr-x@ 1 root wheel 11B Mar 7 18:27 var -> private/var

As pointed out, they are links to the actual directories in the /private directory.

The lowercase L at the start of the line indicates a link, as does the string after the link name (linkname -> target).

I've seen this, or a similar setup in another Unix platform waaaay back when. It's not "entirely" unusual or necessarily Apple-centric.

On my machine there are other directories under /private, but from a system use perspective, etc and var are probably the most frequently accessed directories there, so a link cuts down on some typing.

An annoying side note to links is, typing ls -l /var displays the information about the link file, not the directory contents, while ls -l /var/ displays the directory contents. :P Not a show stopper, but requires an additional 2 characters (up arrow then /, or up arrow then backspace) be typed if the result is not the intended one.
This User Gave Thanks to [MA]Flying_Meat For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Private Messages.

Well I have just noticed over the years that I have PMs that I have not seen or even known about. Apologies if any of you have not had any replies to your PMs. It is too late now as some go back to my early days on here. The notification that comes up currently has notified me of a couple... (10 Replies)
Discussion started by: wisecracker
10 Replies

2. Shell Programming and Scripting

awk to calculate difference of split and sum the difference

In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13. I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 Replies

3. Post Here to Contact Site Administrators and Moderators

Private messages

Hi, As i am recieving private messages, i am unable to reply to them. Could you please enable my private messages. Thanks! (2 Replies)
Discussion started by: Amulya
2 Replies

4. Shell Programming and Scripting

Private Key

I have two types of files pubring.pkr secring.skr secring.skr is encrypted and not able to read. How can i read secring.skr in text format after decrypting ? is there any way of decrypting this file? Unix HP - UX Version. (4 Replies)
Discussion started by: airesh
4 Replies

5. Programming

what is the main difference between difference between using nonatomic lseek and O_APPEND

I think both write at the end of the file ...... but is there a sharp difference between those 2 instruction ..... thank you this is my 3rd question today forgive me :D (1 Reply)
Discussion started by: fwrlfo
1 Replies

6. Windows & DOS: Issues & Discussions

Private Network

Hello, I have a desktop which has two network cards installed on it and I connected these two card through a hub. On the desktop in have installed a Windows Vista Home Edition SO and a Windowx XP SO in a virtual way. I also had intalled a Virtual BOX software and Windows XP run through it. By... (1 Reply)
Discussion started by: zendcool
1 Replies

7. Linux

Private directory

Hi there, I'm working on a server with Fedora 6 and I can access root password. My problem is that even other people can ...:mad: and I'd like to have at least a private directory, but until now I couldn't find a clear answer... So I'd like to know if it's possiple to restrict access to a... (5 Replies)
Discussion started by: Giordano Bruno
5 Replies

8. IP Networking

Private network

Hi all, Currently we are in the progress of setting up a private network on all of our Sun Solaris servers. Purpose is to move all backup tasks to the private, hence reduce load on public network. Some of our servers only consists of 1 network card but with several ports. Shall we purchase... (10 Replies)
Discussion started by: *Jess*
10 Replies

9. Solaris

Private Lessons

Hi everyone, I'm looking to hire for private lessons a individual who is presently working as a unix system administrator or instructor in school who is teaching unix. I live in Clifton nj my nubmer is Cell **no phonenumbers on this forum** or email **no emails on this forum** please let me... (1 Reply)
Discussion started by: john furman
1 Replies

10. IP Networking

private network to private network gateway

i have one private network with one ip address, and i have a seperate network on a seperate ip address. now, each network is behind a firewall/router. now what i want to do is be able to access one server on the second network from a computer on the first., but with the private ip address, (this... (2 Replies)
Discussion started by: norsk hedensk
2 Replies
Login or Register to Ask a Question