LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   useradd - run script? (https://www.linuxquestions.org/questions/linux-general-1/useradd-run-script-745876/)

lukesc 08-07-2009 02:17 PM

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?

acid_kewpie 08-07-2009 03:19 PM

sure, just wrap that command with your own script.

lukesc 08-07-2009 07:18 PM

Well... that's what I ended up doing. I was hoping there was another way to do it. Oh well.

acid_kewpie 08-07-2009 11:55 PM

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.

lukesc 08-11-2009 11:30 AM

Quote:

Originally Posted by acid_kewpie (Post 3635390)
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.


All times are GMT -5. The time now is 08:35 PM.