I have a user profile all setup with all settings the way I want them. I want to copy the entire configured profile to a new user account.

This is what I'm doing (user is already added to system):

  1. Log out, switch to terminal, service gdm stop.
  2. mkdir /home/newuser
  3. cp -a /home/olduser/* /home/newuser/
  4. chown newuser:newuser /home/newuser -R
  5. service gdm start

Then I log in as newuser. When I log in, the desktop looks like a brand new user profile and not the customized profile that I copied.

I want everything in the new profile. The theme, where the docks are located and configured, desktop icons, Firefox favorites, etc.

Any idea why this isn't working? I am using Ubuntu 10.04


You will need to do more then that.

sudo mv /home/new_user /home/new_user.bak
sudo cp -R /home/old_user /home/new_user
sudo chown -R new_user:new_user /home/new_user

Log into the new user account. If all is working, delete the backup

sudo rm -rf /home/new_user.bak

OK, I figured it out. Apparently cp /* skips dot files.

You have to explicitly copy dot files with:

cp -a /home/olduser/.* /home/newuser/

And to copy everything do both:

cp -a /home/olduser/* /home/newuser/
cp -a /home/olduser/.* /home/newuser/
  • 3
    The bash shell has an option dotglob (you can set it with shopt—see the bash manual for more info) which, if set, makes * match files starting with a dot too. – JanC Jan 31 '12 at 19:17
  • Oh, and you might want to "accept" your own solution so that this question is marked as answered... – JanC Jan 31 '12 at 19:19
  • +1 for the dotglob comment. There's a waiting period on accepting answers too soon... – Nick Feb 1 '12 at 17:41

I wanted to clone my current profile to a new user. My home directory was large, almost 100 GB. bodhi.zazen's answer worked for me, but it took half a day of false starts before I got it right. Here's an expanded annotated version of his answer (I'm on Ubuntu 14.04):

Create new user

I just used the desktop UI: System Settings > User Accounts > Unlock > + New User

Backup new user home directory

Now on to the command line:

sudo mv /home/new_user /home/new_user.bak

Copy profile to new user home directory

If you have a large profile, I'd recommend using rsync and excluding some directories. Here's an example of what I ran:

time sudo rsync -av --progress \
  --exclude='VirtualBox VMs' \
  --exclude='.cache/deja-dup' \
  --exclude='.local/share/Trash' \
  --exclude='nltk_data' \
  --exclude='Downloads' \
  /home/klenwell/ /home/new_user

A couple notes:

  • --exclude directories are subdirectories of the source dir /home/klenwell/.
  • Note the end slash on /home/klenwell/. Miss it and you'll end up with /home/new_user/klenwell.

I'd recommend a couple quick test runs before walking off. Use --dry-run and even run it once or twice cutting it short to double check everything is going where you expect. With exclusions, I cut my home directory in half but it still took an hour to copy.

Make new user owner of home directory

time sudo chown -R new_user:new_user /home/new_user

Took 5 minutes to complete in my case.

Log in with your new user

If you try to log in with your new user and Ubuntu just keeps kicking you back to the login prompt, you probably forgot the previous step.

If you successfully log in, now you can wipe out your old backup:

sudo rm -rf /home/new_user.bak


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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