In UNIX, a user can login only when they have an account in the server which has an entry at /etc/passwd and other files.
The default location where the user logs in is their respective home directory /home/<username> execpt the "
root". "Root" user logs into "/".
The home directory is created when the # useradd command is used with "-m" flag.
#useradd -m test : Command creates a user called "test" with the home directory of the same name under "/home".
#useradd test : Command create the user "test" with the default attributes.
So what makes the difference when this is executed:
#su - test
#echo $HOME
On the both the case the output will be "/home/test". But the difference is,
# useradd -m test : Creates a home directory.
#useradd test : Created a virtual directory, that is the directory does not exist in real, but allow the users to login by "#su - test", and the user do not have any control like creating a file / reading a file when they login into the virtual directory.
The default location where the user logs in is their respective home directory /home/<username> execpt the "
root". "Root" user logs into "/".
The home directory is created when the # useradd command is used with "-m" flag.
#useradd -m test : Command creates a user called "test" with the home directory of the same name under "/home".
#useradd test : Command create the user "test" with the default attributes.
So what makes the difference when this is executed:
#su - test
#echo $HOME
On the both the case the output will be "/home/test". But the difference is,
# useradd -m test : Creates a home directory.
#useradd test : Created a virtual directory, that is the directory does not exist in real, but allow the users to login by "#su - test", and the user do not have any control like creating a file / reading a file when they login into the virtual directory.
No comments:
Post a Comment