Results 1 to 6 of 6

Thread: I have changed my username and all my files gone :(

  1. #1
    Join Date
    Mar 2013
    Beans
    2

    I have changed my username and all my files gone :(

    Hi,
    I am new at Ubuntu.
    I have changed my username with these codes respectively;

    usermod -d /home/newusername -m oldusername
    sed -i -e 's_oldusername_newusername_g' /etc/passwd
    sed -i -e 's_oldusername_newusername_g' /etc/group
    sed -i -e 's_oldusername_newusername_g' /etc/shadow

    All my files are removed.
    How can I recover them. They are so important for me.
    Please help.

  2. #2
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,517
    Distro
    Ubuntu

    Re: I have changed my username and all my files gone :(

    They are probably under you old /home directory..

    use
    Code:
    ls -l /home
    to show the home directorys you will hopefully have two now?

    then

    Code:
    sudo chown newusername /home/oldusername -R
    then open file browser and locate that folder

  3. #3
    Join Date
    Jun 2010
    Location
    London, England
    Beans
    8,055
    Distro
    Ubuntu Development Release

    Re: I have changed my username and all my files gone :(

    Our files/documents are in a folder called by our user name that is under the Home folder. If you set up another user with your old username then you will get access to those files. If you want to copy those files you will need to open Nautilus as administrator.
    Code:
    gksudo nautilus
    The files have not been deleted. You are no longer authorised to access them. You are not the user who created them any more.
    It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
    Ubuntu user #33,200. Linux user #530,530


  4. #4
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: I have changed my username and all my files gone :(

    Quote Originally Posted by SlugSlug View Post
    They are probably under you old /home directory.
    Probably not as the OP used usermod -m (--move-home).

    @bekir35
    It wouldn't help you find your files, but I believe you also should rename /var/mail/oldusername, /var/spool/cron/crontabs/oldusername etc. Look at the output of
    Code:
    sudo find /var -name oldusername
    sudo find /home -name '*oldusername*'
    Last edited by schragge; March 4th, 2013 at 07:14 PM.

  5. #5
    Join Date
    Mar 2013
    Beans
    2

    Post Re: I have changed my username and all my files gone :(

    @SlugSlug;

    I did these things. But at the /home/oldusername directory I found two files, one of them is a readme file. Another one is Access-Your-Private-Data.desktop.
    I have clicked on it but nothing seems.

    @grahammechanical;

    I want to open Nautilus as administrator, it opens file browser and waiting for me do a selection but there are nothing to select. I closed file browser and it gives me an error like this:
    "(nautilus:3485): Eel-WARNING **: "unique eel_ref_str" hash table still has 3 elements at quit time (keys above)

    (nautilus:3485): Eel-WARNING **: "nautilus-directory.c: directories" hash table still has 1 element at quit time (keys above)"

    @schragge;
    After the code 'sudo find /var -name oldusername', it lists:
    /var/lib/AccountsService/users/oldusername // I opened this directory and it is a text document which name is a oldusername
    /var/lib/sudo/oldusername // I want to open this directory it says permission denied. Than I opened it from the terminal as a root and found oldusername than I listed files under oldusername but there is nothing

    After the code 'sudo find /home -name '*oldusername*'', it lists
    /home/oldusername
    /home/.ecryptfs/oldusername // same as @SlugSlug methods found.


    Is there a solution ??

    By the way, thanks for your answers..






  6. #6
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: I have changed my username and all my files gone :(

    Quote Originally Posted by bekir35 View Post
    /home/.ecryptfs/oldusername
    Wait, your old home folder had been encrypted (community/EncryptedHome)? Or only a subdirectory of it (community/EncryptedPrivateDirectory)? That explains where all you data have gone. They are still there, just not visible to your new user.
    Last edited by schragge; March 5th, 2013 at 05:25 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •