Change Request: New Environmental Variable for Username

Crist J. Clark cjc at
Mon Jan 31 17:38:26 GMT 2000

Presently, the Samba documentation says that the default NetBIOS
username used by client-type applications is determined by the
following (from smbclient(1)),

              If no username is supplied, it will default  to  an
              uppercase  version of the environment variable USER
              or LOGNAME in that order.  If no username  is  sup-
              plied  and  neither environment variable exists the
              username "GUEST" will be used.

However, very frequently a username on a given machine might not
exactly match the username on another, but users may still have a
nearly one-to-one mapping from one machine to another. Changing the
USER or LOGNAME variables on the local machine can break local
applications. So at present, users need to use the '-U' switch on the
command line every time to enter their username on the foreign server.

I propose that using an additional environmental variable,
e.g. SMBUSER, would make life easier for such users. This variable
could be set once in a user's startup files, and they would no longer
need to enter the '-U' option each time they used a Samba client.

For example, user 'johnd' on machineA has an acount on machineB called
'jdoe'. Our user need only set SMBUSER equal to 'jdoe' in his startup
on machineA, and he no longer needs to type it everytime.

If the SMBUSER variable is not set, Samba would default to the current
behavior. When it is set, that name is used. The '%' character can
have the same special meaning as it does for USER or LOGNAME.

I'd be willing to write the patch, but I thought I would submit the
idea first. It seems so obvious to me that I worry that there is some
very good reason NOT to do this.

Thanks for your time.
Crist J. Clark                           cjclark at

More information about the samba mailing list