From owner-freebsd-questions@FreeBSD.ORG Sun Sep 13 19:38:02 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E1EF106566C for ; Sun, 13 Sep 2009 19:38:02 +0000 (UTC) (envelope-from miklosovic.freebsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id D68518FC12 for ; Sun, 13 Sep 2009 19:38:01 +0000 (UTC) Received: by bwz2 with SMTP id 2so1595965bwz.43 for ; Sun, 13 Sep 2009 12:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=gS+IVCW9UW+VZKJNYHgwhEe1D2yeXHic9pxvQ/P+6TI=; b=HmSVibZ7lRhcMjEmaWFl3y69HRTVdRV5gGk7PNEhPR7JnQqaQlmWEZyXQLY23woz4U TYhtZM5QQvLTVoWKjY5+/1AT0apBKHeP+kPaaArWzM6FGwoYjAhaM4EgFtjlWmmb8z23 aU6gxOQxDB3d3Qb0cR4whaWDeNrE9gg+8cXWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=GvYrwyjn9qEN4xbpFkqhJlxxEa5dS9G4ZoWU/EEragSfwFVUSczo7XvDWZOkEze3C8 BDWTg5mrUh6rd7kmtWXylTs4vWGpUyFAYS8VidKtYRU4V/phj+oLwFIT4d/3Wr+fsZK1 vzv2u524IV7NpK4jONQaUnGiTNQ6Frx+BU4as= MIME-Version: 1.0 Received: by 10.102.165.11 with SMTP id n11mr2361671mue.5.1252870680376; Sun, 13 Sep 2009 12:38:00 -0700 (PDT) Date: Sun, 13 Sep 2009 21:38:00 +0200 Message-ID: From: Stefan Miklosovic To: freebsd-ports@freebsd.org, freebsd-questions@freebsd.org Content-Type: multipart/mixed; boundary=0016364c778fda77ab04737aafef X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: add own program to ports + help with port / program X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 19:38:02 -0000 --0016364c778fda77ab04737aafef Content-Type: text/plain; charset=ISO-8859-1 hi list, I am about writing shell script which adds system account by tens (even hundreds). Info about added accounts is stored in external file which has syntax like this account-name:comment:email-addres Briefly, account-name is name of account comment field is comment which appears in /etc/passwd comment field email-address is address where info about just created account is sent (optional) eg. joe:Joe Brown:joe@something.com mark:Mark Red:mark@nowhere.org tim:Tim Yellow:timmy@example.com Script is checking file syntax and if syntax is bad, it exits. If it is ok, accounts is being created. You can modify a lot of infos, these are stored in config file in /usr/local/etc/pwgroup.conf, eg # output file with passwords of newly # created user accounts PASSWD_FILE="passwords" # uid of first created user UID="2000" # root home dir of users HOME_DIR="/home" # comment for users, appears in /etc/passwd # in comment field COMMENT="" # primary group for users, if empty, # primary group will be a user name GROUP="users" # comma separated list of groups # users should be a member of GROUPLIST="" # shell for users SHELL="/bin/csh" # use quotas QUOTAS="NO" # hard quote limit QUOTA_HARD="1536" # soft quote limit QUOTA_SOFT="1024" # disk device upon which users are created DISK_DEV="/home" # expiration date of accounts ACCOUNT_EXP="30-Jun-2010" # length of password PASSWORD_LENGTH="8" ========== as you can see, you can set quotas for users, account expiration of accounts, password length, shell and so on. Variables in config file are default, if you do not overwrite some at command line. some examples: # pwgrp -a -f users -c "unix begginer" -s /usr/local/bin/bash -q -qh 2048 -l 10 (adding users) # pwgrp -r -f remove_users (list of users for removing) Password are generated by apg program Quotas are set by setquotas. The main reason I write this mail is to make some feedback about program to me and even test it and comment it. I want to write this program but I do not know if I do it correct and I need some feedback about programming style or just some info what do you think about it. At this time, there is absence of manual, but if you track code, I think you understand it. Any ideas are highly appreciated. --0016364c778fda77ab04737aafef--