adduser apache
hey, what i want to do is when i use adduser username i want it to create a apache dir as well like /home/username/public_html, /home/username/public_html/cgi-bin and /home/username/perl is this possible at all im using mandrake
|
sure it's possible, I would make a script that you can run that will do it
#/bin/bash adduser $1 mkdir -p /home/$1/public_html/cgi_bin /home/$1/perl chown -R $1.$1 /home/$1/public_html /home/$1/perl run like this.. scriptname username |
Quote:
|
Not sure what you mean, if you want to just type adduser username and have it happen there is a way to do that, otherwise I would make a new file in /usr/sbin/
anyway here it is /sbin/adduser #/bin/bash /usr/sbin/adduser $1 mkdir -p /home/$1/public_html/cgi_bin /home/$1/perl chown -R $1.$1 /home/$1/public_html /home/$1/perl normally the path statement will have /sbin before /usr/sbin so by running adduser the script file in /sbin will run instead of /usr/sbin/adduser you will never know the difference. |
thank you
|
There is one thing, if you plan to use any args to adduser then you will need to provide for that
it can be done like this, someone that knows bash better than I could improve this /usr/sbin/adduser $2 $3 $4 $5 $6 $7 $1 then you could run like this adduser username -c "Some comment" -p passwd or whatever, you just need to have enough variables to do it Like I said this is a crude way to do it. One other idea would be to use /etc/skel which in this case may be the best solution |
just add the folders to /etc/skel and they will be created when a newuser is added,
I should have thought of that before |
Quote:
|
sometimes the little simple things get missed.
LOL |
All times are GMT -5. The time now is 01:56 AM. |