Configuring FreeNAS Part 2
Services
Now that you’ve installed FreeNAS on your computer and configured the drives, you’re ready to make all this space available on your network. There are several options. We will look at two of them. One is a Windows style share, and the other is FTP. Others are used in other contexts, such as NFS for UNIX or Rsync for UNIX and certain backup services.
SMB/CIFS
The way Windows shares files and directories (folders) over the network is through a protocol called Server Message Block (SMB) or its updated version Common Internet File System (CIFS). To set up Windows shares select “SMB/CIFS” under “Services”. Click the “Enable” check box. It could be as simple as that. If you have set a workgroup on your network, you should enter that name in the text box. If you changed the DNS name of your system, you should enter that name in the NetBIOS name text box.
Click on “Save and Restart”. That doesn’t reboot the NAS, it only restarts the sharing service.
Click on the “Shares” tab. To add a share, click the plus (+) sign. Provide a name for the share. You will use it to map a drive, such as \\FreeNAS\storage. For the path, there is a button to the right that has the dots “…” to be used for selecting the mapping. It will bring up a dialog box and allow you to select the drive we just formatted. In our case, it was “storage”. Click on OK and you will see something like “/mnt/storage”. Also enter a comment before you add and apply changes.
FTP
Now select FTP. As with SMB/CIFS, click the “Enable” check box. Click on “Save and Restart”. As above, it only restarts the FTP service. You can make FTP more restrictive, and therefore more secure, by checking “Local users only”. That means you have to set up a user account for access to your NAS via FTP. You can also enter a banner message if you like. This is often used to identify the FTP server or to provide additional information to the users.
Dynamic DNS
Before we go on to adding users, I want to mention another useful service. That is the ability to interact with dynamic DNS services to provide a human readable name that points back to your system if you have any need to access it from elsewhere. As you probably already know, your hosting provider assigns an IP address to you. It doesn’t stay the same, however, unless you pay extra for what’s called a static IP address. Ones that change are known as dynamic. The problem is that you don’t know when it changes. You can check the status of your router and it will tell you, but if you are at Aunt Madge’s house in another state, or even your neighbors house, you don’t have access to that information. That’s where dynamic DNS services step in. There are some you pay for, but there are others that are free. Two that are easy to use are DynamicDNS and No-IP. These are free services. You can sign up with them and select your own host name and even have a selection of domain names to pick from.
To enable Dynamic DNS on your NAS, select the appropriate menu item and click the “Enable” check box. Select your service and enter the host name you registered with them. You will also need the user ID and password you set up with the service. You can enter the update period and forced update period. I use 1800 (1/2 hour) and 86400 (1 day) respectively.
Users
If you’re running a business, setting up users and work groups can be complex, but we will do it as simply as possible. We will use an existing group and put all users into the same share. Under “Access” select “Users and Groups”. To add a user, click the plus(+) sign.
Enter a login name, the user’s full name, and password (twice). For the group, you can retain “guest” or change the selection to “staff”. For the home directory, enter the disk mount point you created above. In our case, we used “/mnt/storage”. Add and apply changes and you have your first user set up.
You can get a little fancier and provide individual folders for each user. I explain that a little further down.
Remote Access
It’s also possible to have remote shell access to your NAS. This is particularly useful if you borrowed the monitor and keyboard from your desktop machine don’t want to leave them attached to the NAS. To do so, you want to go back and edit the user ID you want to be able to use. The administrative user (root) can’t log in remotely so you’ll need to use the “su” command (it stands for switch user) when you get in to do rootly things. Root has shell access from the console but not over the network. That’s what SSHD is for. Select “SSHD” under services. By now you know the drill. Click the “Enable” check box and “Save and Restart”. Now you can log in using an ssh client. You can use a free one called PuTTY from
http://www.chiark.greenend.org.uk/~sgtatham/putty/
You will log in with your ID and password. You can temporarily become the root user by entering “su -” and entering the root password, which is the same as you set either on the console at installation time or through the GUI during configuration. If you don’t know what you’re doing, you can mess things up, so exercise caution. In order for a user to su to root, the ID has to be placed in the “wheel” group. You can set this as an additional group.
Individual Folders
One thing you might find useful is to give each user his/her own folder.
One way to do this, after you enter the su command, you can change into the storage directory, create a folder for the user and give him/her ownership as follows:
freenas:~# cd /mnt/storage
freenas:/mnt/storage# mkdir userid
freenas:/mnt/storage# chown userid userid
freenas:/mnt/storage#
Then go back to your users and set their home folder to the one you just created. It will be similar to “/mnt/storage/userid”.
The other way is to change the home folder as in the previous paragraph. Then under “Advanced/Command” execute the following two commands (substituting the desired user ID, of course):
mkdir /mnt/storage/userid
chdir /mnt/storage; chown userid useris
That’s it!
So now you are at least theoretically up and running. To make sure, we can do some testing. First, let’s test FTP. Open a Windows command prompt and enter “ftp 192.168.1.250″.
You’ll get something like:
c:\>ftp 192.168.1.250
Connected to 192.168.1.250.
220———- Welcome to Pure-FTPd [TLS] ———-
220-You are user number 1 of 5 allowed.
220-Local time is now 13:29. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 5 minutes of inactivity.
User (192.168.1.250:(none)):
Enter your user name and password and you should be in. You can enter FTP commands to see if they work. If not, go back and check your set up.
To test Windows style shares, go to your desktop and right click on “My Computer”. Select “Map Network Drives” and enter \\192.168.1.250\storage (assuming you’ve been following our setup in these posts) in the “Folder” tunnel box. If you use the same user name on the NAS, just click “Finish” and you should be good to go. If not, go back and check your set up. It could be as simple as not having saved a piece of the configuration somewhere back in the process (like not activating the SMB/CIFS service).
Congratuations! You now have a solid Network Attached Storage solution. There’s a lot more as you undoubtedly figured out from the number of items on the side menu we didn’t even mention here.