[Samba] Mount logon Home dir on Linux (CTM)

Mi mi.lists at alma.ch
Tue Jul 12 13:25:04 GMT 2005


> So the question for this list would be: how can I query a Windows NT 
> PDC (no ldap) about a user's home directory. That script may need to 
> have an administrator password to be able to query the PDC.

I found the answer to this one. It should be pretty easy with a few 
lines of Perl. Tthis is how you can use rpcclient to find out:

 $ rpcclient -W DomainName -U AnyUserName%ThatUsersPassword -I 
192.168.1.x -c "queryuser $USER_RID" ServerName

This will output info like

        Home Drive  :
        Dir Drive   :
        Profile Path:
        Logon Script:  

etc.

To get the $USER_RID which you need for that query, first do:

 $ rpcclient -W DomainName -U AnyUserName%ThatUsersPassword -I 
192.168.1.x -c "lookupnames $USER_NAME" ServerName

it will tell you something like this
...
$USER_NAME S-1-5-21-235741621-998855438-184960113-1063 (User: 1)

The $USER_RID you want is 1063.
To get it with Perl, it would look something like

  my ($USER_RID) = /.*-(\d+)/;

(once you have the right output line in $_)

Once you know where the user's home is, you can mount it through nfs, 
and authentication should be automatic if the Linux side of things is 
configured correctly.



More information about the samba mailing list