LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-01-2011, 01:23 PM   #1
greenpoise
Member
 
Registered: Feb 2010
Posts: 37

Rep: Reputation: 2
Samba Netlogon script - More than one share


Hi there. I have samba primary domain controller up and running. It automatically creates a network shared drive (H on every windows computer according to each user. All that is good. I also have a public share called All Users configured in samba, how would I go for adding another logon script for it so windows users will get the mapped drive without having to manually configure it on each computer????


Thanks
Below my smb.conf

Quote:
[global]
workgroup = TTPDC
netbios name = ttsvr
server string = Samba Domain Controller


passdb backend = tdbsam
security = user
username map = /etc/samba/smbusers
name resolve order = wins bcast hosts
domain logons = yes
preferred master = yes
wins support = yes


# Default logon
logon drive = H:
logon script = scripts/logon.bat
logon path = \\ttsvr\profile\%U


# Useradd scripts
add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
delete user script = /usr/sbin/userdel -r %u
add group script = /usr/sbin/groupadd %g
delete group script = /usr/sbin/groupdel %g
add user to group script = /usr/sbin/usermod -G %g %u
add machine script = /usr/sbin/useradd -s /bin/false/ -d /var/lib/nobody %u
idmap uid = 15000-20000
idmap gid = 15000-20000
template shell = /bin/bash


# sync smb passwords with linux passwords
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd chat debug = yes
unix password sync = yes

# set the loglevel
log level = 3

[public]
browseable = yes
public = yes


[homes]
comment = Home
valid users = %S
read only = no
browsable = no


[netlogon]
comment = Network Logon Service
path = /home/samba/netlogon
admin users = administrator
valid users = %U
read only = no
guest ok = yes
writable = no
share modes = no


[profile]
comment = User profiles
path = /home/samba/profiles
valid users = %U
create mode = 0600
directory mode = 0700
writable = yes
browsable = no
guest ok = no


[allusers]
comment = All Users
path = /home/shares/allusers
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
 
Old 04-03-2011, 04:07 AM   #2
brak44
Member
 
Registered: Aug 2010
Location: Brisbane Australia
Distribution: Centos, Fedora
Posts: 87

Rep: Reputation: 24
Instead of path = /home/shares/allusers
make a directory /shares/allusers and chmod -R 777 /shares as root
Change the path to /shares/allusers
read only = No
browsable = no

Get rid of [public] - it does not reference any directory
[public]
browseable = yes
public = yes



Restart samba and you should see allusers appear in your Windows machines
 
Old 04-03-2011, 04:24 AM   #3
brak44
Member
 
Registered: Aug 2010
Location: Brisbane Australia
Distribution: Centos, Fedora
Posts: 87

Rep: Reputation: 24
In the /home/samba/netlogon directory create a user.bat file where user is the name of an individual user name.
Add your share definitions
net time \\ttsvr /set /yes
net use L: \\ttsvr\allusers

do a unix2dos on this file so Windows can read it properly

To list shares that are available from the configured Samba server, execute the following command:

$ smbclient -L yourhostname

You should see a list of shares available on your server. If you do not, then something is incorrectly configured.
 
Old 04-04-2011, 10:27 AM   #4
greenpoise
Member
 
Registered: Feb 2010
Posts: 37

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by brak44 View Post
Instead of path = /home/shares/allusers
make a directory /shares/allusers and chmod -R 777 /shares as root
Change the path to /shares/allusers
read only = No
browsable = no

Get rid of [public] - it does not reference any directory
[public]
browseable = yes
public = yes



Restart samba and you should see allusers appear in your Windows machines

Do I need to add/change/edit #Default Logon at all???

Thank you!!!
 
Old 04-05-2011, 04:59 AM   #5
brak44
Member
 
Registered: Aug 2010
Location: Brisbane Australia
Distribution: Centos, Fedora
Posts: 87

Rep: Reputation: 24
Wink Default logon

You should get samba swat running. There is a wealth of information regarding how to do all this there.
e.g.

logon script (G)

This parameter specifies the batch file (.bat) or NT command file (.cmd) to be downloaded and run on a machine when a user successfully logs in. The file must contain the DOS style CR/LF line endings. Using a DOS-style editor to create the file is recommended.

The script must be a relative path to the [netlogon] service. If the [netlogon] service specifies a path of /usr/local/samba/netlogon, and logon script = STARTUP.BAT, then the file that will be downloaded is:

/usr/local/samba/netlogon/STARTUP.BAT

The contents of the batch file are entirely your choice. A suggested command would be to add NET TIME \\SERVER /SET /YES, to force every machine to synchronize clocks with the same time server. Another use would be to add NET USE U: \\SERVER\UTILS for commonly used utilities, or

NET USE Q: \\SERVER\ISO9001_QA

for example.

Note that it is particularly important not to allow write access to the [netlogon] share, or to grant users write permission on the batch files in a secure environment, as this would allow the batch files to be arbitrarily modified and security to be breached.

This option takes the standard substitutions, allowing you to have separate logon scripts for each user or machine.

This option is only useful if Samba is set up as a logon server.

Default: logon script =

Example: logon script = scripts\%U.bat
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with netlogon script in Samba avinash.rao Ubuntu 8 09-03-2009 08:29 AM
Samba: Adding Homes to PDC causes netlogon.bat script to not execute Neruocomp Linux - Server 4 06-08-2009 04:02 AM
samba problem; netlogon vergeer Linux - Newbie 4 10-06-2008 03:26 PM
Utilizing Samba with LDAP to run a Netlogon Script SGlassman Programming 4 06-15-2007 03:13 PM
My samba netlogon script doesn't execute colpaarm Linux - Software 1 07-25-2003 09:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration