[Samba] Login Script - Please clarify

Adam Smith adam.smith at sageautomation.com
Thu May 8 03:58:57 GMT 2003

On Wed, May 07, 2003 at 02:52:09PM +0200, Marian Mlcoch, Ing said:
> Hi San
> your problem is that you use %U in script invalid
> wrong command   net use s: \\public\users\%U
> ok is    net use s: \\public\%U
> but net use x: \\computername\sharename is only accpeted.
> Yuo write \\computername\sharename\dirname but this is bad syntax for net
> command.

No it isn't.  For a Windows 2000 or above system, the syntax is correct.
Unfortunately the usage of the variable is incorrect.

%U may be how the username is represented in Samba, but when the script is
executed on a Windows 2000 client machine, it won't know what to do with
it.  You need to make sure your net use line reads as follows:


Windows will interpret the %USERNAME% variable as the user's login name and
create a drive mapping for \\public\users\%username% assuming it exists.

For a list of other variables Windows uses, type 'SET' from a command
Window or search on Google for "Windows Environment Variables."

> If in script you need map home directory of user you can write net use s:
> \\public\homes in netlogon.bat

This is ugly because it reveals everybody elses home directory.  It does
depend on how you want to set up your own network, of course.

> ----- Original Message -----
> From: "Devanesan" <sde at baba9.com>
> To: <samba at lists.samba.org>
> Sent: Wednesday, May 07, 2003 1:16 PM
> Subject: [Samba] Login Script - Please clarify
> > I have placed this line "net use s: \\public\users\%U" in the file
> > "netlogon.bat"
> > and "logon script = netlogon.bat" in the file "smb.conf".
> >
> > so that I can avoid creating separate ".bat" file for individual users
> > while creating
> > private shares. This is not working for me. Can you please tell me
> > where I am going wrong?.
> >
> > At the same time if I create separate .bat file for each users and provide
> > the line
> > "logon script = %U.bat" in the file "smb.conf", then it is working fine.
> > But this involves
> > continuos maintenance as I have to keep creating .bat files as new users
> > arrive.
> >
> > Warm Regards
> > Devanesan

Adam Smith
Information Technology Officer
SAGE Automation Ltd.

adam.smith at sageautomation.com

"Just a friendly wave each morning.."
    - Neighbours

More information about the samba mailing list