Username in environment variable
Kevin Colby
kevinc at grainsystems.com
Fri Jun 9 15:28:39 GMT 2000
Just for the record, it is also possible to setup a batch file
that does the dynamic-logon-script thing as well. You have
to get a better 'SET' command such as ASET, or do some coding
yourself, but it can be done.
- Kevin Colby
kevinc at grainsystems.com
"Charles N. Owens" wrote:
>
> Gerry George wrote:
>
> > I seem to recall reading something about this, but can't find it from the
> > archives.
> >
> > How does one get the username? I wish to set the environment variable
> > USERNAME to use it for various applications and scripts. This would be set
> > in the login script. The standard Samba variables do not work as the
> > Windows client, where the login script executes, is unaware of any Samba
> > variables.
>
> The technique that I use is to set up the netlogon share such that it calls a
> perl script as the connection is being setup (specified via the preexec
> directive). This script dynamically generates a client-specific logon script
> which includes DOS commands to
>
> * set environment variables
> * set up drive and printer mappings (via the net use command)
> * call other scripts that perform standard functions
>
> Per-client configuration information is maintained in a NIS map that the script
> queries to determine how to build the script.
>
> We've been using this technique for about four years with good success. At
> some point I plan to move the configuration info into an LDAP directory and do
> other enhancements (e.g. NT/W2K support). I'd be happy to share the script as
> is (kinda crufty) if there is interest.
>
> Here's the pertinent parts of smb.conf:
> [globals]
> ...
> domain logons = yes
> logon script = scripts\dynamic\%d.bat
> ...
>
> [netlogon]
> path = /user/canaan/smb/netlogon
> browseable = no
> writeable = no
> force user = nobody
> preexec = /usr/local/tenet/sbin/mklogscript %d %U %M %m %a
> postexec = /bin/rm /user/canaan/smb/netlogon/scripts/dynamic/%d.bat
>
> --
> -------------------------------------------------------------------------
> Charles N. Owens Email: owensc at enc.edu
> http://www.enc.edu/~owensc
> Network & Systems Administrator
> Information Technology Services "Outside of a dog, a book is a man's
> Eastern Nazarene College best friend. Inside of a dog it's
> too dark to read." - Groucho Marx
> -------------------------------------------------------------------------
More information about the samba-ntdom
mailing list