Difference between revisions of "Lazy Admin Tools"

From SME Server
Jump to navigationJump to search
Line 87: Line 87:
 
  read -p "set the password                        : " password
 
  read -p "set the password                        : " password
 
   
 
   
  read -p "set the first group                      : " groupe1
+
  read -p "set the first group                      : " group1
 
   
 
   
  read -p "set the second group                    : " groupe2
+
  read -p "set the second group                    : " group2
 
   
 
   
 
  read -p "set the Limit with grace period (M or G) : " quota1
 
  read -p "set the Limit with grace period (M or G) : " quota1
Line 95: Line 95:
 
  read -p "set the Absolute limit          (M or G) : " quota2
 
  read -p "set the Absolute limit          (M or G) : " quota2
 
   
 
   
  lat-users -a -c "$login|$firstname|$lastname|$password|||||||||$groupe1|$groupe2"
+
  lat-users -a -c "$login|$firstname|$lastname|$password|||||||||$group1|$group2"
 
  lat-quota -c "$login|$quota1|$quota2"
 
  lat-quota -c "$login|$quota1|$quota2"
 
   
 
   
Line 101: Line 101:
 
   
 
   
 
  /usr/bin/script-lazy
 
  /usr/bin/script-lazy
 +
 +
Or this one if you want to have some default values.
 +
 +
#!/bin/bash
 +
 +
read -p "set the  login (mandatory field)        : " login
 +
 +
read -p "set the firstname (mandatory field)      : " firstname
 +
 +
read -p "set the lastname (mandatory field)      : " lastname
 +
 +
read -p "set the password                        : " password
 +
 +
group1='bpa_tap_adultes'
 +
group2='eleves'
 +
quota1='150M'
 +
quota2='152M'
 +
 +
lat-users -a -c "$login|$firstname|$lastname|$password|||||||||$group1|$group2"
 +
lat-quota -c "$login|$quota1|$quota2"
 +
 +
read -p "Do you want to launch it again, then type enter, else ctrl+c: "
 +
 +
/usr/bin/script-lazy
 +
 +
Then
  
 
  chmod 755 script-lazy
 
  chmod 755 script-lazy

Revision as of 22:59, 7 October 2013

Description

The Lazy Administrator's Tools is a set of scripts designed to automate batch tasks and administration jobs for SME servers. Currently the following tools are available:

Important.png Note:
This HowTo is based on a version created for SME 5.5/5.6/6.0 by Michiel Blotwijk. A new version for sme7.x has been created by J Bennett and is the rpm referred to in the Installation section below. For the SME Server 8.0 all binaries are in smecontribs.

The original version information can be found here


Available functions

Command Description
lat-users on wiki documentation add/delete users (and their directories)
lat-groups on wiki documentation add/delete groups
lat-pseudonyms on wiki documentation add/delete e-mail pseudonyms for individual users
lat-ibays on wiki documentation add/delete ibays (and its directories)
lat-quota on wiki documentation set the disk quota for individual users
lat-procmail on wiki documentation activate or deactivate procmail for individual users
lat-hosts on wiki documentation add hostnames to the server
lat-pptp on wiki documentation activate or deactivate pptp access for individualusers
lat-domains on wiki documentation create virtual domains
lat-dump on wiki documentation create input files for the above, using the configuration files of the SME servers.
lat-shadow on wiki documentation transfer crypted password from a SME Server to another


Warning.png Warning:
SME Server 7.x supports the use of '@' in pseudonyms, but lat-pseudonym does not by default. See this forum post for a work-around.


Installation

Smecontribs repository for SME Server 8.0

yum install --enablerepo=smecontribs smeserver-lazy_admin_tools smeserver-userpanel smeserver-mailsorting
signal-event post-upgrade; signal-event reboot

Upgrade notes

1. If you are upgrading from a version prior to 0.7.0-1, don't forget to remove manually the old scripts. Yum will not be able to find and remove them for you.

2. As from version 0.7.0-1 the arguments for lat-groups have changed. Please refer to 'man lat-groups' or to the examples in /usr/doc/lazy-admin-tools for the new format.

Usage

Each tool has its own comprehensive man page. See `man lazy-admin-tools` for an overview of the tools that have been installed.

All tools follow the same concept:

1. Arguments can be specified on the command line (--command-line), or in a file (--input-file) for batch processing.

2. If the arguments are specified on the command line, the arguments must be between quotes (e.g. -c="foo | bar | baz")

3. Most tools recognize the wildcards * and ? in the first argument (e.g -c="foo* | bar | baz").

4. See the various examples in /usr/doc/lazy-admin-tools for the format of the input file.

Easy Scripting

The purpose is to made an easy and quick script to play with the lazzy admin tools when you want to add a user

nano script-lazy


#!/bin/bash

read -p "set the  login (mandatory field)         : " login

read -p "set the firstname (mandatory field)      : " firstname

read -p "set the lastname (mandatory field)       : " lastname

read -p "set the password                         : " password

read -p "set the first group                      : " group1

read -p "set the second group                     : " group2

read -p "set the Limit with grace period (M or G) : " quota1

read -p "set the Absolute limit          (M or G) : " quota2

lat-users -a -c "$login|$firstname|$lastname|$password|||||||||$group1|$group2"
lat-quota -c "$login|$quota1|$quota2"

read -p "Do you want to launch it again, then type enter, else ctrl+c: "

/usr/bin/script-lazy

Or this one if you want to have some default values.

#!/bin/bash

read -p "set the  login (mandatory field)         : " login

read -p "set the firstname (mandatory field)      : " firstname

read -p "set the lastname (mandatory field)       : " lastname

read -p "set the password                         : " password

group1='bpa_tap_adultes'
group2='eleves'
quota1='150M'
quota2='152M'

lat-users -a -c "$login|$firstname|$lastname|$password|||||||||$group1|$group2"
lat-quota -c "$login|$quota1|$quota2"

read -p "Do you want to launch it again, then type enter, else ctrl+c: "

/usr/bin/script-lazy

Then

chmod 755 script-lazy
mv script-lazy /usr/bin

to launch the script then do

script-lazy

As you can see this is a quick example of what you can do with this contribs, you can take this as an example for all your needs.

Forum References


Known issues

Large user database

it has been reported that large user imports might be really long ( 60s per user in SME server already containing 4000 users) (see bugzilla:7545). This script is using sme internal processing. The purpose of doing so is to do everything that is included by other contribs.

S95ldap-update-simple is called with user-modify user-create, group-modify and group-create events. S56update-domain-group-maps is called with the same events. These events allow also the full creation of the user, but have the adverse effect to be really long during large user importation.

A workaround to avoid this could be to: - disable ldap in the db configuration during the import (if you have not enable ldap auth) - or temporally remove the link inside the events to this two scripts and create them back after import.

and revert back theses change after importation and then running the signal event once (user-modify)


Man page are not up to date

Some update is needed for lat-users, lat-procmail and lat-shadow. First is missing -n option, second is stating -a option that in fact does not exist, and third is not working. see Bugzilla:7702

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the e-smith-lazy_admin_tools component or use this link .