Solved

Adding and Deleting Users

Posted on 2006-06-09
3
1,150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
change HISTFILE for root user on AIX 3 106
AIX    Volume group Auto ON/OFF question 2 127
ftpcommand 2 74
Searching File Names and Eliminating Duplicates in Linux 4 84
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

726 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