Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-24-2005, 09:03 AM   #1
Registered: Oct 2005
Posts: 31

Rep: Reputation: 15
[Samba] Execute commands depending on user

I'm running Samba as Primary Domain Controller. I created a group called
"machines" containing the domain users and another one called "admin"
containing some root accounts. This is my share section of smb.conf:

### Shares
# public share:
path = /home/public
comment = full access
writable = yes
browsable = yes
path = /home/profiles
comment = Personal shares
writeable = yes
browseable = yes
create mask = 0600
directory mask = 0700
# execute a command everytime a user logs in
root preexec = /usr/bin/touch /home/_userIN
# execute a command everytime a user logs out
root postexec = /usr/bin/touch /home/_userOUT

I would like that when a user of the group admin logs into the domain a
command is executed on the server. I tried to add the line below but the
command is executed only if the user access the share and not when he logs
into the domain:

path = /dev/null
valid users = @admin
root preexec = /usr/bin/echo Hello!
Old 10-25-2005, 01:01 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
The easiest way is probably to have a login.bat script that runs on the client to map the share, which in turn runs the exec command.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
cannot execute some commands as an plain user! minike Slackware 5 09-03-2004 07:34 PM
BASH scripting; su to user, commands after dont execute Zero-0-Effect Programming 4 06-07-2004 12:09 PM
how can execute some commands when a user logs out rddreamz Programming 2 05-25-2004 04:00 PM
Can't execute commands when logged in as ordinary user.... murphaph Linux - General 3 04-05-2004 06:23 PM
KMail: execute command depending on message body linuxfond Linux - Newbie 0 01-31-2004 08:30 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:47 AM.

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