Saturday, December 5, 2020

How to set up Samba on Ubuntu Server 20.10

 The following steps have been tested on Raspberry Pi 3.

Samba should be installed first. 

sudo apt update
sudo apt install samba

After the installation, run the command to check the status

sudo systemctl status smbd 

The status should be active (running). To manage Samba users, it's easier to create a user group. For example, use the group name smbgroup.

sudo addgroup smbgroup 

Next, create one or more users and add to the group. For example, the user name is smbuser. 

sudo adduser smbuser 

Add the user to the group

sudo usermod -aG smbgroup smbuser 

Samba manages a different set of passwords. To set the password to the user

sudo smbpasswd -a smbuser 

Now the user can be enabled to access Samba.

sudo smbpasswd -e smbuser 

The next step is to set up a shared directory. The Samba configuration file is /etc/samba/smb.conf. Open the file and append a section as below.

[HomeShare]
  path = /media/external_hd
  valid users = @smbgroup
  guest ok = no
  writable = yes
  browsable = yes

Where the share name is "HomeShare" and the shared directory is /media/external_hd. After the change is saved, run the following command to restart Samba service.

sudo service smbd restart 

The network share should be working. Find another computer in the network and try to access the network share "HomeShare".

No comments:

Post a Comment

How to make external drives spin down automatically on Ubuntu 20.10

 The following steps have been tested on Raspberry Pi 3. When using Raspberry Pi as a file server, it would save energy and extend an extern...