LinuxQuestions.org
Review your favorite Linux distribution.
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 10-07-2003, 09:55 PM   #1
vipa5000
LQ Newbie
 
Registered: Oct 2003
Posts: 4

Rep: Reputation: 0
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
 
Old 10-07-2003, 10:24 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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

Last edited by DavidPhillips; 10-07-2003 at 10:27 PM.
 
Old 10-07-2003, 10:28 PM   #3
vipa5000
LQ Newbie
 
Registered: Oct 2003
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by DavidPhillips
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
thats what i was thinking but i was wondering if theirs any file u can put those in instead
 
Old 10-07-2003, 10:35 PM   #4
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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.
 
Old 10-07-2003, 10:40 PM   #5
vipa5000
LQ Newbie
 
Registered: Oct 2003
Posts: 4

Original Poster
Rep: Reputation: 0
thank you
 
Old 10-07-2003, 10:42 PM   #6
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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

Last edited by DavidPhillips; 10-07-2003 at 10:47 PM.
 
Old 10-07-2003, 10:44 PM   #7
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
just add the folders to /etc/skel and they will be created when a newuser is added,

I should have thought of that before
 
Old 10-07-2003, 10:56 PM   #8
vipa5000
LQ Newbie
 
Registered: Oct 2003
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by DavidPhillips
just add the folders to /etc/skel and they will be created when a newuser is added,

I should have thought of that before
yah thats exactly what i was looking for thanks
 
Old 10-07-2003, 11:01 PM   #9
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
sometimes the little simple things get missed.

LOL
 
  


Reply



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
adduser 64bitPlaya Slackware 2 08-13-2004 05:05 PM
adduser bally Linux - General 7 08-09-2004 01:28 PM
Adduser - xmdms Linux - Newbie 3 10-23-2003 03:54 PM
adduser help qages Linux - General 7 01-27-2003 06:16 PM
Adduser... Chijtska Linux - General 5 02-15-2002 07:53 AM

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

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