Mailing List Archive

What does /etc/skel do?
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-user@gentoo.org mailing list
Re: What does /etc/skel do? [ In reply to ]
On 10/04/2004 12:46 PM, Robert S wrote:
> ... 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-user@gentoo.org mailing list
Re: What does /etc/skel do? [ In reply to ]
Jochen Schalanda wrote:
> On 10/04/2004 12:46 PM, Robert S wrote:
>
>> ... 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
Re: What does /etc/skel do? [ In reply to ]
Robert S wrote:

> ... 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-user@gentoo.org mailing list
Re: What does /etc/skel do? [ In reply to ]
On 10/04/2004 01:23 PM, Felix Tiede wrote:
> Jochen Schalanda wrote:
>
>> On 10/04/2004 12:46 PM, Robert S wrote:
>>
>>> ... 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-user@gentoo.org mailing list
Re: What does /etc/skel do? [ In reply to ]
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-user@gentoo.org mailing list
Re: What does /etc/skel do? [ In reply to ]
> 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-user@gentoo.org mailing list
Re: Re: What does /etc/skel do? [ In reply to ]
adduser is symlinked to useradd, so there's no diff at all.

Robert S schrieb:
>>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-user@gentoo.org mailing list
>
>
>

--
Mit freundlichen Grüßen

Heinz Sporn

SPORN it-freelancing

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

--
gentoo-user@gentoo.org mailing list
Re: Re: What does /etc/skel do? [ In reply to ]
According to the useradd man pages using /etc/skel works only in
conjunction with the -m and -k parameters.

Heinz Sporn schrieb:
> adduser is symlinked to useradd, so there's no diff at all.
>
> Robert S schrieb:
>
>>> 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-user@gentoo.org mailing list
>>
>>
>>
>

--
Mit freundlichen Grüßen

Heinz Sporn

SPORN it-freelancing

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

--
gentoo-user@gentoo.org mailing list
Re: Re: What does /etc/skel do? [ In reply to ]
> 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-user@gentoo.org mailing list