LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 02: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, 03:19 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
sure, just wrap that command with your own script.
 
Old 08-07-2009, 07: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-07-2009, 11:55 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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, 11:30 AM   #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



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 06:48 PM
Samba --> nobody run "add user script = /usr/sbin/useradd ....." ??!! Unconfigured Fedora 1 02-23-2006 04:54 AM
Samba --> nobody run "add user script = /usr/sbin/useradd %u ....." ???? Unconfigured Linux - Software 1 02-21-2006 09:01 AM
How to run useradd from crontab? adrianphicks Linux - Enterprise 3 08-03-2004 12:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:52 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