3

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

Zanna
  • 72,312

2 Answers2

2

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 :)

user535733
  • 68,493
Rinzwind
  • 309,379
0

I suspect that you are logged in as the user which you are trying to modify. When you execute the su - command, the original login is still active which is why you see the error. If you attempt to kill the process, you will be killing the session which you are using and will be disconnected!

You need to log out of the system and then log in as root (or another user with enough privileges). This will enable you to perform the changes. (Note: just Switching user will not work because the other user will still be active)

SEWTGIYWTKHNTDS
  • 387
  • 1
  • 7