Adding Multiple Users to FreeNAS Part 1

1. Figure out what the account names and passwords are going to be. For this example, I’m just going to create a bunch of student accounts, with lame passwords, based on colors, viz…

Student01 – Blue
Student02 – Orange
Student03 – Green
Student04 – Brown
Student05 – Gray
Student06 – Red
Student07 – Black


2. Using a terminal program, Log into the FreeNas server using the SSH service. (Make sure SSH has been started on the FreeNas server, via the Services tab.) Using the Mac’s terminal program, you can login with the following command:

ssh 192.168.xx.xx -l root

In Windows, use the free PUTTY program, which has provisions for using SSH to log in.

3. Once you are in, change the directory to your shared student volume.

cd /mnt/StudentData

4. Now you need to use a text editor to create a couple of files. The first file is a list of the user accounts.

nano userlist.txt

Add the account names, one per line.


Save this file.

5. Now create a shell batch file which creates all of the student folders.


#! /bin/sh

while read username
echo $username
mkdir $username

Save this file as

6. Flag the batch file as executable
chmod 755

7. Now you can run this shell script, using the file of user names for input.

./ <userlist.txt

This will output a list of names of each user. As long as you don’t see anything weird, the folders will also have been created. You can check by simply doing a directory listing.


This should show all of the folders.

8 Finally, you’ll need to create one more shell script, which we’ll use after we’ve added the user accounts to FreeNas.


#! /bin/sh
while read username
echo $username
chmod 711 /mnt/StudentData/$username
chown $username /mnt/StudentData/$username

Save this, and again, change the file permissions on it to allow it to be executable.

chmod 755

Obviously, creating these two shell scripts is a one-time thing… we’ll reuse them any time we add new folders.

Now, having created your student folders, you can go back into the FreeNas web interface, and actually create the user accounts. When doing this, you assign the “home directory” for the account to the folder that you’ve just created. (See Part 2)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s