usermod -d /path user - User is currently logged in
I ran into this. The user was not logged in according to w
, but a ps aux | grep username
showed an imap
process running as the user. The usermod
command ran successfully after the imap
connection was closed.
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.
I would first lock the user account that he will be not abble to log in after you log out him.
passwd -l username
This command will block user.
If he is still logged in then uou can log him out with
skill -KILL -u username
After that you can modify his path to home dir and unlock account with
passwd -u username