# User administration

This chapter should help you with the administration of your moregroupware installation and explains the tools available for administrators in the admin module.

## Create new users from a file

Make a CSV file (e. g. `users.csv`) with your favourite text editor with the following fields and structure:

        "username","last name","first name","occupation","workplace","birthday","gender","mobile","phone","email","password"

Make one line for each user. Use a line feed between each user. If you use Word or another word processing tool you must be sure that you save the file in plain text without any formatting. The quotes around the fields are important. User names may only contain alphanumeric characters (A-Z, a-z, 0-9).

Start moregroupware as admin, go to the admin module and enter the user manager. Start the import with the choice "Create new users (from file)".

You will see a form with three input fields. With the file input locate and select your created CSV file. Additionally you can set defaults for language and group the new users shall have. A click on the submit button starts the import process.

# Common user complaints

This chapter will give answers that come in handy for common things users (not) want to have when working with moregroupware.

## Session timeout

If you leave your computer for a while logged in into moregroupware you can "loose the connection" and you must do a new login. This is caused by the session becoming too old. To get rid of the session timeout problem you can open `php.ini` in a text editor and search for:

          session.gc_maxlifetime = 1440

The default setting is set to 1440 seconds for the timeout (automatically removing of the stored session after 24 minutes).

If you increase the value, save the changed file and restart the web server the problem shall be solved or at least reduced.

This has (of course) a drawback: the longer the session "lives" without user activity, the greater the danger of intrusion is. If you leave your computer unattended, and some other person can use your login, this may cause trouble. Keep this in mind when changing this setting (or educate your users to always log out when leaving the computer). This mostly applies to "untrusted environments", of course.

# Backing up your more.groupware data

Backups are tedious. Especially since we have no backup module yet. But believe me, a backup can save you day, so you should really think about it.

## Backup of your MySQL database

One way to do a manually backup from the command prompt will be described below.

Agraphical web based tool to help you with the tasks described in this section is phpMyAdmin which can be downloaded from http://www.phpmyadmin.net/

Start a terminal session (Linux) or command prompt (Windows) and enter the following command:

`mysqldump --add-drop-table -a -u username -p database > path/to/backup.sql`

You must replace `username` with the name of a user that can read the tables in the `database` you use for more.groupware. `path/to/backup.sql` is the path and name to the file that will be written during backup, e. g. `C:\backup\mgwbackup.sql`.

If you get `bad command` or something like that you have to use `cd` to go to the MySQL bin system folder (e. g. `cd C:\mysql\bin`) before you run the command again.

After entering the command you have to press the enter key. Input the MySQL password of the user `username` and press enter yet another time. The backup will be dumped to the given file.

Now you have a backup of the database which can be stored at a safe place. But you should also make a copy of the whole moregroupware folder (`cp -R mgwfolder backupfolder` if you use Linux or the graphical Explorer if you use Windows).

You must do a folder copy to get a backup of your emails which are stored in `modules\webmail2\store`, the contents of the files module and the configuration file called `config.inc.php`.

## Restore of your MySQL database

A backup only makes sense if you can actually restore it. So you should try this at least once before a desaster, to make sure it all works as expected!

Agraphical web based tool to help you with the tasks described in this section is phpMyAdmin which can be downloaded from http://www.phpmyadmin.net/

1. Configure your computer with the same Apache and MySQL settings as before the 'computer crash'.

2. Copy your mgw folder backup back to the same place your old installation was placed in.

3. Run this to create an empty database:

   `mysql -u username -p -e 'CREATE DATABASE database'`

   Use the same `database` name as the old database had. Replace `username` with the name of a user that can create a database.

4. Restore the data with the command:

   `mysql -u username -p database < path/to/backup.sql`

   You must replace `username` with the name of a user that can create tables in the `database` you use just created. `path/to/backup.sql` is the path and name to the file that was written during backup, e. g. `C:\backup\mgwbackup.sql`. After entering the command you have to press enter. Insert the MySQL password and press enter yet another time. The database will be restored with all the information from the backup file.

Hopefully you can log into Moregroupware now without any data loss!