LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-28-2007, 12:59 PM   #1
frankthetank250
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Rep: Reputation: 0
Creating new users in linux without using addmod or user add


Hi, I'm pretty new to linux and trying to figure out some things to help a friend that is taking a class.

What we're trying to do is write bash script to create a user, but can't use adduser or useradd or any other standard commands for adding a user in a single step. We've have been looking around but just haven't been able to find a way to do this.

Another thing that we're trying to do is write a script to create 100 users with names user001 through user100. When doing this we can use adduser or useradd or any other available programs which create a user in a single step, also make up the passwords, but they can all be the same. A way we can do this is create a script which creates a script to create the users. We are also having some trouble trying to do this.

The last thing that we are trying to do is write a script to create 100 users in the form of F######L where F is the first initial, ###### are the last 6 digits of an id or something like that, and L is the last initial. All of this stuff can just be random. The data will come from a file of the form lastname,firstname,IDnumber,password. We can use any of the available programs which create a user in a single step. We have to use the passwords given in the file for the users. We can also create a script which creates a script to create the users. We've been trying to do this but having problems.

Those are all of the things that we are trying to do. If anyone could help at all that would be greatly appreciated.

Thanks so much,
-John
 
Old 10-28-2007, 01:02 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this reads an awful lot like homework... what you're doing appears to be totally arbitrary and largely pointless, suggesting it's just a learning exercise. Assuming that I am right, then you need to learn this for yourself using course materials and other resources provided for you. if you have specific questions once you're going, we'll be happy to help.
 
Old 10-28-2007, 01:44 PM   #3
frankthetank250
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Original Poster
Rep: Reputation: 0
The thing that we are really stuck on is trying to create a user in a bash script without using the adduser or useradd command. We can't find anywhere how to do it without using adduser or useradd. If anyone knows a good reference where we could find how to do this or knows how to do this that would be really helpful.

Thanks,
-John
 
Old 10-28-2007, 01:48 PM   #4
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
Look at /etc/passwd and etc/group - could maybe modify them in some way?
 
Old 10-28-2007, 05:27 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Most distributions will also require modification to /etc/shadow. The man pages for the files and the login program should help out.
 
Old 10-29-2007, 02:24 AM   #6
frankthetank250
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Original Poster
Rep: Reputation: 0
I have one more question, I have pretty much everything figured out that I am trying to do except on the last part i'm trying to figure out how to write a bash script that will read from a text file named users.txt in the format of lastname,firstname,IDnumber,password and create users from that. The file i have setup is like this: Last,First,123456,abc123 and I am trying to have it output like this (# adduser F123456L). If anyone could help me out with this that would be really helpful.

Thanks.
 
  


Reply



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
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
Creating new users in linux without using addmod or user add frankthetank250 Linux - Newbie 1 10-28-2007 09:02 PM
Grant a user root privileges to add and delete users Maranza Linux - Security 6 11-02-2006 10:10 AM
Creating Users in Linux with specific rights: Issue?? rajnair0278 Linux - Software 1 07-10-2006 07:24 AM
Creating multiple users in Kmail with a single KDE user jonole Linux - Software 3 10-03-2004 12:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:15 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
Open Source Consulting | Domain Registration