ARCHIVED: In Unix, how do I change a user's home directory?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Note: These instructions require that your Unix account have administrator privileges. If you do not have administrator privileges, you may want to consider setting your initialization files to automatically change to a particular directory.

In Unix, to change a user's home directory, you must have administrator privileges. Modify the second-to-last field in the user's /etc/passwd entry. For example, if you want to move the user dvader from /disk1/dvader to /disk2/dvader, first locate his entry in /etc/passwd. It should look something like this:

 dvader:x:99999:9999:Darth Vader:/disk1/dvader:/bin/csh

Change /disk1/dvader to /disk2/dvader. Once you have updated /etc/passwd, move the user's files to the new directory.

Note: Never edit the /etc/passwd file directly. Make a copy of it and make your changes there. Once you have finished, back up the old version, and move the updated version into place. On many systems, there are utilities that make editing /etc/passwd entries easier and safer. Consult your documentation for more information.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

This is document accu in the Knowledge Base.
Last modified on 2018-01-18 10:52:28.