LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-07-2009, 03:17 PM   #1
lukesc
Member
 
Registered: Oct 2007
Posts: 31

Rep: Reputation: 16
useradd - run script?


I know that there is a file called /etc/default/useradd and you can specify certain defaults. For example you can put files into /etc/skel and it would copy those files into /home/user/ when "user" is created.

Is there any way to run a particular script when a user is created? Like append a virtual host configuration to apache when a user is created?
 
Old 08-07-2009, 04:19 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967
sure, just wrap that command with your own script.
 
Old 08-07-2009, 08:18 PM   #3
lukesc
Member
 
Registered: Oct 2007
Posts: 31

Original Poster
Rep: Reputation: 16
Well... that's what I ended up doing. I was hoping there was another way to do it. Oh well.
 
Old 08-08-2009, 12:55 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967
why would you want / need another way?? There are other ways, like watching for changes in the passwd file or periodically scanning all user directories and ensuring they are all correctly configured i guess, none as good was just wrapping useradd in the first place.
 
Old 08-11-2009, 12:30 PM   #5
lukesc
Member
 
Registered: Oct 2007
Posts: 31

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by acid_kewpie View Post
why would you want / need another way?? There are other ways, like watching for changes in the passwd file or periodically scanning all user directories and ensuring they are all correctly configured i guess, none as good was just wrapping useradd in the first place.
Wrapping it is the best way. I just thought there might be some kind of parameter to make useradd run a script after an account was created.
 
  


Reply

Tags
apache, script, shell, useradd


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
useradd in a script john83reuben Linux - Newbie 8 05-28-2008 07:48 PM
Samba --> nobody run "add user script = /usr/sbin/useradd ....." ??!! Unconfigured Fedora 1 02-23-2006 05:54 AM
Samba --> nobody run "add user script = /usr/sbin/useradd %u ....." ???? Unconfigured Linux - Software 1 02-21-2006 10:01 AM
How to run useradd from crontab? adrianphicks Linux - Enterprise 3 08-03-2004 01:00 AM


All times are GMT -5. The time now is 07:48 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration