useradd - shell missing features after adding user


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu useradd - shell missing features after adding user
# 1  
Old 09-11-2009
useradd - shell missing features after adding user

Hi, I need to create a user from a bash script so i have to use useradd. The problem is that when i create a user with:
Code:
useradd -d /home/sample -m sample

after i login with that user I have no history in bash, path do not appears, i can't use arrows and so on. When I use adduser everything is fine but what I'm missing here ? What parameters do i have to use with useradd so when I login with that user bash has full features.

Thank you.
# 2  
Old 09-11-2009
try usermod -s /bin/bash <username> if the shell is not bash, for some reason. Alternately check to make sure the contents of /etc/skel were copied to the user's home.
# 3  
Old 09-23-2009
useradd does not give the user any more parameters than those you create, so the way you're using it, it won't asign bash as the default shell.

I'd use this:
useradd -d /home/user -s /bin/bash -G group -m user

Remove the -g in case you don't want him to be in a specific group.
I'd try adding a -p password with a password that might be maybe the same user name

Good luck
# 4  
Old 09-23-2009
if you use the -G group that will be a secondary group. If you want them to be in default groups, then you can leave that off. Otherwise, use -G for groups you don't want to include their primary GID. -g is used for their primary GID/group.
# 5  
Old 09-24-2009
useradd -d /home/user -m -s /bin/bash -c "Name&Surname" user

this will create new user

then
passwd user --> enter new password

then transfer owneship to new user

chown -R user /home/user
# 6  
Old 09-24-2009
ownership should not need transferring when made with useradd especially if the -m switch is used.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in adding missing tag in php pages

hi, I am still a newbie on ssh but trying hard. my friends website was hit by some virus which included a long encrypted malware code on each and every php file she had. I was able to use sed command via ssh to remove the malware codes but now most pages don't have a opening <?php tag. i... (8 Replies)
Discussion started by: netatma
8 Replies

2. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: How can I change the file so as to include lines with zero count? e.g. in the previous file to put... (4 Replies)
Discussion started by: TheTransporter
4 Replies

3. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: 1950 7 2000 14 2050 7 2100 13 2150 10 2200 9 2250 7 2300 8 2350 7... (1 Reply)
Discussion started by: TheTransporter
1 Replies

4. Linux

Linux- Useradd / sudo user

Hi, I am new in linux. Please help for create new user and also need to give sudo access in linux box. Please help me Now i am having new access Thanks, Mani (2 Replies)
Discussion started by: Mani_apr08
2 Replies

5. Shell Programming and Scripting

features of a new SHELL

Hello, My team and I planing to create a new shell. We are including features like handing the "command not found" exception, etc.... 1)Can you please give some suggestions on what do do while writing a new shell..... 2)can you please give me your problems with the existing shells..My... (15 Replies)
Discussion started by: nsharath
15 Replies

6. UNIX for Dummies Questions & Answers

Shell features ???

Hi Can anybody explain the following shell features with example a) Command line editing b) filename completion c) job control (1 Reply)
Discussion started by: skyineyes
1 Replies

7. UNIX for Advanced & Expert Users

setting password for user using useradd?

hi all i am writing a script to create user and group from the input given to script for eg. script needs to values 1. mode - 1 or 2 2. id - if mode is 1 then id should be 2 char like x1 / v1 / v2 if mode is 2 then id should be 1 char like x / v / e from these to values group is... (1 Reply)
Discussion started by: zedex
1 Replies

8. UNIX for Dummies Questions & Answers

Who can help me how to add user without 'useradd' command

Can any one tell me if i dun want using 'useradd' command to add new user, it is have any command i can use to add a new user?and any extra step needed for my local environment? (3 Replies)
Discussion started by: foong
3 Replies
Login or Register to Ask a Question