I have a website user who I want to be able to upload content to a folder on my server. I thought ok, I'll create a new user, and change his home directory to the folder where his stuff is already.
No such luck, usermod wont allow me to create that directory, it already exists.
$ sudo usermod -m -d /public_html/user user usermod: directory /public_html/user exists I looked through the man page but did not see an immediate solution to this problem.
11 Answer
The message is only informational - the change should be accepted regardless.
Ex. given
$ getent passwd testuser testuser:x:1001:1001:,,,,:/home/testuser:/bin/sh then
$ sudo mkdir /home/foo $ sudo usermod -m -d /home/foo testuser usermod: directory /home/foo exists however the home directory was successfully changed
$ getent passwd testuser testuser:x:1001:1001:,,,,:/home/foo:/bin/sh And just to be sure:
$ su - testuser Password: $ pwd /home/foo