Solved

Adding a user

Posted on 2002-05-04
6
155 Views
Last Modified: 2010-04-22
Please i don't want someone else to do this i just need to know what commands i would use in the korn shell to make a script that will add users and groups along with adding the shodowed password.
0
Comment
Question by:sk33v3
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6990266
useradd && groupadd && passwd
0
 
LVL 9

Author Comment

by:sk33v3
ID: 6990494
can't use the useradd program.
0
 
LVL 5

Accepted Solution

by:
bryanh earned 55 total points
ID: 6990683
It's hard to see how you could be prevented from using 'useradd' but still be able to add a user via your own shell script, but I'll take your word for it.

Since you don't want someone else to write the exact code, I presume you're asking what it takes at a higher level to add a user.  It doesn't require any special shell command to do it -- it's just file manipulation.

Different systems have different security and accounting systems, so there's no one answer for everyone.  But I know the commonest cases.

You need to add a line to /etc/passwd and a line to /etc/shadow and typically a home directory to /home.

I myself never try to construct the /etc/shadow entry myself.  I just put a dummy entry in with the proper username and then run the 'passwd' program to set a real password.

You may want to read the /etc/passwd file first to see what usernames and uids are unused.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 51

Expert Comment

by:ahoffmann
ID: 6991009
> can't use the useradd program
Why?
Please be more specific.
0
 
LVL 9

Author Comment

by:sk33v3
ID: 6991528
well the assignment is to make a script to add a user without using useradd program. it must also be able to make groups and delete them. i got the delete part down that was easy but my problem is encryting the password in the shadow file.
0
 
LVL 5

Expert Comment

by:garboua
ID: 7006645
KeYword is assignment.  you are not going to get the script from EE, but here is the HeLP

look at /etc/passwd /etc/group for format.
your script Must add an entry to /etc/passwd with user name, user ID, group id, and shell
and to group if you are creating a new group for each user.  if you can create them, you can delete them.

ciao
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now