Add Multiple Users to Moodle when using PAM Authentication
PAM authentication in Moodle allows Moodle users to login with the username/password for their account on the hosting server. That is, if students have Linux accounts on a server and Moodle is installed on that same server, the users can login to Moodle using their Linux account information. The Moodle account is linked to the Linux account - the students don't need two separate accounts/passwords.
Below are my notes on how to add multiple users to Moodle when using PAM authentication. This was done in Moodle 2.2.3 (Build: 20120514) and is performed when logged in as the admin user.
Create a CSV text file (e.g. as an OpenOffice or Excel spreadsheet) with the first row containing field names and subsequent rows the user information. An easy way to get such a file is to export existing users. Go to:
Site Administration -> Users -> Accounts -> Bulk User Actions
Select one or more existing users and then "With Selected Users" Download. This will allow you to download a text file, which is in fact CSV.
You can then save and edit this file, adding/removing fields (columns) as necessary. From the downloaded file its important to delete the id column and add a auth column. The id is automatically generated by Moodle (note this is the Moodle ID of the user, not the students ID within the institution - there is another column for that called idnumber). The auth column must contain the value PAM. Note also there there is no password column (because the users password comes from the server not Moodle).
Some common fields have been discussed on the Moodle forums. You can add the users to a particular course using the course1 field, where the value is the short name of the course. The format I used was:
username, email, firstname, lastname, city, country, auth, course1, group1 u12345, firstname.lastname@example.org, Steven, Gordon, Bangkadi, TH, pam, ITS323Y12S1, CS Section
The file needs to be saved as comma separated text, i.e. CSV. In my case when using OpenOffice when I save the file I select CSV and check the option to Edit Filter Settings:
Make sure the Field delimiter is a comma (,) and the Text delimiter is empty.
After adding your new students to the CSV file and saving it, go to:
Site Administration -> Users -> Accounts -> Upload Users
and upload the file.
You get to preview the first 10 rows to check the format and information is correct:
You can select how to treat new/existing users. Then upload and your Moodle users should be created and added to the course (if you used the course1 column in the CSV file).
Created on Tue, 26 Jun 2012, 12:23pm
Last changed on Fri, 06 Jul 2012, 3:34pm