if you have files in say /home/olduser
where the prior install had them in /home/newuser
; and you're happy with how your new [near empty] "user1" is working; you can copy the files into your new directory, eg.
sudo cp -prn /home/olduser/* /home/newuser
which will copy (-p=preserve.filespecs
, -r=recursive
, -n=new.files.only
) the files to the new user directory. the -p
will mean they remain owned by "user" or your old userid. I do this probably so I can inspect what it did before I do the next step
chown -R newuser /home/newuser/
which will now change old owner.attributes to your new "newuser" id. the -R
tells it to recursively do subdirectories
benefits of this is it'll copy, not move, so if something stuffs up, you can do it again (even if its creating a new user.id & using that instead of re-installing whole OS). it does require you to have enough free space to have two copies of your data, ie. /home/olduser
data will be copied to /home/newuser
. when completed and you're happy you can always delete data in /home/olduser
other alternatives|hacks could be to edit /etc/passwd
& change your $HOME
directory to be the directory you want; but there is more that can go wrong with this if you don't understand what you're doing. this 'hack' is more what you want, hence my clues, but I'm not sure of your level of understanding and whether or not more detail is appropriate. this 'hack' is by far quickest and simplest, but more can go wrong [ie. you may be tempted to install a third time, when again a simple edit can fix - if you know how]
more alternatives exist; some I'd like to know before hand is /home
is on a different fs|partition to the /
partition, so I'll skip (edits to /etc/fstab
etc)
sudo -prn cp
, you meansudo cp -prn
. Andchown -R newuser
should besudo chown -R newuser:
orsudo chown -R newuser:newuser
. – heynnema Jun 19 '17 at 15:07cp
to avoid bad error) – guiverc Jun 19 '17 at 23:36