How to build the Ultimate Linux Home Server - Part 3 - Adding Users, Configuring SMB and NFS
July 19th, 2008
Today’s section, Part 3 of How to build the Ultimate Linux Home Server, is on adding users to OpenSUSE via the command line and configuring Samba for sharing files. I’ve decided to do the guide on how to add users the old fashion way mainly because it’s faster and easier to do it via the terminal, and I’ve done it many, many times.
Adding users is crucial to having Samba working. Since we aren’t running an LDAP or NIS server, we are using local authentication on the Linux server to allow access to the shares.
If you missed a section of How to build the Ultimate Linux Home Server, you can view them here: Part 1, Part 2, Part 4, Part 5
Adding Users via terminal
To open the terminal, you can right click on the desktop and click Open in Terminal. Now, you will want to be the super user, aka root. I’ve gone and SSH’d into the box from my Macbook Pro to make it easier to get nicer screenshots. Type sudo su to sudo the substitute user command.
Now you are the root user, and with great power comes great responsibility. If you aren’t careful as the root user, you can kill your machine with 1 typo. I’ve accidentally typed (Don’t type this by the way) mv / ../ while I was logged in as root, I was trying to move all of the files in one folder down a directory, but what I had typed moved everything on the drive into that directory. It’s very dangerous to be moving files or executing any commands that could damage your system as root. You’ve been warned!
Ok, so now that you are logged in as root. You’ve read the warning above. Now we will be adding our users. Adding users takes a bit of planning, and fortunately since we are just adding home user’s, their won’t be many users and groups.
I’ve gone ahead and already arranged the users into groups. I have two groups, adults and children. To add these groups, you will execute the commands groupadd adults and groupadd children at the terminal.
Now since we have the two groups we need, we can add users. Since you’ve already made 1 user while installing, you can add yourself to whichever group you want to by typing usermod -G groupname,users username For example, I did usermod -G adults,users shawn. We need add the users group to stay in the users group. To add new users, you type useradd -G groupname,users username again adding users as one of the groups so that all users are included in the group. I’ve gone ahead and added two new users, kid1 and kid2.
We need to give these users that we have created passwords, all you need to do is type passwd username and it will give that user a password.
Now that we have our users that will be using the home server set up, we can proceed onto Samba and NFS file sharing.
Setting up Samba File Sharing for Windows
Samba is the protocol that Windows uses to share files over a network. Of course Linux and Mac OS X support it, since it is widely used.
To start the setup, open the YaST Control Center, and open Samba Server.
[singlepic=58,320,240,,]
For the domain, you will be using the domain you’ve used. I used network.home and will be using that.
[singlepic=59,320,240,,]
Since we are not a Domain Controller, you can go ahead and click Not a Domain Controller, then click next.
[singlepic=60,320,240,,]
We will want the service to start During Boot and to open the port in the firewall, then click on the shares tab.
[singlepic=61,320,240,,]
OpenSUSE has already gone ahead and populated the available shares with some commonly used ones, you can choose to keep them if you want. I’ve gone ahead and made some new directories that I will be sharing, I made a directory at /shares which contains all of the Samba shares that we will be using. Click add to make a new share.
[singlepic=62,320,240,,]
Here you enter your shares name, description, and the location of the folder you want to share. You want it to Inherit ACLs so that it will take the folders permission, which you will need to set.
If you want to give a user their own private share, you will need to make a directory for them, then type chown username:groupname /shared/personaldir in a terminal window. Then you will need to modify the permissions using chmod 700 /shared/personaldir. Sharing that directory through the SMB guide will automatically set the proper permissions so that that user will. If you want to learn more about linux permissions, there are many available on the net.
Setting up NFS
Since someone has asked me to include a guide on how to set up NFS, I’ve gone ahead and created the how to below. Please note that if you are using Windows, you probably won’t be using NFS since it is primarily for linux and unix
To set up NFS, you will need to install yast2-nfs-server, yast2-nfs-common, nfs-kernel-server, limal-nfs-server, and limal-nfs-server-perl. Once installed, open NFS server in YaST.
[singlepic=63,320,240,,]
In the NFS Server Configuration tool, you will want to Start NFS, Open the Port in the Firewall, and Enable NFSv4 and enter your domain name (such as network.home)
[singlepic=64,320,240,,]
This is where the directories we want to export (share). Click Add Directory.
[singlepic=65,320,240,,]
You then select the Directory you would like to export, then click ok.
[singlepic=66,320,240,,]
This is where you can set up the sharing options. By default the folders are set to read only, in the options line, its the first two characters “ro” for read only. If you want to make the NFS Directories read and writable, you can change the first two characters to rw. For the host wild card, you can allow only certain IP address ranges. Then click OK and repeat for all of the folders you want to add. Once you are done, you can click finish and NFS will be running and sharing all of those folders. There you have it!
Continue on to Part 4 here: Part 4
Like my articles and how to’s? Have a request? You can buy me a cup of joe or some music to listen to by donating! Donate via paypal or iTunes Gift Certificate to shawn@32packets.com



July 19th, 2008 at 10:39 pm
[...] Daily Twitter Updates for 2008-07-16 How to build the Ultimate Linux Home Server - Part 3 - Adding Users, Configuring SMB [...]
July 19th, 2008 at 10:41 pm
[...] Part 3: Click Here [...]
July 23rd, 2008 at 3:18 pm
[...] a section of How to build the Ultimate Linux Home Server, you can view them here. Part 1, Part 2, Part 3 Part 4 of the guide is after the [...]
August 1st, 2008 at 7:52 pm
[...] a section of How to build the Ultimate Linux Home Server, you can view them here: Part 1, Part 2, Part 3, and Part [...]