How does Mac OS X create the /private directory, links, and when?

I need to create something similar for several GNU/Linux boxes to mount shares coming from Windows Server 2008 R2. I need the /private deal due to the screwy permissions that come off Server 2008.


Mike

Posted on Jan 18, 2013 1:22 PM

Reply
9 replies

Jan 18, 2013 1:52 PM in response to mikeegg1

What is it about /private that you want? The fact that it is hidden?


/bin/ls -dleO@ /
drwxr-xr-x@ 35 root  admin  - 1258 Jan 17 13:12 /
        com.apple.FinderInfo      32 

/bin/ls -dleO@ /private
drwxr-xr-x@ 6 root  wheel  hidden 204 Jan  9  2010 /private
        com.apple.FinderInfo     32 

/bin/ls -dleO@ /private/*
drwxr-xr-x  112 root  wheel  - 3808 Jan 17 21:49 /private/etc
drwxr-xr-x    2 root  wheel  -   68 May 18  2009 /private/tftpboot
drwxrwxrwt   57 root  wheel  - 1938 Jan 18 16:28 /private/tmp
drwxr-xr-x   26 root  wheel  -  884 Jan  9  2010 /private/var


If "hidden" is all you want, then on Mac OS X you use


chflags hidden /path/to/the/file/or/directory


However, I do not know if Linux (and other flavors of Unix) have a similar "Hidden" flag. The traditional Unix hidden file trick is to start the file or directory with a period, then the default 'ls' command will not display any file or folder starting with a period, unless "ls -a" is used. I think the typical Unix GUI interfaces also treat the leading period files as hidden as well.


If you are not talking about hidding /private, then please elaborate on what your needs are.

Jan 18, 2013 2:33 PM in response to BobHarris

Thanks Bob,


Not that /private is hidden. I migrated a bunch of stuff from GNU/Linux to Windows Server 2008 R2 since Windows File Sharing supports NFS and this is essentially a Windows shop. It was a mess. I still have requirements to share some files from Windows to GNU/Linux. It's a pain. For each user I must "mount -t cifs ...." for the filesystem using the user's specific user/password combination for the Windows Domain.


I have configured (finally) autofs to properly authenticate for a single user from GNU/Linux to Server 2008, however this always mounts to /smb/$host/$share. Since this is authenticating for a single, specific user with that user's password I want the share mounted/automounted to /home/$user/$host/$share with permissions 0600/0700 for that user alone.


I realize it would be inefficient as multiple users could mount the same share to their own /home directories. This is what I'm trying now.


What I'm mentally toying with is changing /etc/profile to execute all the commands in the start up. I think autofs will automatically mount /home/$user with the right permissions. If true, then in /etc/profile I can "mkdir $HOME/$host/$share && mount -t cifs -o uid=$UID,gid=513,file_mask=0600,dir_mask=0700 //$host/$share $HOME/$host/$share". I've not tested this idea yet.


Mike

Jan 18, 2013 6:33 PM in response to mikeegg1

mikeegg1 wrote:


I asked in my title how does the Mac do this.

How the Mac do what? Create a directory? mkdir. Create a link? ln -s When? When you install the OS.


In the description I said why I want to create something similar on GNU/Linux. I have not said there is a Mac problem. I asked here because Mac does what I want on GNU/Linux.

I suggest you ask in some Linux forum. What you seem to be asking has nothing to do with /private. You seem to be asking about how automount works on Linux. It may work similar to how it does on the Mac and it may not. Someone here could come along with an answer, but it sure doesn't seem like a great place to go looking.

Jan 18, 2013 8:53 PM in response to mikeegg1

os X does not 'create' the /private folder, except in the trivial sense that it is one of the folders added when the system is first installed.


If you want to control mount-points automatically on an os X system, use fstab to create the appropriate mount-points for a given disk. mount-points are not 'real' entities - they are effectively symbolic links that point to file systems on different volumes - so multiple users with different mount points will not cause any 'efficiency' problems (except, again, in the trivial sense that that a link will need to be created for each user rather than one common link at root level)


I have no idea why you're talking about Windows servers and gnu/linux stuff, unless you're trying to indicate that you are using os X to transfer files between a mounted Linux drive and a mounted windows-based server. If that is what you're trying to do, I have no idea how /private comes into the picture. can you clarify the description of the problem, and what role OS X has in this Winduxgnu mess?

Jan 19, 2013 6:25 AM in response to twtwtw

I have permissions issues on shares from Windows Server 2008 R2 shares mounting on GNU/Linux. I think these issues can be solved if the shares are mounted to GNU/Linux if the shares are mounted to GNU/Linux in a similar way way that OS X mounts things in /private. I'm trying to figure out how OS X manages the /private space so that I can emulate the same thing on GNU/Linux.


Mike

Jan 19, 2013 9:42 AM in response to mikeegg1

os X does not mount *anything* in /private. /private is a folder used to store system-relevant information that users should not normally muck with (hence the name 'private'). The standard os X mount point is /Volumes.


please describe what effect you are trying to emulate. That 'emulate the same thing' phrase is completely useless.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How does Mac OS X create the /private directory, links, and when?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.