I can't change a user's home directory using usermod;

[root@server ~]# usermod -d /some/opther/path userfoo
usermod: user userfoo is currently logged in
[root@server ~]$ who
myuser  pts/0        2013-06-17 11:29 (

As you can see, I am the only person logged in, userfood isn't logged in anywhere.

[root@waccoe-web ~]$ ps aux | grep userfoo
root  16724  0.0  0.0 103236   884 pts/0    S+   11:36   0:00 grep userfoo

userfoo also has no processes running.

userfoo exists purely for FTP access to the server. I have stopped, started, and restarted the FTP server (ProFTPD) to ensure there are no hanging FTP connections. This server still thinks userfoo is logged in.

How can I either convince the usermod command userfoo isn't logged in, or remove any trace of that account being in use? I suppose I could edit /etc/passwd but that seems like working around the problem to me. Or is that infact going ot be OK? I would have thought that if the system believes the user is still logged in, this isn't going to work until all their sessions have been terminated.

[root@server ~]# cat /etc/issue
CentOS release 6.3 (Final)
  • 1
    I'm not 100% sure how usermod determines if a user is logged in but you could try and use "lsof" to see if there are any files being held open in the user's home directory. – Fred Clausen Jun 17 '13 at 11:16
  • Try stopping proftpd, making the change, then starting it. – Nathan C Jun 17 '13 at 11:16
  • @NathanC As I said in the question "I have stopped, started, and restarted the FTP server (ProFTPD) to ensure there are no hanging FTP connections." - If that wasn't clear enough, I have restarted proftpd many times. – jwbensley Jun 17 '13 at 11:39
  • 3
    It's clear that you have restarted it. It's not clear whether you tried to make the changes while it was stopped. – Jenny D Jun 17 '13 at 11:41
  • @JennyD Ah, I see! Before stopping it, once it was stopped, and after restarting it :) – jwbensley Jun 17 '13 at 12:39

A couple of weeks later I compiled a newer Kernel so I had to reboot the box anyway, this was unsolved essentially, but now we can no longer continue exploring this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.