LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash shell (https://www.linuxquestions.org/questions/linux-newbie-8/bash-shell-4175459352/)

trackstar2000 04-23-2013 06:19 PM

Bash shell
 
I noticed when I created a user with this command below, the user gets a "-bash-4.1$" when he logs in.

useradd -g Grp1 -d /home/locaton1 person1

If I tried the command below, it gets a"[johndole@localhost~]$

adduser johndole

I am guessing the command force the user to be in the bash shell?

TobiSGD 04-23-2013 06:29 PM

Both users are using the bash shell. The useradd command will not check the specified /home-directory for existence and will not create it if it doesn't exist, if you don't use the -m option. As a consequence, the files from the skeleton directory (usually /etc/skel) will not be copied to the new users /home directory. In your case the skeleton directory seems to contain a bashrc file that sets the different shell-prompt.

In opposite, the adduser command does all these things by default.

trackstar2000 04-23-2013 07:03 PM

Quote:

Originally Posted by TobiSGD (Post 4937585)
Both users are using the bash shell. The useradd command will not check the specified /home-directory for existence and will not create it if it doesn't exist, if you don't use the -m option. As a consequence, the files from the skeleton directory (usually /etc/skel) will not be copied to the new users /home directory. In your case the skeleton directory seems to contain a bashrc file that sets the different shell-prompt.

In opposite, the adduser command does all these things by default.



Thanks. I did --> echo $SHELL, it resulted same. Just needs a good explanation.

Nbiser 04-23-2013 07:56 PM

Both users are there, and both users are using the bash shell. A TobiSGD said, the /etc/skel can sometimes do strange things.

trackstar2000 04-23-2013 10:38 PM

Quote:

Originally Posted by TobiSGD (Post 4937585)
Both users are using the bash shell. The useradd command will not check the specified /home-directory for existence and will not create it if it doesn't exist, if you don't use the -m option. As a consequence, the files from the skeleton directory (usually /etc/skel) will not be copied to the new users /home directory. In your case the skeleton directory seems to contain a bashrc file that sets the different shell-prompt.

In opposite, the adduser command does all these things by default.

I am home and tried both, useradd and adduser and they yielded same error message if the specified directory already exists. Let me do some more reading to get a better understanding. Thanks.

adduser -g grp1 -d /home/location1 person5

adduser: warning: the home directory already exists.
Not copying any file from skel directory into it.


useradd -g grp1 -d /home/location1 person6

useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

chrism01 04-24-2013 12:55 AM

There's a good discussion of adduser vs useradd here http://www.garron.me/go2linux/userad...ntu-linux.html.
In short, the 'real' cmd is useradd, but some distros may have adduser as a symlink to this OR it may be a separate (Perl) script or it may not exist... ;)

HTH :)


All times are GMT -5. The time now is 11:34 PM.