Service-names and computer-names checked for in getpwnam

Richard Sharpe sharpe at
Fri Jan 28 14:12:09 GMT 2000

At 03:29 AM 1/29/00 +1100, Gerald Carter wrote:
>Mattias Gronlund wrote:
>> Hi,
>> Is there anyone that knows why SAMBA checks for the name of the
>> service with getpwnam when a connection to a share is initiated?
>See the explanation of the [homes] service in the smb.conf man 

As Jerry is intimating, if Samba cannot find the service you have requested
in a net use (or other means of connecting to a service), it then check to
see if there is a [homes] section and if so tries to find a home dir for
the user accessing the service.

Actually, the check is done the other way around, that is the check is done
for the home dir first, and then for the [homes] section to pick up some

The above is handled in find_service in source/smbd/service.c.  It is
get_home_dir which is passed the service name and treats it as a username
that calls Get_Pwnam ... which eventually calls getpwnam.

If one cannot be found, then printcap is searched for a printer matching
the share name.

>                            Gerald ( Jerry ) Carter	
>Engineering Network Services                           Auburn University 
>jerry at   
>       "...a hundred billion castaways looking for a home."
>                                  - Sting "Message in a Bottle" ( 1979 )

Richard Sharpe, sharpe at, Master Linux Administrator :-),
Samba (Team member,, Ethereal (Team member,
Co-author, SAMS Teach Yourself Samba in 24 Hours
Author: First Australian 5-day, intensive, hands-on Linux SysAdmin course

More information about the samba-technical mailing list