Go Back   openSUSE Forums > Archives > SLS Archives > ARCHIVES - SuSE Linux > ARCHIVES - Network & Security > ARCHIVES - Security
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Security Want to know if you should really apply the latest kernel patch? Want to know how to configure your firewall? Discuss any Security related topics in here!

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 28-Oct-2006, 18:17
Jessi
Guest
 
Posts: n/a
Unhappy

Hello all,

I am doing an assignment for school and I need to add 123 users at the same time as part of the assignment.
They have to meet the follwoing requirements

thier user id has to be from 3001 - 3123.
their home directory has to be /home/user001 - /home/user123
pass must change in 28 days
GID: 9999 GroupName: clients

I know scripting is involved but i have no idea :blink:

Can anyone plz help me out?

Thanks Alot!
  #2 (permalink)  
Old 28-Oct-2006, 21:59
paul1974
Guest
 
Posts: n/a
Default

Something to get you started. You will need to check the commands. BTW the following doesn't set a password for the user accounts.

#!/bin/bash
#
#
#
START_UID=1000
END_UID=1050
HOME_DIR_BASE=/home/user
USERADD=/usr/sbin/useradd
PASSWD=/usr/bin/passwd
GROUPADD=/usr/sbin/groupadd

GROUP="clients"
PASSWORD_CHANGE=28

count=$START_UID
while [ $count -le $END_UID ]
do
$USERADD -d $HOME_DIR_BASE$count -u $count -g $GROUP -m "user{$count}"
if [ $? -gt 0 ];then
echo "Error adding $count"
fi
$PASSWD -n 28 "user${count}"
if [$? -gt 0 ];then
echo "Error setting password expiry for $count"
fi

done
  #3 (permalink)  
Old 29-Oct-2006, 06:59
Eds
Guest
 
Posts: n/a
Default

Quote:
I am doing an assignment for school and I need to add 123 users at the same time as part of the assignment.
They have to meet the follwoing requirements ...[/b]
Surely the whole point of school work assignments is to figure it out for yourself.
Education = learning, and you won't learn a thing if someone else just hands you the answer.

  #4 (permalink)  
Old 29-Oct-2006, 08:07
linux_learner
Guest
 
Posts: n/a
Default

Quote:
Surely the whole point of school work assignments is to figure it out for yourself.
Education = learning, and you won't learn a thing if someone else just hands you the answer.

[/b]
I have to agree Eds. I always thought the point of school was learning/education. I would consider this cheating.
  #5 (permalink)  
Old 31-Oct-2006, 02:54
paul1974
Guest
 
Posts: n/a
Default

I have to disagree that this is cheating. Personally I've found that writing code cold when you have little or no experience daunting and seeing examples or parts of code highly beneficial.

I believe the OP stated that they didn't know where to start. The code I wrote isn't complete and has some minor issues. I dare say if the OP troubleshoots the code and modifies it to suit they will gain a better understanding. It really is up to the individual to get what they can from examples and it’s not our place to judge. If it’s just a straight copy into an assignment then it’s of little benefit, however if the OP is more inquiring then they will benefit. The type of person who gets ahead in IT is the type of person with an inquiring mind. However everyone needs somewhere to start. Obviously the OP isn’t familiar with scripting and may not have seen many examples.

If the OP copies this code verbatim there is a good chance the OP will be caught out. Teachers are increasingly using software that checks the internet for plagiarism.

  #6 (permalink)  
Old 31-Oct-2006, 05:47
virtual_square
Guest
 
Posts: n/a
Default

Quote:
I have to disagree that this is cheating. Personally I've found that writing code cold when you have little or no experience daunting and seeing examples or parts of code highly beneficial.

I believe the OP stated that they didn't know where to start. The code I wrote isn't complete and has some minor issues. I dare say if the OP troubleshoots the code and modifies it to suit they will gain a better understanding. It really is up to the individual to get what they can from examples and it’s not our place to judge. If it’s just a straight copy into an assignment then it’s of little benefit, however if the OP is more inquiring then they will benefit. The type of person who gets ahead in IT is the type of person with an inquiring mind. However everyone needs somewhere to start. Obviously the OP isn’t familiar with scripting and may not have seen many examples.

If the OP copies this code verbatim there is a good chance the OP will be caught out. Teachers are increasingly using software that checks the internet for plagiarism.
[/b]
If I were able to write codes like Paul (btw, I am not able to) and had seen the request, I would have done the same as what Paul did. This is not cheating or helping to cheat at all.

It is only by standing on shoulders of giants that we can push the boundary of human history wider. I am constantly seeking help in this forum asking various questions (many thanks to those kind experts and sorry if I bothered you too much!) and also wish if I could provide some help to others.

I truly believe that every enquiry has a valid reason and we should give a hand whenever we can.
 

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2