LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2013, 07:19 PM   #1
trackstar2000
Member
 
Registered: Apr 2013
Posts: 42

Rep: Reputation: Disabled
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?
 
Old 04-23-2013, 07:29 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
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.
 
1 members found this post helpful.
Old 04-23-2013, 08:03 PM   #3
trackstar2000
Member
 
Registered: Apr 2013
Posts: 42

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
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.
 
Old 04-23-2013, 08:56 PM   #4
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 302
Blog Entries: 7

Rep: Reputation: 44
Both users are there, and both users are using the bash shell. A TobiSGD said, the /etc/skel can sometimes do strange things.
 
Old 04-23-2013, 11:38 PM   #5
trackstar2000
Member
 
Registered: Apr 2013
Posts: 42

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
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.

Last edited by trackstar2000; 04-23-2013 at 11:54 PM.
 
Old 04-24-2013, 01:55 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh from solaris 9 with a bash shell of 2.0 to suse 3.2 bash shell slufoot80 Solaris / OpenSolaris 3 09-19-2012 04:06 PM
ssh from solaris 9 with a bash shell of 2.0 to suse 3.2 bash shell slufoot80 Solaris / OpenSolaris 1 09-19-2012 02:19 PM
in bash shell how to run shell script during startup rammohan04 Red Hat 2 07-31-2009 03:07 AM
copy directories and files recursively using C shell or bash shell bostonuser Programming 7 06-06-2008 02:24 AM


All times are GMT -5. The time now is 10:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration