2

First I am logged into root and executed this command:

# sudo su

Then:

# usermod -l lazybug peter

Getting this error:

usermod: user peter is currently used by process 19895

So I have killed the process

# kill 19895

It will come out of root and if I run the same command it will give the same error message. I am really confused and please help.

wjandrea
  • 14,236
  • 4
  • 48
  • 98
Shamya U
  • 41
  • 1
  • 7

1 Answers1

6

You cannot change username while in the session already run by the same user. PID that you mentioned is the terminal you are currently using. You have to log out from current session and log as root user. If you cannot log as root user add another account temporary and log in with it. Then run sudo usermod -l lazybug peter from that account. Make sure new account can run sudo. Run this to add new user with sudo privileges. sudo adduser <username> sudo. This need in case of you cannot log as root.

If you need to change home directory too run this sudo usermod -d /home/newHomeDir -m newUsername