Solved

Adding new user in Linux - useradd and adduser not working

Posted on 2012-03-13
9
540 Views
Last Modified: 2012-03-13
I'm trying to create a new user on my Web server.  I think it's running Ubuntu but I'm not sure.  I've tried useradd and adduser, while working as root, and it keeps telling me "bash: useradd: command not found"

I'm using putty to remote in to the server.

The man pages have information on the useradd command, even if the command doesn't seem to work.

What am I doing wrong?
0
Comment
Question by:GlennSimpson2
9 Comments
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37717131
Are you root?
What is the output for command "id"?
0
 

Author Comment

by:GlennSimpson2
ID: 37717149
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
0
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37717157
Great..
What about "which useradd" or "which adduser"
0
 

Author Comment

by:GlennSimpson2
ID: 37717178
which useradd

/usr/bin/which: no useradd in (/usr/kerberos/sbin:/usr/kerberos/bin:/user/local/bin:/bin:/usr/bin:/home/username/bin)

which adduser
/usr/bin/which: no adduser in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/usersname/bin)
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37717193
Ok. It looks like you logged in without loading the environment variables and PATH for root.

CAn you open a new terminal.
login as user (whoever)
Do sudo su - (Dont forget the - or hyphen after su)
Now try which useradd and see if you are able to run useradd
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37717209
Did you do

sudo su -

To get to super user?  Make sure not to forget this hyphen at the end
Then issue command

useradd newuser

or
useradd -g group -s /bin/bash newuser
0
 

Author Comment

by:GlennSimpson2
ID: 37717244
Here's what's happening.

Log in as user (say jsmith)

sudo su -
[sudo] password for jsmith: (i enter correct password)
jsmith is not in the sudoers file. This incident will be reported.

In this case "jsmith" is the guy who usually manages this server, so I'm not sure what that means.
0
 
LVL 11

Accepted Solution

by:
legolasthehansy earned 500 total points
ID: 37717251
Ok. Try su - (provided you know the password for root)
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 37717555
Why not just

/usr/sbin/useradd ...

?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now