Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding and Deleting Users

Posted on 2006-06-09
3
Medium Priority
?
1,188 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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 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…
Suggested Courses

730 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