Find the answer to your Linux question:
Results 1 to 2 of 2
Hi everyone. I have several shares (see smb.conf below). Each setup fairly similarly, and several groups. My end goals are: 1) to have the [public] share automatically map as the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    8

    Auto map network drive using SAMBA with batch file


    Hi everyone.

    I have several shares (see smb.conf below). Each setup fairly similarly, and several groups. My end goals are:

    1) to have the [public] share automatically map as the P: drive to members of the employees group
    2) to have the [tech] share automatically map as the t: drive to members of the tech group
    3) to have the [sales] share automatically map as the s: drive to members of the sales group
    4) to have the [customerSupport] share automatically map as the r: drive to members of the support group
    5) to have the users home directory automatically map as the u: drive to all members of the domain.

    How it stands now is, everyone's home directories auto map correctly to the U: drive...as specified in my smb.conf file. Can someone please help me understand how to get the above listed drives to auto map to users when they first log in? I have created the batch file in vi and have converted it using unix2dos.

    Code:

    Hi everyone.

    I have several shares (see smb.conf below). Each setup fairly similarly, and several groups. My end goals are:

    1) to have the [public] share automatically map as the P: drive to members of the employees group
    2) to have the [tech] share automatically map as the t: drive to members of the tech group
    3) to have the [sales] share automatically map as the s: drive to members of the sales group
    4) to have the [customerSupport] share automatically map as the r: drive to members of the support group
    5) to have the users home directory automatically map as the u: drive to all members of the domain.

    How it stands now is, everyone's home directories auto map correctly to the U: drive...as specified in my smb.conf file. Can someone please help me understand how to get the above listed drives to auto map to users when they first log in? This is easily done on a Windows AD domain controller, but I am fairly new to a Samba PDC. I'm not sure if this is relevant, but this samba server is also an LDAP server. I have ldapsmb tools installed that allow easier management between the 2 types of accounts (LDAP and Samba).

    Code:

    Code:
    [global]
       #domain specific
    	domain master = Yes
    	domain logons = Yes
    	encrypt passwords = True
    	netbios name = Samba PDC
    	local master = Yes
    	log file = /var/log/samba/%m
    	log level = 1
    	os level = 65
    	preferred master = Yes
    	security = user
    	server string = LDAP-SMB Server
    	syslog = 0
    	wins support = Yes
    	workgroup = nmm.local
    
       #Security
    	lanman auth = No
    	lm announce = No
    	min protocol = NT1	
    
       #LDAP specific
    	ldap admin dn = cn=admin,dc=nmm,dc=local
    	ldap group suffix = ou=group
    	ldap idmap suffix = ou=Idmap
    	ldap machine suffix = ou=Machines
    	ldap passwd sync = Yes
    	ldap suffix = dc=nmm,dc=local
    	ldap user suffix = ou=people
    	idmap backend = ldap:ldap://127.0.0.1
    	passdb backend = ldapsam:ldap://127.0.0.1
    
       #Machines, Users, Groups
    	add machine script = /usr/sbin/ldapsmb  -a --homedir /var/lib/nobody --shell /bin/false -wks %m$
    
       #Roaming Profiles
    	#logon path = \\%L\Profiles\%U              set it to emtpy (below) to use local profiles
    	logon drive = U:
    	logon home = \\%L\%U
    	dont descend = /proc,/dev,/etc,/lib,/lost+found,/initrd
    	#wins server = 
    
    [netlogon]
    	comment = Network Logon Service
    	path = /var/lib/samba/netlogon
    	
    [homes]
    	comment = Home Direcories
    	valid users = %S
    	#, %D%w%S i took this out of valid users, for testing
    	browseable = No
    	read only = No
    	inherit acls = Yes
    
    [profiles]
    	comment = Network Profile Service
    	path = %H
    	read only = no
    	store dos attributes = Yes
    	create mask = 0600
    	directory mask = 0700
    	browseable = no
    
    [public]
    	comment = Public drive NOTHING IS SACRED!
    	inherit acls = Yes
    	path = /mnt/public
    	read only = No
    	writeable = Yes
    	create mode = 0660
    	directory mode = 0770
    	valid users = (a)employees
    
    [tech]
    	comment = Tech department only
    	inherit acls = Yes
    	path = /mnt/tech
    	read only = No
    	writeable = Yes
    	create mode = 0660
    	directory mode = 0770
    	valid users = (a)tech
    
    [sales]
    	comment = Sales department only
    	inherit acls = Yes
    	path = /mnt/sales
    	read only = No
    	writeable = Yes
    	directory mode = 0770
    	create mode = 0660
    	valid users = (a)sales
    
    [customersupport]
    	comment = Customer Support department only
    	inherit acls = Yes
    	path = /mnt/customerSupport
    	read only = No
    	writeable = Yes
    	directory mode = 0770
    	create mode = 0660
    	valid users = (a)support
    here is the script, which is placed in /var/lib/samba/netlogon

    Code:
    # Here we map network drives to shares on the Samba
    # server
    echo Mapping Network Drives to Samba Server...
    net use p: \\10.45.106.22\public

  2. #2
    Just Joined!
    Join Date
    Oct 2010
    Posts
    8
    i must have copied an older version of the smb.conf above. I do have this in my [global] section:

    logon script = login.bat
    Last edited by unassassinable; 10-13-2010 at 01:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •