Post
Share your knowledge.
Create a NAS with Your FxBlox — How to install Samba: A Beginners Guide
Big shout-out to Fierro Labs for this awesome tutorial!
It is time to upgrade our FxBlox to something we can actually use! I will show you how to install Samba in just 3 easy steps! We are in search of the best way to set up our Blox as a NAS while the FULA testnet is still under development.
This beginner friendly tutorial will allow us to add, remove, and edit files on the Blox all while accessing them on Windows, Mac, or other Linux computers! We are introducing many more Linux fundamentals in this tutorial, but don’t worry I will explain new things thoroughly.
“Released in 1992, Samba is an open source implementation of the SMB protocol for Unix systems and Linux distributions. The server supports file sharing and print services, authentication and authorization, name resolution, and service announcements (browsing) between Linux/Unix servers and Windows clients.” (Sheldon, Robert & Scarpati, Jessica. “Server Message Block protocol (SMB protocol)”. TechTarget. August 2021). Since SMB was introduced in the 1980’s, Windows, MacOS, & Linux have supported the SMB protocol to access SMB-enabled remote files servers.
In this tutorial you will learn how to:
- Factory reset your FxBlox device
- Attach a Keyboard, Video, and Mouse
- Update the FxBlox’s Linux OS
- Install Samba through armbian-config
- Configure Samba on Linux
- Manage and check Samba status
- View files hosted in Samba, on Windows and OSX
Preface
Okay I might have embelished the intro. It is going to take more than just three “easy” steps to set up Samba. But I will hold your hand through it.
This tutorial will use ssh
. If you want a quick refresher on how that works, check out my last tutorial Create a NAS with Your FxBlox: A Beginner’s Guide Series | by Fierro Labs | Sep, 2023 | Medium.
If you want to continue the tutorial using a KVM, then get a mouse and keyboard combo that uses a wireless receiver (I don’t recommend bluetooth). A usb-c to usb-a adapter to connect it and a usb-c to HDMI dongle/cable (usb-c to DisplayPort also works).
To factory reset your device, you will also need a usb-c cable that connects to your flash drive. Multi-port dongles/adapters will not work with the Blox.
If you do not have any of the above, please consider supporting me by using my amazon affiliate links to order your accessories. Thank you!
- Usb-c to Usb-a female adapter
- Usb-c to HDMI female adapter or Usb-c to HDMI male cable
- Logitech Wireless Keyboard and Mouse combo
*Disclosure: As an Amazon Associate I earn from qualifying purchases. * Here is the default login information for the FxBlox:
Username: pi
Password: raspberry
Hostname: fulatower
Attach Keyboard, Video, & Mouse
If you want to continue with the tutorial while interacting with the Blox directly. Then you’ll need the aforementioned cables or adapters. To connect keyboard and mouse, you could connect one to the top usb-c port and the other to the middle one. But I say just get a wireless combo, so you only take up one port.
The two bottom usb ports both support DisplayPort which allow you to connect HDMI cable/adapter. Login with the default password, and press Ctrl+Alt+T to bring up the Terminal. Or look for it in the Applications, by clicking on “Activities” on the top left, then the box of nine dots at the bottom.
Factory Reset FxBlox
I think it is worthwhile to know how to factory reset your device, in case you mess something up or just want to start with a clean slate. Keep in mind, you will have to set up the device through the Blox app again.
Factory resetting is possible by flashing the FxBlox with the Fula image provided by Functionland (Releases · functionland/fula-ota (github.com)) with a USB attached to the top usb-c port.
- Make sure your USB drive is formatted to FAT32.
- You’re going to want to download the latest version. At the time of this writing it is v1.1.5 (specifically RK1-EMMC-27–08–2023.5G_usb_flash_update.zip) and move it to your flash drive.
- Unzip the contents and move over all the files to the root directory of the USB drive. So that there are no folders at the root of the USB drive.
- Feel free to connect the USB drive now or after you’ve unplugged your Blox. But make sure it is ONLY to the TOP most usb-c port!
- Now, with the usb drive connected. Turn on your Blox, and the light should turn green, then turn yellow. This yellow light will stay on for about 10–15 minutes, indicating that it is applying the update/reset.
- You will know it is done when the lights alternate between Green and Blue every couple seconds. Now you can remove the usb from the tower and turn it off and on again.
- The Blox may or may not restart on its own once or twice. Keep an eye out for that and then you can continue to set up the device through the Blox app.
*Note 1: After completing setup through the app, you may need to turn off and on the device at the end, for it to be discoverable. You don’t actually have to get a “Setup Complete” screen for it to connect to the wifi (in my experience)!
Note 2: In my testing, I found setting up through the Blox app was the only way for the FxBlox to retain the wifi information. That is why I recommend it over just going straight to the desktop with KVM.
Note 3: There needed to be an updated image of the Blox, because at the time of launch, the WalletConnect service reworked their API without telling anyone and it messed things up for owners to say the least. Hence the one-off “…_usb_flash_update” image options. Generally, you will just download the source zip folder and follow the same process.*
Update the FxBlox’s Linux OS
If you are NOT already logged into the FxBlox via ssh or connected directly to it, then we will do so now:
ssh pi@fulatower
If ‘fulatower’ doesn’t work, use the IP Address of the Blox instead. You can find this under the “Blox Discovery” tab in the Blox app Settings. Or your wifi router’s “Connected Devices” list.
To update your FxBlox type:
sudo apt update && sudo apt upgrade
This will download and install all the components needed to get you up-to-date with the latest Ubuntu release that Blox runs. Now reboot device to apply changes:
reboot
Now, you can ssh back into the device.
Configure the Samba Server on Linux — Part 1 — Create the Share Directories
FINALLY, we are ready! Let me lay out the idea of what we are going to do. We are going to create a file sharing server and only permit authorized users access to write to it. Specifically, we are going to give each individual user a space on the Samba server called a “share” and a “public” space for all authorized users to write to.
Before we can start, we have to decide where on our Blox we want to create the space for the Samba server. If you’re like me, you want to actually utilize the hard drive you installed into your Blox.
My drive is located at /media/pi/nvme0n1p1
, you can find yours by typing:
df -h
You’ll know which one is yours from the capacity of the drive and the “Filesystem” should start with /dev/. As well as the fact that the type of drive installed will be shown. E.g. I installed an nvme drive and you can see nvme in the path.
Note 4: when you factory reset your device, this storage drive won’t get reformatted even after doing the setup process through the Blox app.
So we’ll start by creating the space for our Samba server and all authorized users. In my case, I am authorizing pi
and fierro_labs
.
IMPORTANT: Substitute the location of your drive in the commands!
mkdir /media/pi/nvme0n1p1/FulaShare/
mkdir /media/pi/nvme0n1p1/FulaShare/Public
mkdir /media/pi/nvme0n1p1/FulaShare/pi
mkdir /media/pi/nvme0n1p1/FulaShare/fierro_labs
Now verify they were created by navigating to that directory and listing its contents:
cd /media/pi/nvme0n1p1/FulaShare && ls
Configure the Samba Server on Linux — Part 2 — Install Samba with armbian-config
If you don’t know what armbian-config
is, you’re not alone. I recently just learned about it. Shoutout @Fred from the Functionland Telegram channel. It is a tool to configure your armbian-based SBC (Single Board Computer) with a graphical user interface (GUI). You can do various things including: setting up remote desktop control, installing third party software like Samba, and adjusting other system settings.
To access armbian-config
, you NEED to have your system up-to-date. To access the GUI type:
sudo armbian-config
You can then use your mouse to:
- Select Software
- Select Softy
- Select Samba and let it finish installing
It will now ask you for a Samba username and password. Create one for pi. We’ll make another account after setup.
Now we can move on to creating the public share for all users in the workgroup AND each individual users’ share. Use the arrow keys to get to the very end of the file. Copy/paste this into your terminal on a new line or just type it out:
[Public]
comment = Public directory where all users of the workgroup can read/write
browseable = yes
writeable = yes
guest ok = no
force create mode = 0770
force directory mode = 0770
path = /media/pi/nvme0n1p1/FulaShare/Public
valid users = @workgroup
[homes]
comment = Home directories where only the authorized user can read/write
browseable = no
writeable = yes
public = no
create mode = 0700
directory mode = 0700
path = /media/pi/nvme0n1p1/FulaShare/%S
valid users = %S
Remember to replace the path to where you want to store the users' files in your case! Click on “OK” and exit all the way out of armbian-config
until you see your Terminal again.
Here is a description of each config option’s purpose:
- [Public]. Represents the share name. This is the directory location users see on their client computer.
- [homes] is a special share definition. Samba will create shares for new authorized users “on the fly”. This definition will enable us replace [home] with the user’s username when searching for it.
- Comment. Serves as a directory description.
- browseable. This parameter allows other machines in the network to find the Samba server and Samba share when set to yes. Otherwise, users must know the exact Samba server name and type in the path to access the shared directory.
- read only. Can be ‘yes’ or ‘no’. This option specifies if users will be able to only read the share, or write to it too.
- writeable. Pretty much redundant if read only = no. Grants write access to users when set to yes.
- guest ok. Allows anyone to read/write if set to yes. Otherwise, username/password is needed to access the specified share.
- public. Is synonymous to guest ok.
- Force create mode. Forces file permissions on newly create files by the user to be what is specified here
- Force directory mode. Forces directory persmissions on newly created directories by the user to be what is specified here.
- Permission #’s: 4=read,2=write,1=execute. Therefore, 7 = read+write+execute permissions. The three digits represent permissions for: owner, group, & others respectively
- Path. Specifies the directory to use for a Samba share. The example uses a directory in Fulashare/
- valid users. Only the users or group specified can access the specified share.
- @workgroup. Is a shortcut to reference the group of Linux users who are also registered under that Group name in the Samba server.
- %S. Is a Samba shortcut to reference the username of a logged in user that is registered in the Samba server.
You can come back to edit this configuration file at any time by using an editor of your choice, mine is vim (fight me):
sudo vim /etc/samba/smb.conf
If you don’t have vim, install it with sudo apt install vim
.
Okay are you still with me? If you want to learn more about what you just did, I will applaud you if you check out Samba’s official documentation. Or more specifically the smb.conf documentation to learn how you can customize the server for your use case!
Configure Samba Server on Linux — Part 3 — Users, Groups, and Permissions
The last step to get this to work is to register our users in the Samba server to have a login password. I know so far this has been a heavy lift, but the result will be sweet. I explain a little bit of what each command does, but if you want to learn more, I encourage you to Google the name of the command. Ex: “useradd linux command” or “smbpasswd linux command”.
To register users for a Samba account on your server, the general syntax is sudo. smbpasswd -a <username>
. Samba accounts can only be made for already existing users on your Blox. And the password doesn’t have to be the same as the one used to log into the Blox.
To make a new user account on your Blox AND register it in your Samba server, run all three commands. If you want to create an account in Samba without giving a user a login to your Blox, omit the second command:
sudo useradd fierro_labs
sudo passwd fierro_labs
sudo smbpasswd -a fierro_labs
If you ever want to change the Samba password just use: sudo smbpasswd <username>
.
If you ever want to change the Linux password just use: sudo passwd <username>
.
Now, we want to create a group called workgroup
for all our users in Linux. This is necessary to give all authorized users access to the Public space on our Samba server. To add users to the group called workgroup
, we first have to create the group:
sudo groupadd workgroup
To add a user to the group:
sudo usermod -aG workgroup pi
sudo usermod -aG workgroup fierro_labs
Setting permissions is what is going to make or break if you can connect to your local Samba server from another computer. At this point you should still be in the /media/pi/nvme0n1o1/FulaShare
directory, if not, then do so now. To set permissions:
sudo chmod 700 pi/
sudo chmod 700 fierro_labs/
Chmod stands for change mode and it's the command to change the permissions on files and directories. The 700 number means enable read+write+execute permissions for the user only. See config options description above for more info. Lastly, let’s specify the owners of the directories.
sudo chown -R pi:workgroup pi/
sudo chown -R fierro_labs:workgroup fierro_labs/
sudo chown -R root:workgroup Public/
chown stands for change owner and it’s the command to change owner and/or group of a file or directory. Your permissions would look something like this:
Manage and Check Samba Status
We can check if our Samba server is up and running by:
sudo systemctl status smbd
Press ‘q’ to continue.
- If you see a green dot or the words “running” and “enabled”, then your server is currently running!
- If it says the service is “stopped” or “disabled”, then you will want to run
sudo systemctl start smbd
- If you ever want to stop the server, you can run
sudo systemctl stop smbd
- To reapply setting changes to
/etc/samba/smb.conf
, we will want to restart the server by runningsudo systemctl restart smbd
View files hosted in Samba, on Windows and OSX
When you log into the Samba server as a registered user, you will be able to read and write to your individual share and the public share.
IMPORTANT: It is a very annoying and difficult process to log into a different Samba account on the same computer login! For all intents and purposes, you can only log into one Samba account per client computer user!
Windows
File Explorer:
- Make sure to have “Network Discovery” on. If you go to the Network tab within File Explorer, and you DON’T have it on. A pop up header will show, asking you to turn on Network Discovery.
- Now switch to “This PC” tab, and click on the “See More”, three dots options menu.
- Click on “Map Network Drive”
- Assign it a letter of your choosing
- Type out the server hostname followed by the share you want to access. Ex \fulatower\pi
- Select the Reconnect at sign-in option
- Enter username and password of a user registered in the Samba server.
- Enjoy browsing, creating, modifying, deleting files and folders.
- Repeat the steps for adding in the Public/ share.
Windows Run:
- Press Windows + R
- Type out the server hostname followed by the share you want to access. Ex \fulatower\pi
- Enter username and password of a user registered in the Samba server.
- Enjoy browsing, creating, modifying, deleting files and folders.
- Repeat the steps for adding in the Public/ share.
MacOS/OSX
- Check to see if you have the Network tab listed on the left side in Finder.
- Fulatower should be there already, click on it and it will ask you to log in as a guest or registered user. The Guest option will only allow you to see that the Public folder exists.
- Enter username and password of a user registered in the Samba server.
- Enjoy browsing, creating, modifying, deleting files and folders.
Manual “Connect to Server”:
- While on the desktop screen (aka Finder), press Command + K.
- Enter the protocol method (smb://), then the IP address or hostname of the Blox (fulatower), followed by the share you want to access. Ex smb://fulatower/pi
- Enter username and password of a user registered in the Samba server.
- Enjoy browsing, creating, modifying, deleting files and folders.
- The server should show up under Network or Locations in Finder now.
Enjoy your new NAS!
Conclusion
Holy crap you made it! That was a long tutorial, but you pushed through. This knowledge is key fundamental IT system administration tasks and you just set up your first network share/file server from start to finish! I sure tried my best to explain everything you need to know so that you can confidently understand what the different Samba requirements and what the different options available to you are. Let me know in the comments what was the most difficult part for you?
In the next tutorial, we will be leveling up our IT sysadmin knowledge to upgrade our Blox. We will be able to access our files, photos, and any other data on our Blox from anywhere in the world! Not only that, but we’ll be able to view those files from almost literally any device!
Follow my YouTube channel for more web 3 content. Follow my Medium blog for more personal experience content and tutorials. Checkout the Functionland Telegram for support and updates. Cheers!
- Fula Network
- Blox
- BAS
- FxFiles
Functionland is replacing Cloud Storage and Service Subscription economy by introducing a new category of products, called Blockchain-Attached Storage. It creates value by auto-minting crypto for the users and allocating a share to the developers.