By
default base directory for the system user is set to /home directory.
I'd like to add user to /iscsi/home/${user} directory instead of the
default /home. How do I force useradd command to add user to /iscsi/home
under CentOS / RHEL / Fedora Linux server?
Default values for account creation defined in /etc/default/useradd file under CentOS / RHEL / Fedora / Debian / Ubuntu and other Linux distros. Simply open this file using a text editor, type:
The default home directory defined by HOME variable, find line that read as follows:
Replace with:
Save and close the file. Now you can add user using regular useradd command:
Install finger
Verify user information:
Output:
Default values for account creation defined in /etc/default/useradd file under CentOS / RHEL / Fedora / Debian / Ubuntu and other Linux distros. Simply open this file using a text editor, type:
# vi /etc/default/useraddThe default home directory defined by HOME variable, find line that read as follows:
HOME=/homeReplace with:
HOME=/gokilSave and close the file. Now you can add user using regular useradd command:
# useradd lookforshare
# passwd lookforsahre
Install finger
# apt-get install finger Verify user information:
# finger Output:
Login: lookforshare Name: lookforshare
Directory: /gokil/lookforhare Shell: /bin/bash
Last login Thu Des 1 07:58 2014 (IST) on pts/1 from 192.168.10.119
No mail.
No Plan.
How Do I Change Existing User's Home Directory?
You need to use the usermod command to set the user's new login directory. The syntax is as follows:
usermod -m -d /path/to/new/home/dir userNameHere
Where,- -d dirnanme : Path to new login (home) directory.
- -m : The contents of the current home directory will be moved to the new home directory, which is created if it does not already exist.
# usermod -m -d /gokil/lookforshare lookforshare


0 comments:
Post a Comment