Default User Folder Location

franton
Valued Contributor III

Hi,

Any way of changing the default location where user folders are located? I'm guessing it's something to do with dscl but i'll be damned if I can find anything.

(Before anyone suggests that I play about with mount points and the fstab file, this is NOT an option for me as i'm having to deal with a combination of Bootcamp and CoreStorage issues simultaneously.)

16 REPLIES 16

PeterClarke
Contributor II

Hi, it's not clear EXACTLY what you mean, by changing the default location for User Folders.

I think, you are referring to the Local HD, location of User Folders ?

If so it's possible, for instance to relocate /Users to a different location, such as another disk partition
and to provide a symlink to that, back to the original Startup Disk.
-- That configuration does work.
-- dscl in that case still refers to /Users, except that that is really located elsewhere...

Though I am not sure that is what you are looking for...

franton
Valued Contributor III

When you go into the advanced options on a user account, it allows you to change the folder (usually /Users/? ) to something else. I'm trying to change the default path so that when an account is created, the folder for it appears automatically on another volume instead of in /Users.

I've read enough threads on jamfnation to realise that using a symlink will break feu settings when deploying packages. I'm being forced to use CoreStorage because the requirement is to put this on a 3Tb iMac (which we told them NOT to buy) that also needs Bootcamp installed, so I have to get "creative" with my solution here.

The plan is to use CS to split the drive into three, with a bootcamp partition in the middle ending just before the nasty 2.2Tb limit that Windows imposes. The last partition we'll use for the user account folders so i'd like things to be created there by default.

There "might" be a way of doing things with MCX in com.apple.mcx.plist but i'm unsure as hell of that as well as symlinks. Surely there's a way of doing this via reprogramming of an attribute in the dscl database somewhere? Damned if I can find anything on this.

nicktong
New Contributor III

Cool.

nfsHomeDirectory

#!/bin/bash

newuser="ElUser"
dscl . -create /Users/$newuser
dscl . -create /Users/$newuser RealName "El User"
dscl . -create /Users/$newuser UniqueID 1234
dscl . -create /Users/$newuser PrimaryGroupID 20
dscl . -create /Users/$newuser NFSHomeDirectory /arbitrary/path/to/home/for/"$newuser"
dscl . -create /Users/$newuser UserShell /bin/bash
dscl . -passwd /Users/$newuser abc123

And if you'd like:

dscl . -append /Groups/admin GroupMembership ElUser

I've symlinked /users in the past when there was a need for accounts created from the GUI to have homes elsewhere by default, but was never really happy with the idea.

franton
Valued Contributor III

The problem with that is it involves manually creating user accounts, which I can't do as JANET regs mean I have to have AD authenticated accounts. The account creation process has to be handled by the AD plugin and the OS or it's not going to work for me.

bentoms
Release Candidate Programs Tester

On 10.8 I tried using MCX & config profiles to set home folders to a new location. It worked sporadically.

I use FSTAB to mount a partition @ /Users/ works well.

I know you mentioned you can't do that, but can you specify why?

franton
Valued Contributor III

fstab doesn't work with CoreStorage volumes on the 3Tb iMacs I have to support. Plus it's been marked as depreciated since at least 10.5.

I'm forced to use this because the requirement is for Bootcamp partitions to put on the drive. They have to be placed before the 2.2Tb mark or Windows (!) doesn't work. Bootcamp Assistant refuses to work unless the drive has CS enabled on it.

After discovering all that, my boss has now insisted I segregate the user folders to the partition at the end of the hd. Symlinks apparently don't work with Casper's FEU option, so the only way I can see of doing this is to change the default folder where the user accounts are created.

I have what's looking like a perfect storm of requirements and it's looking (to me) impossible to satisfy all of them. This is the last piece of the puzzle for me.

(on a side note: how sporadic was the MCX? what was your exact experience?)

bentoms
Release Candidate Programs Tester

Can you provide a link regarding core storage? (Just for my curiosity).

I thought FSTAB.hd had be deprecated & not FSTAB? https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/fstab.5.html

bentoms
Release Candidate Programs Tester

From: https://discussions.apple.com/thread/3212415?start=0&tstart=0

philfsimon Re: Prevent FileVault volume from mounting in Lion Nov 14, 2011 1:03 PM (in response to Josh123) lion 7.2 for me here, and i figured it out. they have a file called fstab.hd, but there's a note in there that says they don't use it anymore. what you have to do is make a file called just 'fstab' in your etc directory so the first thing you do is find your partition's Unique Universal Identifier (UUID.) Do this by opening the disk utility, then clicking on the partition in question first, then info. The UUID should be labeled there. Simply copy it. go to terminal, type in sudo nano /etc/fstab you should see a blank file. type this in: UUID=(your UUID) none (your file system type) rw,noauto this is an example of what it would look like for a filesystem that is hfs (a mac journaled file system) UUID=8BCD6347-4CR5-32A7-A3FB-8H35281DB30E none hfs rw,noauto so if yours is a mac filesystem, that's all you have to type in your fstab file. in nano, hit CTRL+O to save (write out) the new file. Then CTRL+X to exit. if it doesn't save, make sure you typed in 'sudo' before choosing the file. notes: if you have a separate file system other than the mac filesystem, you have to research what type of file system you have to type in place of "hfs". for example, if you're running an ntfs partition, you would type in "ntfs" instead of hfs. Bottom line. fstab is not currently in osx lion, but if you make one there, it will work in not mounting your drives when you start. You can of course still mount the drive via disk utility and have the full function if you want to. Like (0)

bentoms
Release Candidate Programs Tester

Oh & if that works, here is how I use FSTAB in my imaging workflow: http://macmule.com/2012/07/31/how-to-use-fstab-within-a-casper-imaging-workflow/

franton
Valued Contributor III

Technically speaking, isn't all this done through auto_fs and shouldn't we be altering the /etc/auto_master file in some way?

franton
Valued Contributor III

Sadly I can't provide a link to the Bootcamp Assistant issue, but I only got it to stop producing error messages after I converted the drive to CS.

The windows 2.2Tb issue is well documented here: http://www.twocanoes.com/support/winclone/installing-windows-via-boot-camp-on-a-large-(2.2-tb-or-lar...-drive-in-lion-(10.7)-and-later)

Quick summary. Windows can't be installed on any partition after the 4th one and can't exist past the 2.2Tb mark on the drive. Nightmare.

bentoms
Release Candidate Programs Tester

So, you can only have 4 partitions?

Wouldn't that be:

  1. OS
  2. Users Home
  3. Recovery
  4. [Windows/li]

Do you need the recovery partition?

Sorry I'm struggling with the corestorage bit too, is that a fusion drive?

franton
Valued Contributor III

We're quite reliant on the recovery partition being present. It's necessary for the lock, un-enroll and remote erase functions in the inventory.

The CoreStorage part seems to be needed if you have either a fusion drive or a 3Tb hard drive. As stated earlier, Bootcamp Assistant will refuse to operate without the drive being a CS drive.

franton
Valued Contributor III

On a more fundamental level a standard filesystem would be:

1) EFI
2) Mac OS X
3) Recovery
4) Bootcamp

On Tuesday when we're back from the UK's easter break i'm going to see exactly what changes BA makes to a single volume drive. From that, it should be easier to sort out the filesystem.

It would still be a LOT easier if the default home location could be modified instead of resorting to filesystem trickery with fstab. When the OS creates a user, it has to create a local database record for that user before creating the user folder itself. Is that operating under the same principle of copying a default record from somewhere that points to /Users and then being modified to add the username. That's the bit i'm trying to alter. It'll save a lot of shell scripting.

sean
Valued Contributor

Have you considered running virtualisation instead of boot camp, e.g. VMware? Alternatively, doesn't something like rEFIt allow you to have more partitions? Creating /etc/fstab is probably the best way to do this, so one of these options may present a better overall solution to you.

franton
Valued Contributor III

Virtualisation has been rejected by the particular college making the purchases. They're apparently planning to run software like Dassault Systems Solidworks. Anything like CAD stuff probably needs more than Parallels or VMWare can throw at it graphically.