Discussion:
[gentoo-user] What does /etc/skel do?
(too old to reply)
Robert S
2004-10-04 10:50:10 UTC
Permalink
I recently tried to add a new user to my system:

basement root # ls -la /etc/skel
total 20
drwxr-xr-x 3 root root 4096 Oct 4 20:32 .
drwxr-xr-x 73 root root 4096 Oct 4 20:44 ..
-rw-r--r-- 1 root root 232 Aug 1 13:33 .bash_profile
-rw-r--r-- 1 root root 812 Aug 1 13:33 .bashrc
drwx------ 7 root root 4096 Oct 4 20:30 .maildir
basement root # userdel test
userdel: user test does not exist
basement root # ls -la /etc/skel
total 20
drwxr-xr-x 3 root root 4096 Oct 4 20:32 .
drwxr-xr-x 73 root root 4096 Oct 4 20:44 ..
-rw-r--r-- 1 root root 232 Aug 1 13:33 .bash_profile
-rw-r--r-- 1 root root 812 Aug 1 13:33 .bashrc
drwx------ 7 root root 4096 Oct 4 20:30 .maildir
basement root # useradd test
basement root # ls /home/test
ls: /home/test: No such file or directory
basement root # cat /etc/default/useradd
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

.. In other words, useradd is not creating the home directory. How do you
get it to create a home directory based on /etc/skel?





--
gentoo-***@gentoo.org mailing list
Jochen Schalanda
2004-10-04 11:00:09 UTC
Permalink
... In other words, useradd is not creating the home directory. How do you
get it to create a home directory based on /etc/skel?
Try reading the manpage of useradd. The home directory of your user will
only be created if you add the parameter '-m' to the useradd command. If
you combine '-m' and '-k', the home directory will be created *and* the
files from /etc/skel will be copied to it.

Jochen

--
gentoo-***@gentoo.org mailing list
Felix Tiede
2004-10-04 11:30:11 UTC
Permalink
Post by Jochen Schalanda
... In other words, useradd is not creating the home directory. How
do you get it to create a home directory based on /etc/skel?
Try reading the manpage of useradd. The home directory of your user will
only be created if you add the parameter '-m' to the useradd command. If
you combine '-m' and '-k', the home directory will be created *and* the
files from /etc/skel will be copied to it.
Not correct. '-k' enables you to specify a *different* directory from
skeleton_dir, which normally points to /etc/skel. If you want to use
/etc/skel, you have to use '-m' but to omit '-k'.

Greetings,
Felix
Jochen Schalanda
2004-10-04 11:40:11 UTC
Permalink
Post by Felix Tiede
Post by Jochen Schalanda
... In other words, useradd is not creating the home directory. How
do you get it to create a home directory based on /etc/skel?
Try reading the manpage of useradd. The home directory of your user
will only be created if you add the parameter '-m' to the useradd
command. If you combine '-m' and '-k', the home directory will be
created *and* the files from /etc/skel will be copied to it.
Not correct. '-k' enables you to specify a *different* directory from
skeleton_dir, which normally points to /etc/skel. If you want to use
/etc/skel, you have to use '-m' but to omit '-k'.
Greetings,
Felix
I'm getting old. Maybe I should not try citing from memory any more :/
You are right. '-k' overrides the directory from which the skeleton
files should be copied.

Jochen


--
gentoo-***@gentoo.org mailing list
Alexander Skwar
2004-10-04 11:40:09 UTC
Permalink
... In other words, useradd is not creating the home directory. How do you
get it to create a home directory based on /etc/skel?
By reading the manpage of useradd. There, you'll find the
-m switch. useradd doesn't create the home directory by default.

BTW: What does your question have to do with the subject of your post?

Alexander Skwar
--
QOTD:
The only easy way to tell a hamster from a gerbil is that the
gerbil has more dark meat.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--
gentoo-***@gentoo.org mailing list
Robert S
2004-10-05 08:50:05 UTC
Permalink
Post by Alexander Skwar
BTW: What does your question have to do with the subject of your post?
Thanks for the answers folks. I read the man page but only skimmed through
it.

The purpose of the subject was that /etc/skel didn't seem to do anything
when I used the adduser command.

BTW - why is there an "adduser" and "useradd" command? I think that they
are different in some distros.




--
gentoo-***@gentoo.org mailing list
Heinz Sporn
2004-10-05 09:30:14 UTC
Permalink
adduser is symlinked to useradd, so there's no diff at all.
Post by Robert S
Post by Alexander Skwar
BTW: What does your question have to do with the subject of your post?
Thanks for the answers folks. I read the man page but only skimmed through
it.
The purpose of the subject was that /etc/skel didn't seem to do anything
when I used the adduser command.
BTW - why is there an "adduser" and "useradd" command? I think that they
are different in some distros.
--
--
Mit freundlichen Grüßen

Heinz Sporn

SPORN it-freelancing

Mobile: ++43 (0)699 / 127 827 07
Email: ***@sporn-it.com
***@utanet.at
Snail: Steyrer Str. 20
A-4540 Bad Hall
Austria / Europe

--
gentoo-***@gentoo.org mailing list
Heinz Sporn
2004-10-05 09:30:17 UTC
Permalink
According to the useradd man pages using /etc/skel works only in
conjunction with the -m and -k parameters.
Post by Heinz Sporn
adduser is symlinked to useradd, so there's no diff at all.
Post by Robert S
Post by Alexander Skwar
BTW: What does your question have to do with the subject of your post?
Thanks for the answers folks. I read the man page but only skimmed
through it.
The purpose of the subject was that /etc/skel didn't seem to do
anything when I used the adduser command.
BTW - why is there an "adduser" and "useradd" command? I think that
they are different in some distros.
--
--
Mit freundlichen Grüßen

Heinz Sporn

SPORN it-freelancing

Mobile: ++43 (0)699 / 127 827 07
Email: ***@sporn-it.com
***@utanet.at
Snail: Steyrer Str. 20
A-4540 Bad Hall
Austria / Europe

--
gentoo-***@gentoo.org mailing list
Bob Sanders
2004-10-05 14:30:18 UTC
Permalink
Post by Heinz Sporn
According to the useradd man pages using /etc/skel works only in
conjunction with the -m and -k parameters.
Yes. If you do -

useradd {user} -m -G users,audio,cdrom,games -s /bin/bash

The user gets the contents of /etc/skel put into the newly created /home/{user}
directory and the permissions and ownership changed to the user.

For most cases, this is all that's needed. Sure lots of other things can be
added, but they can simply added later by editing /etc/passwd and /etc/group.

Bob

--
gentoo-***@gentoo.org mailing list

J. Patrick Lanigan
2004-10-04 21:10:06 UTC
Permalink
If you don't want to add all the switches, you could emerge superadduser
and use that. I haven't used it, but apparently it will prompt you for
all the relevent info.

HTH,
Patrick

--
gentoo-***@gentoo.org mailing list
Continue reading on narkive:
Loading...