Skip to main content

You may be using a Web browser that does not support standards for accessibility and user interaction. Find out why you should upgrade your browser for a better experience of this and other standards-based sites...

Dartmouth Home  Search  Index

Dartmouth Home | Search | Index

Dartmouth home page
Computing at Dartmouth
 
Computing > Support >  Library >  Research > UNIX > Files > AFS >  

Changing the Macintosh Username and UID to Match AFS

Most users will not need to perform the following steps, but it may be useful to synchronize your user account details on the Macintosh with those in AFS, or even to configure the Macintosh to use your AFS directory as your home directory. Obtaining AFS credentials at login time is outside the scope of this document. The following steps are intended as a guide for experienced users only.

  1. If your user name on the Macintosh is not the same as your AFS user name, you will need to create a new user account on your Macintosh that has the same name as your AFS name. You will then need to add that user to the groups you currently belong to on your Macintosh. (If your Macintosh user name is the same as your AFS user name, you can skip this step.)
    1. Open the Users Account manager by selecting System Preferences, Accounts, then New User (+). Create a new user with the same name as your AFS name.
    2. Open a Terminal window.
    3. Enter /usr/bin/id. It will print a list of the groups you currently belong to.
    4. Open up the NetInfo utility's group pane by selecting Finder, Applications, Utilities, NetInfo Manager, then Groups. Click the Lock icon in the lower left-hand corner and enter your admin passwd so that you can make changes. Add your AFS user name to all of your current Macintosh groups.
    5. From a Terminal window, copy over all the files from your old Macintosh user name directory to the account you just created: % sudo cp -pR /Users/old-mac-username/* /Users/afs-username.
    6. Log out and log back in under your AFS user name.
  2. Change the uid of the AFS user name on the Macintosh to match your AFS uid. To do this, open the NetInfo utility user's pane by selecting Finder, Applications, Utilities, NetInfo Manager, then Users.
    1. Click the Lock icon in the lower left-hand corner and enter your admin passwd so you can make changes.
    2. Double-click on your AFS user name.
    3. Change the value for the uid to be the same as your AFS uid. (Your AFS uid can be found from the Terminal window with the command /usr/bin/pts examine afs-username.

      In the id: number field, number is your AFS uid. Be sure to write down your current Macintosh uid, since you will need to provide it in the next step.)
  3. Change ownership of all your files on the Macintosh to your AFS uid. To do this, open a Terminal window and enter % sudo find / -xdev -user old-mac-uid -print -exec chown new-afs-uid {} \;.

    This could take a few minutes to complete, depending on how big your system is. Be patient! When find has finished, issue a klog command to be sure you have a token. Make sure you can access your AFS file space through the GUI (the AFS icon on your desktop).

    Note: When you log in for the first time after a reboot, you will not have a token. You will need to klog to get a token. Tokens are preserved when you log out and back in, however.
  4. If you want your Macintosh home directory to be the same as your AFS home directory, you will need to tell the Macintosh your home directory resides in AFS space. The cd command will then take you to your AFS home directory.

    Open the NetInfo Manager User's pane as above. Access your AFS user name entry and change the value of home to be the pathname to your AFS home directory.

    You can determine your AFS home directory by logging onto one of our machines (e.g., polaris) and invoking the pwd command from a Terminal window. The full path to your home directory will be listed in the output.

    In a Terminal window, create the following symbolic links:

    % cd /afs/path/to/your/AFS/home
    % ln -s /Users/your_user_name/Desktop .
    % ln -s /Users/your_user_name/Documents .
    % ln -s /Users/your_user_name/Library .
    % ln -s /Users/your_user_name/Music .
    % ln -s /Users/your_user_name/Pictures .
  5. Clean-up: If you created a new Macintosh user account in step 1 above, you may want to delete the old one at some point. It is best to keep it around until you are sure everything is working correctly. At that point, you can delete the old account as follows:
    1. Open up the Users System Preferences by clicking System Preferences, then Users.
    2. Click the lock icon in the lower left-hand corner and enter your admin passwd so you can make changes.
    3. Click on your old Macintosh user name.
    4. Click the Delete button.
  6. Adding Other AFS Users: The Macintosh uses the NetInfo database as a password file instead of /etc/passwd. You can add new users to the NetInfo database using the nidump and niload commands. For example, as root # cd /tmp # nidump passwd . > passwd.new.

    This will dump the contents of the NetInfo passwd table into passwd.new. Edit passwd.new to add users. For example, to add the user smith, you would add a line similar to smith::12434:200:0:0::Joe Smith:/afs/northstar.dartmouth.edu/staff/smith:/bin/tcsh.

    Load the file back into the Netinfo database with the command # niload passwd . < passwd.new. Smith will now be able to log on to your machine with his home directory set to AFS space.

    To modify a password entry, edit the file passwd.new to make the necessary changes, then load it into the NetInfo database with the command # niload -d passwd . < passwd.new.

    Note: The fifth and sixth fields of the Macintosh password line (0:0) are unique to the Macintosh platform; they specify password expiration times. We do not use this feature, so leave them set to 0.

Startup Item

AFS installs a startup item so it will load on every boot. It is recommended you create a line in /etc/hostconfig so you can turn AFS on or off, if you desire. Occasionally, you will run across a badly designed patch or updater program that will want to scan your whole computer, including all mounted file systems and all of the AFS world! It would be nice to turn AFS off temporarily in a situation like this. To do this, you will need to edit two text files:

  1. Authenticate as root at the terminal.
  2. Go to the /Library/StartupItems/OpenAFS directory. Open the OpenAFS file in that directory.
  3. After the line if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi, add the line if [ "${OPENAFS:=-NO-}" = "-NO-" ]; then exit; fi.
  4. Save the file you just edited.
  5. Go to the /etc directory and open the hostconfig file.
  6. Add the line OPENAFS=-YES-.
  7. Save the file you just edited.

Now, if you want to toggle AFS on and off, you can edit /etc/hostconfig to say -YES- or -NO-, depending on whether you want AFS to load or not.

05/08/08

Last Updated: 5/9/08