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

Enable multiple home folders on different disks System
It may be obvious to the Unix buffs out there but it was new to me: you can add multiple values to the home property in Netinfo Manager. Open Netinfo Manager, under users, find your username, then select the home property and add a new value, for example, /Volumes/external_disk/users/me, with everything after /Volumes/ being the path to your home folder on an external disk. Now the first value points to a home folder on an external disk, the second value points to a home folder on your internal disk.

Everytime you log into your account while the external disk is attached, you will get all your preferences and documents from there. Logging into your account with no external disk present, you will work with your home folder on your internal disk.

What's the use? My PowerBook has to be repaired, so I backed up all my data to another drive. While I am waiting for my PowerBook to return, I can work on either my sister's or my girlfriend's Mac, depending on whose Mac is free. Instead of copying my complete home folder to two different computers, I just use the external disk and can switch computers whenever I need to.

[robg adds: I haven't tested this one...]
    •    
  • Currently 3.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[24,950 views]  

Enable multiple home folders on different disks | 23 comments | Create New Account
Click here to return to the 'Enable multiple home folders on different disks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Enable multiple home folders on different disks
Authored by: wheeles on Feb 18, '05 11:25:59AM

Do you need to separate the individual entries with any character such as a semi-colon or a comma?



[ Reply to This | # ]
Enable multiple home folders on different disks
Authored by: aixccapt99 on Feb 18, '05 11:56:52AM

No -- NetInfo's structure lets you add multiple values to the same key. It's been a while since I did it, but there should be a plus button or an Add Value command. It's like XML, in a way -- you can create the equivalent of:
[code]<key name="home">
<value string="/Users/aixccapt99/" />
<value string="/Volumes/External/Users/aixccapt99/"/>
</key>[/code]
i.e. a key with multiple child values.



[ Reply to This | # ]
"Values" concept
Authored by: Anonymous on Feb 18, '05 12:18:27PM

Can someone please explain the concept of "values"?



[ Reply to This | # ]
"Values" concept
Authored by: fracai on Feb 18, '05 12:27:22PM

the value of the answer to your question is this post

---
i am jack's amusing sig file



[ Reply to This | # ]
"Values" concept
Authored by: fracai on Feb 18, '05 12:30:54PM

in other words a value in this case is the directory that contains your home folder. the hint details how to add multiple values (multiple directories).

in general xml is based on values and keys. just look at it as key = question and value = answer

ie. key = home, value = directory path
or key = home, value1 = directory 1, value2 = directory 2

as an aside, the answer to your question now contains 2 values ;)

---
i am jack's amusing sig file



[ Reply to This | # ]
Explanation of the "Values" concept
Authored by: babbage on Feb 18, '05 05:44:22PM

Lots of things with computers deal with key/value pairs. The "key" is something you refer to, while the "value" or "values" is/are the thing/s that the key points to.

Keys are used to look up values. Each key should refer to only one value, though it can be a compound, plural, or collective value, as in this case with multiple home directories. A value, on the other hand, can be pointed to by multiple keys. Because of this, values generally can't be used to determine keys, but keys can always be used to determine a value.

Some examples would probably illustrate more clearly.

* A dictionary term is a key; the corresponding definition is a value. Multiple keys can have the same value (the keys "chair" and "seat" might both point to the value "thing you can sit on").

* A name in a phone book is a key; the number is a value.

* An item in a book's index, or a keyword in a search engine, can be thought of as keys. The pages they refer to are values. Multiple index items or search terms may point to the same page.

* The number in a product's bar code is a key; the information about that product in a database is a value. Different stores might assign different product IDs to the same item.

* Computer login systems are built around comparing key/value pairs: you enter your username & password pair (which together form a key), and a program turns it into gibberish (a value). This gibberish is then passed to another program, which sees if the gibberish matches a database record for your account. If the values match, you're pemitted to log in.

* Functions in algebra are a way to determine key/value relationships. When figuring out f(x) = y, x is the key, and f is the mechanism for looking up the value y. (If f behaves in a way similar to the definition above, where each input value x corresponds to a unique output value y, it is sometimes called a "hash function"; hash functions are the key to all password systems and a whole lot of other computer systems as well.)

Because these relationships come up so often in computers -- databases, for example, are basically just glorified ways of managing key/value sets -- a lot of programming languages support for lists of keys & values built in directly. In Perl, a variable that contains a collection of key/value pairs is a hash, while the same construct in Python is simply called a dictionary. With databases, including OSX's NetInfo configuration database, each item in the database -- each key -- has corresponding values that can be looked up by knowing that key.

Make sense?

---

--
DO NOT LEAVE IT IS NOT REAL



[ Reply to This | # ]
Concrete example
Authored by: gatorparrots on Feb 18, '05 03:05:45PM
This technique can be accomplished with the GUI utility /Utilities/NetInfoManager.app or with command line tools. To append a second home directory entry for the currently logged in user, go to the Terminal and type in this command:
sudo niutil -appendprop . /users/$USER home /some/where
(You will need to enter your administrator password.) Or to change the settings on another user account, enter something analagous to this command:
sudo niutil -appendprop . /users/someotheruser home /some/where/else


[ Reply to This | # ]
setting the home directory value in NetInfo
Authored by: gatorparrots on Feb 19, '05 08:28:20PM
Based on the comments below and further testing, it seems as if one cannot effectively have two simultaneous home directory entries in NetInfo; rather, one should simply overwrite the home value in the database, rather than appending a second entry. The proper command for that is:
sudo niutil -createprop . /users/someuser home /some/where


[ Reply to This | # ]
Enable multiple home folders on different disks
Authored by: bfoz on Feb 18, '05 05:40:04PM

Is there a good way of keeping the two copies of your home dir in sync? When you get your laptop back, how do you sync the two? Or better yet, if the external disk is actually an NFS export, how do you tell the laptop to sync when the NFS server becomes available?



[ Reply to This | # ]
Enable multiple home folders on different disks
Authored by: ega on Feb 18, '05 05:51:04PM

This would be great but I can not get it to work.
If I set /Volumes/FOO as my 1st home and then /Users/foo as my second home then if my keydrive named FOO (yes it is case sensitive) is not already mounted /Volumes/FOO gets created and next time my keydrive is mounted as /Volumes/FOO\ 1.
Am I missing something?



[ Reply to This | # ]
Enable multiple home folders on different disks
Authored by: rasp on Feb 18, '05 11:56:06PM

This is what happened to me as well
I now have a new user dir under Volumes even though nothing is mounted.

Also, just an FYI, in case anybody doesn't realize, when messing around with user accounts, make sure you have an alternate admin login just in case you break something.



[ Reply to This | # ]
Enable multiple home folders on different disks
Authored by: bimtob on Feb 19, '05 10:14:15AM

To make this work you would need to set the alternate home directory while the external drive is mounted. Otherwise a directory will be created under /Volumes with the same name.

I'm not at my machine to test it now, but that seems to be what is going on.



[ Reply to This | # ]
It doesn't properly
Authored by: hamarkus on Feb 18, '05 07:37:41PM

It works in principle, adding the entry, copying a dummy user folder to the drive (I had 'Ignore permissions' checked while copying, but unchecked it directly after it), logging in, lo and behold it was using the user folder on the external drive (however, all the the custom icons for the 'Movies', 'Pictures' etc. folders, except for 'Applications', had dissappeared).

Logged out, switched back to my main user, unmounted the drive, logged back into the dummy user: the OS created a new user folder: /Volumes/external_harddrive_name/dummy

O.k., I in Netinfo the /Volumes entry is listed above the /Users entry, it's too late over here now, somebody else please try out the opposite.

BTW, why am I not allowed to do a sudo cd ?



[ Reply to This | # ]
sudo cd
Authored by: aixccapt99 on Feb 18, '05 08:29:23PM

I'm not 100% sure on this, but I believe it's because cd is not an executable command (ie a program), but rather a shell command. The shell is what holds the concept of your current/working directory, so cd just instructs the shell to change that directory. The system has no such concept; when the shell issues system commands it includes your working directory in the command paths automatically.

So point being, sudo runs programs with root privileges. Since cd is not a program, it doesn't work. You need to do sudo -s to get a new instance of your shell, as root, and then that shell can cd into protected locations.



[ Reply to This | # ]
It doesn't properly
Authored by: Shawn Parr on Feb 18, '05 10:26:24PM

sudo is temporary. So after the cd would finish, you would be in a directory you have no access to, and hence might get stuck in. Imagine when you get in there, you have no permissions to list anything, see anything, write to anything, or even back out of there. (I am probably wrong about the backing out, but hey it is humorous to contemplate :) )

If you need to get into a directory with special permissions, or owned by another user, sudo -s initiates an interactive shell as root for you. i.e. it is similar to just typing su in linux/bsd/unix.



[ Reply to This | # ]
It doesn't properly
Authored by: soporose on Mar 06, '05 07:49:32PM

The other posters were correct. 'cd' is not a seperate binary in your path, but rather something your given shell (bash, csh, tcsh, ksh, etc) interprets for you. To properly do that, you would need to spawn a new environment with root privs, ie, sudo tcsh.



[ Reply to This | # ]
Does not work as advertised
Authored by: wsdr on Feb 19, '05 11:11:07AM

I've tried this with the order in NetInfo as:

/Users/user
/Volumes/volume/user

and as:

/Volumes/volume/user
/Users/user

Where "volume" is the name of your external HD and "user" is your user.

In the case of the former, the second value is simply ignored. In the case of the latter, it works fine until you remove the volume-- then the OS will create a folder in /Volumes matching the path above. From that point forward, the home folder on the external volume will be ignored (it gets mounted as "volume 1").

The idea in this hint is for the user to be able to carry around his home folder on an external drive and enable him to use his girlfriend or sisters Mac without copying his folder over. This is really no different than simply changing his home folder value to the value matching /Volumes/volume/user. The second value is simply ignored by OS X, and the missing volume is recreated in the existing, but hidden, directory named "Volumes."

So, if you want your "default" home folder (the one you get when you don't have your external) to reside in the /Volumes folder, then this works just fine. But this hint does not use the /Users/user folder at all.

BTW: I tried "fooling" the system by using symbolic links. I figured that since the system was automatically creating a folder when it couldn't find the real one (and it did this because it _could_-- the path existed because of the way external volumes are handled), then maybe it would fall back to the second value if it failed to create that folder. What I did was created a folder on the HD (test) that was owned by the user in question (user), then I created a symbolic link to the home folder on the external drive. So what I had was:

/test/home

--where home was a symbolic link to:
/Volumes/volume/user

Then in NetInfo I changed:

/Volumes/volume/user

to:
/test/home.

When I logged in as the user, the system delayed about a minute after I entered password. Then it came up to a generic desktop and announced that it could not find the users home folder, and that if I had further problems I needed to contact my system administrator. I tried to take a screenshot of this, but could not-- I supposed this was because I had no home folder, therefore no Desktop on which to put the screenshot. I didn't experiment further and immediately logged out, guessing that without a proper home, it was only a matter of time before the system had problems (since it wouldn't be able to store prefs or caches).



[ Reply to This | # ]
How to do this with remote volumes?
Authored by: remolinero on Feb 19, '05 01:20:43PM
How i can get this to work with remote volumes?

I have two accounts: daniel and guest. And the remote account is alex. I used NetInfo to modify the guest account volume information, and added /Volumes/alex value to the Home property. If i have mounted the alex volume in the daniel account, and i log in as guest, i have the alex home directory as my guest home directory (this is what i want). But if i haven't mounted the alex volume, the guest account uses the guest home directory.

is there a way to automount the alex volume with NetInfo when i log in as guest?

[ Reply to This | # ]
Possible to have 2 iTunes libraries with this hint?
Authored by: berland on Feb 19, '05 04:47:48PM

Wouldn't this be a possibility to manage 2 different iTunes libraries?

I have my music on an external drive and I'm a Notebook user who would like to carry a 2nd smaller library with him on the pbook. This isn't really possible at the moment as far as I know, but this hint looks promising, doesn't it? Too bad I'm not able to figure out something like that for myself.



[ Reply to This | # ]
Possible to have 2 iTunes libraries with this hint?
Authored by: jspivack on Feb 19, '05 06:10:20PM
try this hint.

Now when I launch iTunes, the script checks to see if my server share is mounted. If so, iTunes opens my entire server music library. If not, iTunes opens my current favorites local music library. If iTunes is already running, it just brings iTunes to the foreground.

[ Reply to This | # ]

Possible to have 2 iTunes libraries with this hint?
Authored by: viscaria on Feb 20, '05 09:37:37AM

You could create another user account that uses the second iTunes library and always keep it logged in with iTunes open, and simply share the library locally to the other account. I do this on my PowerBook because I have a second account for doing demos (I'm an Apple campus rep) and I like to keep it's iTunes library populated without duplicating a lot of data.



[ Reply to This | # ]
Possible to have 2 iTunes libraries with this hint?
Authored by: oeroboros on Apr 22, '05 01:29:43PM

I have exactly the same problem.. I also want a smaller different library on my pb.
Did you manage to do this already?

Thx for your halp!
L.



[ Reply to This | # ]
What about FileVault ?
Authored by: hptroll on Apr 29, '05 01:42:59AM

Has anyone been able to do that with a FileVault account ?
It does not seem to work.

There is a "home_loc" value for FileVault accounts, in the Netinfo Manager, but there must be more. Changing the two values does not work. I tried it after creating a FileVault account that had the same name and Filvault and account passwords as my main account on my external partition. To no avail.

Anyone knows how the system handles FileVault account that makes this hint not work ?



[ Reply to This | # ]