Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using the cp command, one can move files and folders on linux.

I want to make a new user and move the contents of the skeleton map to their home directory.

I use this command:

cp -r /etc/skel/ /home/testuser/

However, this only creates a skel folder in testuser. The idea is that the contents of the /etc/skel folder be copied to /home/testuser, and not that a map be made in /home/testuser with those contents.

I've checked the man page: Link, but nothing on there really seemed like the solution to me.

Is there a way to do this, or do files really need to be moved manually, 1 by 1?

share|improve this question
up vote 2 down vote accepted

When creating new users on the system manually from the command-line using the useradd command, the -m switch can be used to automatically create a home directory as well as copy the contents of the skeleton directory into it.

In your case, however, the following will be sufficient:

cp -R /etc/skel/* /home/testuser/
share|improve this answer
Sadly, this did not copy the contents. Instead, there is now an empty folder /home/testuser/testuser – KdgDev Jun 17 '10 at 17:38
Even worse, every folder I now create with useradd has the empty "testuser" folder in it. Even after a restart, it still happens. – KdgDev Jun 17 '10 at 17:45
Even after deleting the user and cleaning the passwd and shadow file and restarting, it is still happening. – KdgDev Jun 17 '10 at 18:00
@WebDevHobo: It sounds like you may have copied testuser into skel by reversing the arguments to cp or somehow overwritten the contents of skel or created a symlink in it. What does ls -la /etc/skel give you? – Dennis Williamson Jun 17 '10 at 18:27
Yes, the empty folder was indeed now located in skel for some reason. I don't remember doing it... – KdgDev Jun 17 '10 at 20:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.