Solved

Adding new user in Linux - useradd and adduser not working

Posted on 2012-03-13
9
538 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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-…
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

20 Experts available now in Live!

Get 1:1 Help Now