Solved

Adding and Deleting Users

Posted on 2006-06-09
3
1,137 Views
Last Modified: 2012-06-27
There was an existing user called 'newuser' on the system. I wanted to remove the user and add it again so I ran the userdel command. When I went to add the user again I got the message displayed below.

# userdel newuser
UX: userdel: ERROR: newuser does not exist.
# useradd newuser
UX: useradd: ERROR: newuser is already in use.  Choose another.

How can I delete this user?

Please help.
0
Comment
Question by:wilg0005
3 Comments
 
LVL 6

Expert Comment

by:bira
ID: 16872612
   useradd only adds a user definition to the local system.  If
     a  network  nameservice such as NIS or NIS+ is being used to
     supplement  the  local  /etc/passwd  file  with   additional
     entries,  useradd  cannot change information supplied by the
     network  nameservice.   However  useradd  will  verify   the
     uniqueness of the user name and user id and the existence of
     any group names specified against the external nameservice.
0
 
LVL 62

Expert Comment

by:gheist
ID: 16875733
"uname -a" please.
0
 
LVL 6

Accepted Solution

by:
JJSmith earned 500 total points
ID: 16880865
As indicated by the first message from userdel:

UX: userdel: ERROR: newuser does not exist.

This almost certainly means that the user details do not exist locally on the machine from where you issued the userdel command. The fact that the useradd command identified the user exists indicates that the passwd file may be NIS'ed.

Just to confirm after you run the userdel and get the error, try;

echo $?

if it returns the value 6 then you are probably using NIS and need to take a different approach to adding and deleting users .e.g from the NIS server.

What confuses the issue is that userdel will be looking in local config files, when attempting to remove a user and may not find 'newuser'. Similarly useradd has a need to establish password data for a new user and would probably use calls to get(es)pwnam to see if the details already exist - these calls could reference NIS maps (passwd.byname,passwd.byuid), depending on /etc/nsswitch.conf and therefore the 'newuser' might be found 'non-locally' !!

Sorry is it's a little confusing but in summary the combination of userdel and useradd error messages that you are recieving, given that you execute both commands in the same environment, seem to indicate that NIS is part of the game - or even LDAP maybe.

You really need to establish how your user 'database' is held before attempting to delete and add users. It's possible to double up with a 'local' and 'NIS' user for the same user if you're not careful.

TRY:

$ ypwhich    
OR
$ ypwhich -m

If they fail then you may not have NIS up and working or your sessions access point may be on a non bound client.

If they do work then try:

1. $ grep newuser /etc/passwd

2. ypcat passwd | grep newuser

If they both return the same you are in the right place to delete users. Seek further advice from his forum on 'How to delete/add users under NIS'

Cheers
JJ



 

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CPU monthly average? 12 120
Linux : can't create transaction lock error 1 67
Correct syntax to upload file in a script using sftp 2 82
Linux: disable vim auto-comment 7 120
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

821 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