artikel / installing and using samba in archlinux and ubuntu

Installing and Using Samba in ArchLinux and Ubuntu

Installing and Using Samba in ArchLinux and Ubuntu

Installation

ArchLinux

sudo pacman -Syu --noconfirm
sudo pacman -S `samba`

Ubuntu

sudo apt update
sudo apt upgrade
sudo apt install -y `samba`

Initial Configuration

During the initial installation on ArchLinux, the samba server does not provide a configuration file. Copy and paste the configuration file below and save it as smb.conf.

cd /etc/samba
sudo wget https://perpustakaan.nirkabel.net/repositori/config/smb.conf

Activation

sudo systemctl start smb
sudo systemctl start nmb

Check status

sudo systemctl status smb
sudo systemctl status nmb

If there are no issues, enable them to start automatically every time the server is turned on.

sudo systemctl enable smb
sudo systemctl enable nmb

Advanced Configuration

Users

Create samba user accounts without having to create directories for them on the server. In this example, there are 3 users: genderuwo, wewe, and kuntilanak.

sudo useradd -M -g users -G wheel genderuwo  
sudo passwd genderuwo
sudo useradd -M -g users -G wheel wewe  
sudo passwd wewe
sudo useradd -M -g users -G wheel kuntilanak  
sudo passwd kuntilanak

Report their accounts as samba users with passwords that can be the same or preferably different from the ones mentioned above:

sudo smbpasswd -a genderuwo
sudo smbpasswd -a wewe
sudo smbpasswd -a kuntilanak

Directories

In this example, directories will be created that can be read/written by these three accounts. First, open the configuration file again.

sudo nano /etc/samba/smb.conf

If the www directory is the responsibility of the user 'wewe', then the configuration is as follows:

[www]
path = /var/www/html
writable = yes
browseable = yes
create mask = 0777
directory mask = 0777
read only = no
public = no
valid users = wewe

If the /opt/app/korupsi directory is shared with the name korupsi and is the responsibility of the users genderuwo and kuntilanak, then the configuration is as follows:

[korupsi]
path = /opt/app/korupsi
writable = yes
browseable = yes
create mask = 0777
directory mask = 0777
read only = no
public = no
valid users = genderuwo, kuntilanak

Save the new configuration file by pressing CTRL-X.

Restart the samba server:

sudo systemctl restart smb
sudo systemctl restart nmb

Check the file sharing feature on the local network. Assuming the samba server is using the IP address 69.69.69.69, open a file browser (Thunar, etc.) and type the address: smb://69.69.69.69.

Automounting in Linux

Here are additional steps to automatically mount samba directories on a Linux computer:

Assuming you are the genderuwo Linux user: Create a local directory to mount the server's directories:

mkdir -p /home/genderuwo/kerjaan/tanpa/upah

Create a file containing the password

and username:

nano /home/genderuwo/.smb.credentials

Enter the samba access username and password:

username=genderuwo
password=5W[_w!>#znfh(>aug"*.x[^x(!eyg+G(

Save the new configuration file by pressing CTRL-X.

Edit the /etc/fstab file to automatically mount the directories every time the genderuwo computer is turned on to the /home/genderuwo/kerjaan/tanpa/upah directory.

Open the /etc/fstab file:

sudo nano /etc/fstab

Add the following line to /etc/fstab:

//69.69.69.69/korupsi /home/genderuwo/kerjaan/tanpa/upah cifs guest,iocharset=utf8,file_mode=0777,dir_mode=0777,credentials=/home/genderuwo/.smb.credentials

Save the new configuration file by pressing CTRL-X.

Check with the command:

sudo mount -a

Done

In this example, it shows how to install and share Linux server directories using the samba protocol, making them accessible to users of all operating systems. It also demonstrates how to automatically connect a Linux computer to a samba server.

Selayang pandang proyek Perpustakaan Nirkabel

Perpustakaan Nirkabel (wireless library) is a 12-year-old project bringing digital technology to remote areas in Indonesia, empowering basic education and bridging the gap in education. It enables students in remote areas to access knowledge and resources previously out of reach. Witness the tech enthusiasts' brainchild with a heart for education.

detail