Sponsored Content
Full Discussion: User Accounts
Top Forums Shell Programming and Scripting User Accounts Post 47639 by Sensor on Sunday 15th of February 2004 05:01:21 AM
Old 02-15-2004
Question User Accounts

I have found a script to create user accounts. But there are a few lines i dont understand. Can someone help me with this? Here's the code:

######################################

while [ $TOTAL -gt 0 ];
do
ACCT=${USER_ACCT}${START}
START=`expr $START + 1`
START=`echo ${START} | awk '{printf("%02d",$1)}'`
TOTAL=`expr $TOTAL - 1`
useradd -g ${GROUP_ID} -d ${TOP_LEVEL_DIR}/${ACCT} -c 'Student Acct' -m -s /bin/ksh ${ACCT}
(cd ${TOP_LEVEL_DIR}/coursefiles; tar cf - . | (cd ${TOP_LEVEL_DIR}/${ACCT}; tar xf -))
chown -R ${ACCT} ${TOP_LEVEL_DIR}/${ACCT}
chgrp -R ${GROUP_ID} ${TOP_LEVEL_DIR}/${ACCT}
chmod 755 ${TOP_LEVEL_DIR}/${ACCT}
echo "Account ${ACCT} created."
echo
done


ACCT=${USER_ACCT}${START_SAV}
echo "Enter the default password to use for the recently created accounts"
echo
passwd ${ACCT}
PASSWORD=`grep '^'${ACCT}':' /etc/shadow |cut -d: -f2`

START=`expr $START_SAV + 1`
START=`echo ${START} | awk '{printf("%02d",$1)}'`
TOTAL=`expr $TOTAL_SAV - 1`

while [ $TOTAL -gt 0 ];
do
ACCT=${USER_ACCT}${START}
ed /etc/shadow <<EOF
g/${ACCT}:/s/:\*LK\*:/:${PASSWORD}:
W
Q
EOF
START=`expr $START + 1`
START=`echo ${START} | awk '{printf("%02d",$1)}'`
TOTAL=`expr $TOTAL - 1`
done

######################################

Thanks!!!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with user accounts

I have a root access to a UNIX system. I want to create another account with administrative permissions (create users, delete them, manage print and system configuration), how do I do that? I have a Solaris 9 (SunOS 5.9) installed. Please help. :o (3 Replies)
Discussion started by: neked
3 Replies

2. UNIX for Dummies Questions & Answers

User Accounts

Hi, I was wondering if someone could tell me how to display a list of all existing user accounts on the system, not neccesarily looged in. Thanks in advance Stephen (3 Replies)
Discussion started by: sroberts82
3 Replies

3. UNIX for Dummies Questions & Answers

Creating user accounts

Hey everyone I am new to the forums and to Unix. I am currently taking a class on Unix, our teacher posed the question to us How do u create a user account without using GUI or command? We are currently running Knoppix version of Unix and for the life of me I can't figure out how this is possible.... (0 Replies)
Discussion started by: Redditt90kg
0 Replies

4. Shell Programming and Scripting

Creating user accounts

Hi, I have written a program using shell scripting. When you run the file it will asks you to enter the user name, if the user exists it says " user exists " if not it will displays like " user doesnt exist" and then asks you like " do you want to add user with options Yes or No " if you say... (1 Reply)
Discussion started by: vishwaprasad
1 Replies

5. UNIX for Dummies Questions & Answers

single user mode - user accounts passwords

hello ppl, someone must be able to help with this --> I have an old NCR tower 32 with an ADDS terminal running a unix version 020102 (Im not sure if thats correct but its unix for sure). I have no user names and no passwords and need to login to read a tape. Is there any way to do that? I hear... (3 Replies)
Discussion started by: orestis
3 Replies

6. UNIX for Dummies Questions & Answers

Difference between : Locked User Account & Disabled User Accounts in Linux ?

Thanks AVKlinux (3 Replies)
Discussion started by: avklinux
3 Replies

7. Solaris

Help with user accounts

Hi All, How to know all the shells a user has access. Thank you . (0 Replies)
Discussion started by: rama krishna
0 Replies

8. Solaris

Solaris User Accounts

Hi, Can you please tell me how to know the number of user account limit in solrise 5 version.Is there any cmd to see how many max user acc can be created. Thanks in advance (2 Replies)
Discussion started by: kkalyan
2 Replies

9. OS X (Apple)

Thunderbird user accounts

Hi All I am trying to find a way to set-up a thunderbird account by using a script, i have been trying to to add the lines into the pref.js file but it keeps getting overwritten any help would be great thanks Adam (0 Replies)
Discussion started by: ab52
0 Replies
CHECKBASHISMS(1)					      General Commands Manual						  CHECKBASHISMS(1)

NAME
checkbashisms - check for bashisms in /bin/sh scripts SYNOPSIS
checkbashisms script ... checkbashisms --help|--version DESCRIPTION
checkbashisms, based on one of the checks from the lintian system, performs basic checks on /bin/sh shell scripts for the possible presence of bashisms. It takes the names of the shell scripts on the command line, and outputs warnings if possible bashisms are detected. Note that the definition of a bashism in this context roughly equates to "a shell feature that is not required to be supported by POSIX"; this means that some issues flagged may be permitted under optional sections of POSIX, such as XSI or User Portability. In cases where POSIX and Debian Policy disagree, checkbashisms by default allows extensions permitted by Policy but may also provide options for stricter checking. OPTIONS
--help, -h Show a summary of options. --newline, -n Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.) --posix, -p Check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (implies -n). --force, -f Force each script to be checked, even if it would normally not be (for instance, it has a bash or non POSIX shell shebang or appears to be a shell wrapper). --extra, -x Highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false posi- tive which may be ignored. For example, the use of "$BASH_ENV" may be preceded by checking whether "$BASH" is set. --version, -v Show version and copyright information. EXIT VALUES
The exit value will be 0 if no possible bashisms or other problems were detected. Otherwise it will be the sum of the following error val- ues: 1 A possible bashism was detected. 2 A file was skipped for some reason, for example, because it was unreadable or not found. The warning message will give details. SEE ALSO
lintian(1). AUTHOR
checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities CHECKBASHISMS(1)
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy