Usermod -d /path user – User is currently logged in

users

good Day

I want to make a change to a user on my CENTOS server. I want to change his default directory.
When running the command:

usermod -d /path_to_new_dir david

terminal gives me the following

User david is currently logged in

I closed all ftp sessions which I was engaged into with that user, and I am logged into terminal as root.

How do I run that command and how do I log out the user? As far as I am concerned he is not logged in…

Best Answer

One way to kick the user is by doing the following:

# w
damaya   pts/5     23:20    1.00s  0.00s  0.00s w

As we can see from "w" output, user damaya is logged in on pts/5. Now type:

# fuser -k /dev/pts/5

That will kick the user off and you can now modify their account.

Related Question