Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux usermod user is currently used by process

Tags:

linux

So I'm trying to change user502's directory using

usermod -d /home/user502home user502

When I enter than into the shell (I'm on root user) I get "usermod: user502 is currently used by process 4220" and I know the user isn't logged in or anything, I just made the user.

How do I fix this?

like image 843
Ryan Avatar asked Mar 10 '15 19:03

Ryan


1 Answers

You must kill currently used process first. But this process probably is your SSH connection. So, in this case you need to run this commands on nohup.

sudo su
nohup kill 4220; sleep 2; usermod -d /home/user502home user502 &

After you can connect to SSH again.

like image 84
iamdual Avatar answered Sep 20 '22 21:09

iamdual