[OpenAFS] mapping afs homedirs for windows users

Rodney M. Dyer rmdyer@uncc.edu
Fri, 21 Dec 2007 15:11:29 -0500


At 11:45 AM 12/21/2007, Dave Botsch wrote:
>Those of you using windows and mapping a user's afs homedir to a windows 
>drive, how are you doing it?

Our xp logon scripts can see our unix passwd file so I just use some 
command shell code something like the following...

         :: get afs home directory
         set "afs_homedir="

         nlfecho Finding AFS home directory...
         if not exist "\\afs\uncc\...\passwd" (
                 echo error.
                 echo Unable to access AFS UNIX passwd file.
                 exit /b 1
         )

         :: search password file for user's entry and get homedir
         for /f "tokens=6 delims=:" %%i in ('findstr /i /b /c:"%UserName%:" 
\\afs\uncc\...\passwd') do (
                 set "afs_homedir=%%i"
         )

         if not defined afs_homedir (
                 echo error.
                 echo User not found in passwd file.
                 exit /b 1
         )
         echo done.

         :: remove the /afs and convert forward slashes to backslashes
         set "xp_homedir=%afs_homedir:/afs=%"
         set "xp_homedir=N:%xp_homedir:/=\%"

         echo Homedir=%xp_homedir%

         :: check for existance of home directory
         nlfecho Checking AFS home directory...
         if not exist "%xp_homedir%" (
                 echo error.
                 echo The home directory doesn't exist.
                 exit /b 1
         )
         echo done.

Note that our users have the AD account home drive property set to 
something like:

      "n:\uncc\...\rmdyer"

So the N: drive is already mapped globally when the user logs on via...

      net use n: \\afs\all

Of course global drives are now deprecated and are not supposed to be used, 
but we still use them in XP.  We are working on plans to use UNC paths 
soon.  The trouble is that the xp command shell (cmd.exe) cannot use a UNC 
path as a current directory, so I'm not sure what Microsoft "expects" us to 
use in the Profile options dialog of the AD account options.

Rodney