How to install Samba Server on Oracle Linux
To Install and Configure the Samba Server on Oracle Linux
Introduction:
Samba is a free and open-source software that allows files to be shared across Windows and Linux system.Samba provides file and print services for various Microsoft Windows clients .Samba is released under the terms of the GNU General Public License.The SMB is a protocol that is used for sharing access to files, printers.
Installation steps:
Step 1: check the OS version by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
Step 2: Install the samba packages by using the below command
[root@linuxhelp ~]# yum install samba*
Last metadata expiration check: 1 day, 0:19:12 ago on Friday 26 November 2021 09:35:06 AM IST.
Package samba-client-libs-4.13.3-3.el8.x86_64 is already installed.
Package samba-common-4.13.3-3.el8.noarch is already installed.
Package samba-common-libs-4.13.3-3.el8.x86_64 is already installed.
Dependencies resolved.
============================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================
Installing:
samba x86_64 4.14.5-2.el8 ol8_baseos_latest 847 k
samba-client x86_64 4.14.5-2.el8
ol8_baseos_latest 700 k
samba-common-tools x86_64 4.14.5-2.el8 ol8_baseos_latest 499 k
samba-krb5-printing x86_64 4.14.5-2.el8 ol8_baseos_latest 98 k
samba-libs x86_64 4.14.5-2.el8 ol8_baseos_latest 169 k
samba-pidl noarch 4.14.5-2.el8 ol8_baseos_latest 196 k
samba-test x86_64 4.14.5-2.el8 ol8_baseos_latest
python3-ldb x86_64 2.2.0-2.el8 ol8_baseos_latest 64 k
python3-samba x86_64 4.14.5-2.el8 ol8_baseos_latest 3.2 M
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-5.4.17-2102.201.3.el8uek.x86_64.conf:6: hwcap directive ignored
Complete!
Step 3: Start the samba service by using the below command
[root@linuxhelp ~]# systemctl start smb
Step 4: Enable the samba service by using the below command
[root@linuxhelp ~]# systemctl enable smb
Created symlink /etc/systemd/system/multi-user.target.wants/smb.service → /usr/lib/systemd/system/smb.service.
Step 5: Check the status of samba service by using the below command
[root@linuxhelp ~]# systemctl status smb
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2021-11-27 09:55:20 IST; 26s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 10590 (smbd)
Status: "smbd: ready to serve connections..."
Tasks: 4 (limit: 10509)
Memory: 41.2M
CGroup: /system.slice/smb.service
├─10590 /usr/sbin/smbd --foreground --no-process-group
├─10592 /usr/sbin/smbd --foreground --no-process-group
├─10593 /usr/sbin/smbd --foreground --no-process-group
Step 6: Edit the configuration file by using the below command
[root@linuxhelp ~]# vim /etc/samba/smb.conf
[samba]
path=/sambashare
comment=samba
browseable=yes
writable=yes
guest ok=yes
read only=no
Step 7: create a directory for sharing by using the below command
[root@linuxhelp ~]# mkdir /sambashare
Step 8: change the permission of shared folder by using the below command
[root@linuxhelp ~]# chmod 777 /sambashare/
Step 9: create files in shared folder by using the below command
[root@linuxhelp ~]# touch /sambashare/abc{1..10}
Step 10: check the configuration file by using the below command
[root@linuxhelp ~]# testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
#Global parameters
[global]
printcap name = cups
security = USER
workgroup = SAMBA
idmap config * : backend = tdb
cups options = raw
[homes]
browseable = No
comment = Home Directories
inherit acls = Yes
read only = No
valid users = %S %D%w%S
[printers]
browseable = No
comment = All Printers
create mask = 0600
path = /var/tmp
printable = Yes
[print$]
comment = Printer Drivers
create mask = 0664
directory mask = 0775
force group = @printadmin
path = /var/lib/samba/drivers
write list = @printadmin root
[samba]
comment = samba
guest ok = Yes
path = /sambashare
read only = No
Step 11: Adding a new user by using the below command
[root@linuxhelp ~]# useradd sambauser
Step 12: Set the password to sambauser by using the below command
[root@linuxhelp ~]# passwd sambauser
Changing password for user sambauser.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
Step 13 : Change the user to samba user by using the below command
[root@linuxhelp ~]# smbpasswd -a sambauser
New SMB password:
Retype new SMB password:
Added user sambauser.
Step 14: Restart the samba service by using the below command
[root@linuxhelp ~]# systemctl restart smb
Step 15: Avoid a home directory comment by using the below command
[root@linuxhelp ~]# vim /etc/samba/smb.conf
#[homes]
# browseable = No
# comment = Home Directories
# inherit acls = Yes
# read only = No
# valid users = %S %D%w%S
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install and configure the Samba server on Oracle Linux. Your feedback is much welcome.