CHANGE HOME DIRECTORY USING usermod -dm
Hello Friends
I am facing a problem in changing the home directory of a user. I have a user mukesh with home directory /home/mukesh and i want to change the home directory to /home/newmukesh as well as i want to move the all content of /home/mukesh to /home/newmukesh is this right command for this purpose usermod -md /home/newmukesh mukesh This is the output of above command [root@server1 ~]# usermod -md /home/newmukesh mukesh Usage: usermod [options] LOGIN Options: -a, --append append the user to the supplemental GROUPS (use only with -G) -c, --comment COMMENT new value of the GECOS field -d, --home HOME_DIR new home directory for the user account -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE -f, --inactive INACTIVE set password inactive after expiration to INACTIVE -g, --gid GROUP force use GROUP as new primary group -G, --groups GROUPS new list of supplementary GROUPS -h, --help display this help message and exit -l, --login NEW_LOGIN new value of the login name -L, --lock lock the user account -m, --move-home move contents of the home directory to the new location (use only with -d) -o, --non-unique allow using duplicate (non-unique) UID -p, --password PASSWORD use encrypted password for the new password -s, --shell SHELL new login shell for the user account -u, --uid UID new UID for the user account -U, --unlock unlock the user account -Z, --selinux-user new selinux user mapping for the user account Please tell me the exact command for this. Thanks Rahul Sharma Thanks Sir for your quick response but i have checked there is no /home/newmukesh exist and i have type exactly as you say usermod -md /home/newmukesh mukesh |
That command works for me.
Make sure that /home/newmukesh doesn't already exist and make sure that you have -md not -dm, the order matters. Maybe you could try removing the space between the d and the HOME_DIR |
Quote:
I dont have any /home/newmukesh directory and i type usermod -md /home/newmukesh mukesh Thanks Rahul Sharma |
Try
Code:
usermod -m -d /home/newmukesh mukesh |
Move users Home dir
sudo usermod -m -d /home/ubuntu/workspace/derpHome derp
|
@lightarrow: this thread finished in 2011.
Also, the OP was already logged in as root; see post #1 |
All times are GMT -5. The time now is 03:04 AM. |