Change Default User Home Directory While Creating A New User
You may encounter a situation where /home directory if about to full or you do not want
Users home directory to be /home, to overcome this situation you can change the default home directory of normal users to different directory
By default, whenever we create or add users to Linux server, user’s default home directory is created to /home. To change default directory to /opt/, we need to change few settings as
mentioned below:
Open /etc/default/useradd
# vi /etc/default/useradd
The default home directory defined by HOME variable, find line that read as follows:
HOME=/home replace to HOME=/opt/ (location where you want to be )
Save and close the file. Now you can add user using regular useradd command:
# useradd tecgeeks
# passwd tecgeeks
Verify user information:
# finger tecgeeks
Output:
Login: tecgeeks Name: tecgeeks
Directory: /opt/tecgeeks Shell: /bin/bash
Never logged in.
No mail.
No Plan.
Users home directory to be /home, to overcome this situation you can change the default home directory of normal users to different directory
By default, whenever we create or add users to Linux server, user’s default home directory is created to /home. To change default directory to /opt/, we need to change few settings as
mentioned below:
Open /etc/default/useradd
# vi /etc/default/useradd
The default home directory defined by HOME variable, find line that read as follows:
HOME=/home replace to HOME=/opt/ (location where you want to be )
Save and close the file. Now you can add user using regular useradd command:
# useradd tecgeeks
# passwd tecgeeks
Verify user information:
# finger tecgeeks
Output:
Login: tecgeeks Name: tecgeeks
Directory: /opt/tecgeeks Shell: /bin/bash
Never logged in.
No mail.
No Plan.
Change Default User Home Directory While Creating A New User
Reviewed by TecGeeks News
on
December 21, 2016
Rating:
No comments: