LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   how are home directories created (https://www.linuxquestions.org/questions/debian-26/how-are-home-directories-created-199915/)

waynevnc 07-01-2004 10:07 AM

how are home directories created
 
Some explanation please.

I was under the impression, which must be wrong, that a users home directory was created when the useradd command was used to create a user account. I have created several users and only the first one I created has a home directory. What the deal?

Thanks for any info on this,
Wayne

b0uncer 07-01-2004 11:19 AM

I'll try to explain this on the basis of the console command useradd; the manpage of useradd says:

useradd - Create a new user or update default new user information

now there are several options you can pass to this command. if you use graphical tool, then you must specify the options in the gui tool, so that it then creates the user on the base of those...anyway, I'll do this console-based. here's a cut from useradd's manpage:

"When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line and the default values from the system. The new user account will be entered into the system files as needed, the home directory will be created, and initial files copied, depending on the command line options."

when you add a user, the shortest way is of course this:

useradd username

which whould create a user called username, and that's it. no home dir or anything _unless_ there are some default values set that tell useradd to do so...but basically you won't get a home directory, for example. if you want that, you would use the -d option:

useradd -d /home/homedir username

which would create a new user called username and set /home/homedir to his/her home directory...other options include -c (comment), -e (expire date), -g (initial group), -G (groups), -p (password), -s (shell), -u (uid) etc. etc. etc.

so the things you get when creating a user depend on what command line parameters you give to the useradd program. GUI tools work in the same way, but with the difference that you choose the options in the graphical window and then the GUI tool does these command line parameter thingies for you.

hopefully this explained a bit...you get what you ask, and if you don't ask for something (and nobody has set defaults for that action), you don't get that something :)

darthtux 07-01-2004 02:47 PM

The Debian 3.0 manpage also says
Code:

The adduser program is generally more friendly to use than
this one and also uses Debian policy  conformant  UID  and
GID values, creating a home directory a with skeletal con_
figuration, running a custom script, and  other  features.
It is more prefered than using this program.

adduser is easier to use.

waynevnc 07-02-2004 08:39 AM

Thanks guys, thats what I needed to know.


All times are GMT -5. The time now is 06:04 PM.