Samba Server¶
This tutorial describes how to enable simple file sharing on a system running Clear Linux* OS and how to access the share from clients on other operating systems.
Prerequisites¶
Clear Linux OS is installed on your host system.
For detailed instructions, follow one of these guides:
Desktop version: Install Clear Linux* OS from the live desktop
Server version: Install Clear Linux* OS from the live server
Update your Clear Linux OS system to the latest version.
sudo swupd update
Set up file sharing¶
Add the samba bundle, which includes the Samba binaries.
sudo swupd bundle-add samba
Create the
/etc/samba
directory.sudo mkdir /etc/samba
Create a configuration file named
/etc/samba/smb.conf
. In this simple example,[SharedDrive]
enables a folder share located in/home/clear/mysharedrive
granting users samba-user-1 and samba-user-2 access.If
valid users
is not specified, then anyone with a user account on the machine and with their Samba password already set can access the folder. However, the account is only able to access files and folders for which they have appropriate permissions.For more advanced sharing, refer to the Samba guide.
[Global] map to guest = Bad User [SharedDrive] path=/home/clear/myshareddrive read only = no guest ok = no browsable = yes valid users = samba-user-1 samba-user-2
Start the Samba service and set it to start automatically on boot.
sudo systemctl enable --now smb
Verify the service started properly.
sudo systemctl status smb
Use smbpasswd to add the initial password for the user account to access the share. Be aware that Samba maintains its own list of passwords for user accounts. The Samba password list can be different from the password used to log in.
For example:
sudo smbpasswd -a samba-user-1