Solved

Adding new user in Linux - useradd and adduser not working

Posted on 2012-03-13
9
545 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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
 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

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…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

803 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