LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2008, 03:56 AM   #1
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Rep: Reputation: 17
curious about adduser


I am a bit curious about this adding user commands in linux, like adduser and useradd

Just say a user name john1 exists in the system, and then we adduser john1 again, we have an error that shows

adduser: The user `john1' already exists.

I want to know where the configuration files is placed that shows this message. I want to know how it checks the /etc/passwd file and produce that output. I want to knw teh scripting part of it.

Any ideas.

Thanks in advance.
 
Old 02-28-2008, 04:28 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
adduser is a shell script, so you can open it with an editor like vi and take a look at its code to see how the various checks are done.

Regards
 
Old 02-28-2008, 05:00 AM   #3
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Original Poster
Rep: Reputation: 17
issit the adduser.conf???
 
Old 02-28-2008, 05:19 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
You can use an editor to view adduser as it's a shell script. In Slackware the check is done by this piece of code:
Code:
...
  grep "^${LOGIN}:" $pfile >/dev/null 2>&1  # ensure it's not already used
  if [ $? -eq 0 ]; then
    echo "- User '$LOGIN' already exists; please choose another"
...
where $pfile=/etc/passwd and $LOGIN is the input (username).
I guess that if you have a file called adduser.conf, then it contains the defaults for a user creation, like homedir, shell etc.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adduser jp_ Linux - General 6 10-18-2005 03:11 PM
adduser 64bitPlaya Slackware 2 08-13-2004 06:05 PM
adduser trophy Linux - General 1 05-01-2004 08:35 AM
need to adduser(s) b_usa Linux - General 3 04-04-2003 08:40 PM
Adduser... Chijtska Linux - General 5 02-15-2002 08:53 AM


All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration