- Back to Home »
- Linux Shell Commands »
- Change Default User Home Directory While Adding A New User
Posted by : FixNox
Wednesday, 12 September 2012
By default, when we create or add users to Linux System, user’s default home directory is created to /home. To change default directory to /opt/, we need to change few settings as mentioned below: | |||||||||
| |||||||||
STEP 1: Open /etc/default/useradd | |||||||||
| |||||||||
# nano /etc/default/useradd | |||||||||
The default home directory defined by HOME variable, find line that read as follows: | |||||||||
| |||||||||
HOME=/home replace to HOME=/opt/ | |||||||||
| |||||||||
Save and close the file. Now you can add user using regular useradd command: | |||||||||
| |||||||||
# useradd uddika | |||||||||
# passwd -d uddika | |||||||||
| |||||||||
Verify user information: | |||||||||
| |||||||||
# finger uddika | |||||||||
Output: | |||||||||
|