[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Add User via CRON and FTP
- Subject: Re: [cobalt-users] Add User via CRON and FTP
- From: "Steve Werby" <steve-lists@xxxxxxxxxxxx>
- Date: Tue Jun 19 21:29:56 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
"RSA Computer Consulting" <helpdesk@xxxxxxxxx> wrote:
> Is it possible to add user accounts by uploading txt file via ftp and
> running a CRON job to process the txt file via a cgi script that adds the
> information from the txt file to the password file. It does not have to
> show up in the gui?
Are you asking if it has to show up or stating that it's not important to
you if it does? If it's not important, create the users with the system
command "useradd". Using your favorite language (bash shell programming
will do the trick if you know how to program in bash, otherwise perl, php
standalone, python, etc.) create a program to loop through each line of the
text file, check whether the user is present in /etc/passwd, if it's not
present run useradd pulling the options from the line in your text file
being parsed. At the end of the program have it delete the text file so it
doesn't get processed again (if coded right won't matter anyway since it
will check for each user before trying to add it).
Here's some pseudo-code to get you started:
#!/bin/sh
for LINE in /full_path_to/my_text_file
do
USERNAME = cut -options_to_get_username_from_text_file
OTHERVARS = cut ...
if ! grep contains $USERNAME
then
useradd $USERNAME other_parameters
fi
done
rm my_text_file
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/