Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 5651  / 1 Year ago, mon, january 9, 2023, 2:37:26

I need to change the username from the linux (Not admin).


I changed in settings ->Users. But how to change the "home folder" name or root user in linux.


I tried using


usermod -l <newname> -d /home/<newname> -m <oldname>

But this always mentions that


username <oldname> is currently used by process <some id>

Does anything happen if I kill the process?


I logged in as root using su - and tried the same usermod command.


So, how do I change the name without killing the process?


Any leads will be appreciated. I have attached a screenshot of changed username in Settings > Users.


Sunag "your user" and Admin


More From » 18.04

 Answers
5

General method that I use:



  • Create new user


    useradd {newuser}
    passwd {newuser}


  • Move personal files over from old user to new user


    sudo cp -r /home/{olduser}/[A-Z]* /home/{newuser}/


  • chown personal files to new user if needed


    sudo chown -R {newuser}:{newuser} /home/{newuser}/[A-Z]*


  • Log in to new user and delete old user after you confirm new user is working as intended (that makes sure no process are active for olduser).


    userdel {olduser}


  • do not copy/paste and do adjust the commands to what you need :)




[#1667] Monday, January 9, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
;