• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Create Permission-based Configuration in Samba on Oracle Linux 8.5

  • 00:35 cat /etc/os-release
  • 00:47 yum install samba* -y
  • 01:00 systemctl start smb
  • 01:10 systemctl enable smb
  • 01:18 systemctl status smb
  • 06:24 systemctl stop firewalld
  • 06:32 systemctl disable firewalld
  • 07:40 vim /etc/samba/smb.conf
  • 09:05 systemctl restart smb nmb
{{postValue.id}}

To Create Permission based configuration in samba on Oracle linux 8.5

Introduction:

Samba is an open source software. A samba file server enables file sharing across different operating systems over a network. The samba server configuration is for managing samba shares, users, and basic server settings.

Note:

In this Tutorial we are going to create permission based configuration.

Share1

User1 and User3 have Read and Write Permission.

For User2 Read Access only.

Share2

User2 and User3 have Read and Write Permission.

For User1 Read Access only.

Share 3

User 2 and User3 have Read and Write Permission.

User1 have No Access.

Installation Procedures:

Step 1: Check the Oracle Linux version by using the below command.

[root@linuxhelp linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"

Step 2: Install Samba by using the below command

[root@linuxhelp linuxhelp]# yum install samba* -y
Installing:
 samba                        x86_64   4.15.5-5.el8        ol8_baseos_latest   867 k
 samba-client                 x86_64   4.15.5-5.el8        ol8_baseos_latest   716 k
 samba-common-tools           x86_64   4.15.5-5.el8        ol8_baseos_latest   522 k
 samba-krb5-printing          x86_64   4.15.5-5.el8        ol8_baseos_latest   101 k
 samba-libs                   x86_64   4.15.5-5.el8        ol8_baseos_latest   175 k
Upgraded:
Installed:
samba-winbind-krb5-locator-4.15.5-5.el8.x86_64                                     
  samba-winbind-modules-4.15.5-5.el8.x86_64                                          
  samba-winexe-4.15.5-5.el8.x86_64                                                   
  tdb-tools-1.4.3-1.el8.x86_64                                                       

Complete!

Step3: Start, enable and check the status of smb by using the below command

[root@linuxhelp linuxhelp]# systemctl start smb
[root@linuxhelp linuxhelp]# systemctl enable smb
Created symlink /etc/systemd/system/multi-user.target.wants/smb.service → /usr/lib/systemd/system/smb.service.

[root@linuxhelp linuxhelp]# systemctl status smb
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disa>
   Active: active (running) since Tue 2022-06-07 05:40:42 IST; 18s ago

Step4: Create Directory in Root by using the below command

  [root@linuxhelp linuxhelp]# mkdir /share1
  [root@linuxhelp linuxhelp]#mkdir /share2
  [root@linuxhelp linuxhelp]#mkdir /share3

Step5: Create Users by using the below command

[root@linuxhelp linuxhelp]# adduser --system user1
[root@linuxhelp linuxhelp]#  adduser --system user2
[root@linuxhelp linuxhelp]#  adduser --system user3

Step 6: Create Groups by using the below command

[root@linuxhelp linuxhelp]# groupadd sambagroup1
[root@linuxhelp linuxhelp]# groupadd sambagroup2

Step 7: Add the Users in their Respective Groups by using the below command

[root@linuxhelp linuxhelp]#usermod -a -G sambagroup1 user1
[root@linuxhelp linuxhelp]#usermod -a -G sambagroup1 user3
[root@linuxhelp linuxhelp]#usermod -a -G sambagroup2 user2
[root@linuxhelp linuxhelp]#usermod -a -G sambagroup2 user3

Step 8: Add the user to samba and create password by using the below command

[root@linuxhelp linuxhelp]# smbpasswd -a user1
New SMB password:
Retype new SMB password:
[root@linuxhelp linuxhelp]# smbpasswd -a user2
New SMB password:
Retype new SMB password:
[root@linuxhelp linuxhelp]#  smbpasswd -a user3
New SMB password:
Retype new SMB password:

Step 9: Enable the sambausers by using the below command

[root@linuxhelp linuxhelp]#  smbpasswd -e user1
 [root@linuxhelp linuxhelp]# smbpasswd -e user2
[root@linuxhelp linuxhelp]#  smbpasswd -e user3

Step 10: Set Ownership by using the below command

[root@linuxhelp linuxhelp]# chown -R user2:sambagroup1 /share1
[root@linuxhelp linuxhelp]#  chown -R user1:sambagroup2 /share2
[root@linuxhelp linuxhelp]#  chown -R user2:user3 /share3

Step 11: Change the SELinux context for files by using the below command

[root@linuxhelp linuxhelp]#  chcon -Rt samba_share_t /share1
[root@linuxhelp linuxhelp]#  chcon -Rt samba_share_t /share2
[root@linuxhelp linuxhelp]#  chcon -Rt samba_share_t /share3

Step 12: Stop and Disable Firewall by using the below command

[root@linuxhelp linuxhelp]# systemctl stop firewalld
[root@linuxhelp linuxhelp]# systemctl disable firewalld

Step 13: Grant Permission by using the below command

[root@linuxhelp linuxhelp]#  chmod  -R 777 /share1
[root@linuxhelp linuxhelp]#  chmod –R 777 /share2
[root@linuxhelp linuxhelp]#  chmod –R 777 /share3

Step 14: Create files inside the Directory by using the below command

[root@linuxhelp linuxhelp]#  touch /share1/file1
[root@linuxhelp linuxhelp]#  touch /share2/file2
[root@linuxhelp linuxhelp]#  touch /share3/file3

Step 15: Edit and make insert the configuration by using the below command

[root@linuxhelp linuxhelp]# vim /etc/samba/smb.conf
[share1]
path = /share1
valid users = user2, @sambagroup1
read list = user2
write list = @sambagroup1
browsable = yes

[share2]
path = /share2
valid users = user1, @sambagroup2
read list = user1
write list = @sambagroup2
browsable = yes

[share3]
path = /share3
valid users = user2, user3
read list = user2,user3
write list = user3
browsable = yes
invalid users = user1

Step 16: Restart the services by using the below command

[root@linuxhelp linuxhelp]# systemctl restart smb nmb

Step 17: Go to Windows Machine and Login with user credentials as shown in the below image snap1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the Permission-based Configuration in Samba on Oracle Linux 8.5 .Your feedback is much welcome.

Tags:
jayce
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is the full form of Samba?

A

Server Message Block

Q

What protocol does the samba use?

A

protocol does the samba use SMB protocol

Q

What is the port number of Samba?

A

SMB uses either IP port 139 or 445.

Q

Does the Samba use TCP or UDP?

A

Most SMB/CIFS network traffic by volume occurs over TCP

Q

How to check the Samba port?

A

To identify ports and network interfaces our Samba domain member is listening on, run: # netstat -tulpn | egrep "smbd|nmbd|winbind" tcp 0 0 127.0.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.