Auto map network drive using SAMBA with batch file


 
Thread Tools Search this Thread
Operating Systems Linux Auto map network drive using SAMBA with batch file
# 1  
Old 10-13-2010
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? 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
    local master = Yes
    time server = 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
    logon script = login.bat

   #Security
    lanman auth = No
    lm announce = No
    min protocol = NT1
#    hosts allow = 10.245.106.0/24 10.45.106.0/25 127.0.0.1
    #block everyone not in the above subnet
#    hosts deny = ALL
    

   #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
    guest ok = no
    read only = yes
    browsable = no
    #valid users = root @employees
    
[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 = @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 = @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 = @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 = @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



---------- Post updated 10-13-10 at 12:53 PM ---------- Previous update was 10-12-10 at 03:07 PM ----------

anyone?

Last edited by unassassinable; 10-12-2010 at 06:38 PM.. Reason: mistype
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Map network drive

Hi I need to restore an oracle backup from production in a test x86 Solaris 10 box . But the space is limited and does not have enough to hold both the backup as well as database . Hence , I am thinking of mapping a network drive from another x86 Solaris 10. Pls let me know if it is... (3 Replies)
Discussion started by: Rossdba
3 Replies

2. UNIX for Advanced & Expert Users

How to get file from share drive when filename with spaces using samba client?

Hi Team, I am not able to get file name from shared drive when filename have spaces in it. following command i am using. filename="REP00105 - ABC XYZ (SCM)_ 1.TXT" /hfx/opt/samba220/bin/smbclient \\\\${nt_host}\\${nt_share} ${NT_PASSWORD} -U${NT_USERNAME} -c "cd ${nt_directory}; prompt;... (1 Reply)
Discussion started by: Makarand Dodmis
1 Replies

3. Red Hat

How to Map AD groups to Samba share?

I am setup a samba share server which is authenticating from Active Directory. I am able to access the share with AD user but not able to access when group defined in "valid users" parameters. below are the steps i performed. In smb.conf workgroup = QASLABS password server =... (3 Replies)
Discussion started by: sunnysthakur
3 Replies

4. Windows & DOS: Issues & Discussions

How to map a path to a drive in windows

Hi all, Can anybody explain me about mapping a path to a drive with example? Thanks (3 Replies)
Discussion started by: Bobby16
3 Replies

5. Windows & DOS: Issues & Discussions

Script to automatically map samba shares as network drive

Hopefully someone will be kind enough to help me. I have a fileserver acting as a PDC and providing samba shares to a small network. Authentication to the PDC is via LDAP (setup using ebox) The users all have real local accounts on the server. I would like a windows logon script that will:... (4 Replies)
Discussion started by: barrydocks
4 Replies

6. UNIX for Dummies Questions & Answers

samba user.map file

I am using Samba 3.0.33. The user.map file is not referred anywhere is Smb.conf. Infact, I couldn't see the user.map file any where in samba. But everything seems to be working. Is there an alternative way to refer to the users list. (2 Replies)
Discussion started by: sagar_evc
2 Replies

7. UNIX for Dummies Questions & Answers

Map Drive From Windows To Apache Shared Drive?

Anyone know how I can map a windows drive to an apache shared drive? In my httpd.conf file, I have: Alias /merc_rpts/ "/u/merc_rpts/" <Directory "/u/merc_rpts"> Options Indexes </Directory> I'm able to bring up a browser and see the contents of this folder. In... (0 Replies)
Discussion started by: gseyforth
0 Replies

8. Solaris

How to map drive from Sun Solaris to Windows! Help me

I have two servers, one running on Windows server 2003 and one running Sun Solaris 10. Can you help me how to map drive from Sun Solaris to Windows server 2003. Thanks (1 Reply)
Discussion started by: tanhq
1 Replies

9. UNIX for Dummies Questions & Answers

Map Drive from UNIX Server to Windows Clients

hi all ;; I have a Tru64 UNIX machine , first i want my employees ( windows clients) to see specific directory on unix , and how can i put a unix command in a visual basic code to copy the contents of that directory to drive c in the client side who request that by clicking a push button. ... (3 Replies)
Discussion started by: kafaween
3 Replies

10. Solaris

Map Network Drive...

Hallo...Hi, Anyone can help me???How can I map network drive from Windows if i'm using the Sun Solaris 8 server? :confused: (1 Reply)
Discussion started by: mrboomber
1 Replies
Login or Register to Ask a Question