Auto map network drive using SAMBA with batch file | Unix Linux Forums | Linux

  Go Back    


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

Auto map network drive using SAMBA with batch file

Linux


Tags
network drive, samba, smb.conf, suse, windows share

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-13-2010
unassassinable unassassinable is offline
Registered User
 
Join Date: Oct 2010
Last Activity: 5 November 2010, 6:14 PM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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 05:38 PM.. Reason: mistype
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Auto-detect drive identifier? msf5042 Shell Programming and Scripting 1 11-10-2009 06:06 PM
connecting to network, auto-entering info Chain Breaker Shell Programming and Scripting 1 08-27-2009 02:20 AM
SF V210 CDROM drive auto eject! HishamN Solaris 8 10-27-2008 02:17 AM
Shell script for accessing a file in the network drive and invoking oracle sql loader sayydevara Shell Programming and Scripting 0 03-20-2007 03:54 PM



All times are GMT -4. The time now is 06:06 PM.