LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   usermod - Can't change home - user logged in? (https://www.linuxquestions.org/questions/ubuntu-63/usermod-cant-change-home-user-logged-in-4175554213/)

doveman 09-22-2015 03:02 PM

usermod - Can't change home - user logged in?
 
Hello,
I am new on this forum so bear with me.
I am trying to change the home directory of a user. I logged in as another user and executed:
sudo usermod -d /var/newhome username

The response I get back is username is currently logged in.

When I do a who the only user logged in is myself. Not the user I am trying to change.

Is there a table somewhere that needs to be cleared or something else?

I am on ubuntu 12.04.4 LTS 64 bit.

Thank you.

rtmistler 09-23-2015 01:56 PM

You might want to also employ the -m flag to "move" the contents from old to new.

I'd recommend that you do not have the newhome directory created because the usermod command will create it for you. Perhaps this is part of the problem in that you created it but the permissions are in the way of this action and you get a not helpful error.

I'm also assuming the username is not root. You cannot change root's home location. Well you "should not" strongly enough that it really is "cannot".

I'm sure there are other ways to determine if a user is logged in or has processes running, I personally would use the ps command:
Code:

$ ps -ef | grep username


All times are GMT -5. The time now is 06:24 PM.