I am a highly skilled and experienced administrator with a strong background in both Windows and Linux systems. I have a deep understanding of network infrastructure, security, and system administration, and am able to effectively troubleshoot and resolve a wide range of technical issues. I am also well-versed in various scripting languages, including PowerShell and Bash, and am able to automate repetitive tasks and improve system efficiency.

Full width home advertisement

Post Page Advertisement [Top]

  


     install and configure Samba share on RHEL


Samba is a free and open-source software suite that provides file and print services to allow computers running Microsoft Windows to access resources stored on computers running Unix-like operating systems, such as Linux or macOS. Samba servers allow you to share files and printers between different operating systems and devices on a network.

 

To set up a Samba server, you will need a computer running a Unix-like operating system with Samba installed. You will also need to configure the server by editing the Samba configuration file (smb.conf) to specify the resources you want to share and the access permissions for those resources.

 

Once the Samba server is configured and running, users on other computers on the network can access the shared resources by entering the server's IP address or hostname in the address bar of their file browser, or by mapping a network drive to the shared resources on the server.

 

Samba servers are commonly used in small and medium-sized businesses, as well as in home networks, to allow users to share files and printers between different devices and operating systems.

 

 

Samba is a file & printer sharing software which is used to share printers and files between same or different operating systems.

Today, You will learn that how to install and configure Samba share on RHEL 8 and how to access it from other Linux and Windows systems.

 

Use below command to install samba with necessary packages.

 

# yum install samba samba-common samba-client -y

 

Before configurations, make sure Windows machine is in same workgroup.

open the cmd prompt in Windows machine and run the following command

 

net config workstation

 

Samba Configuration

before configuration rename samba default configuration file /etc/samba/smb.conf as backup.

 

# cp /etc/samba/smb.conf /etc/samba/smb.conf.default

 

Samba Anonymous File Sharing

Now create a shared folder on the server where all files/folders will be stored and set appropriate permissions on it and allow SELINUX for the samba configuration.

 

Run below commands

 

# mkdir -p /srv/samba/anonymous

# chmod -R 0755 /srv/samba/anonymous

# chown -R nobody:nobody /srv/samba/anonymous

# chcon -t samba_share_t /srv/samba/anonymous

 

Now make following changes in new samba configuration file.

# vim /etc/samba/smb.conf

[global]

workgroup = WORKGROUP

server string = Samba Server %v

netbios name = rhel8

security = user

map to guest = bad user

dns proxy = no

 

[Anonymous]

path = /srv/samba/anonymous

browsable =yes

writable = yes

guest ok = yes

read only = no

 

Run below commant to verify samba configurations

 

# testparm

 

Start and Add Samba Services in firewall

Run below command to add samba service in firewall

 

# firewall-cmd --permanent --add-service=samba

# firewall-cmd --reload

 

start and enable samba services

 

# systemctl start smb.service

# systemctl enable smb.service

# systemctl start nmb.service

# systemctl enable nmb.service

 

Access Samba Share Path

Now open Run prompt by pressing win + r key on your keyboard then type \\rhel8 and press enter key.

 

You will see Anonymous folder like below

 

Now you can add files/folders in this folder to share with other users.

 

Create samba secure share

Create a secured share on the server where only allowed user can login and set appropriate permissions on it and allow SELINUX for the samba configuration.

 

Create group for samba users

# groupadd securedgroup

Create samba user with securedgroup

# useradd demo -G securedgroup

 

Now create secure share folder for samba users and set necessary permissions.

# mkdir -p /srv/samba/secured

# chmod -R 0770 /srv/samba/secured

# chcon -t samba_share_t /srv/samba/secured

# chown -R root:securedgroup /srv/samba/secured/

 

 

Add user to samba database and set its password

# smbpasswd -a demo

 

Now add following lines in samba configuration file.

# vim /etc/samba/smb.conf

[secured]

path = /srv/samba/secured

valid users = @securedgroup

guest ok = no

writable = yes

browsable = yes

 

Then restart samba

# systemctl restart smb.service

 

Now access secured share from Windows

Now you can access the RHEL 8 secured folder from windows, open Run prompt by pressing win + r key on your keyboard

Then type \\SAMBA-SERVER-IP and press enter key.

 

Now Click on secured folder and it will ask you to enter samba user login details to access the folder.

 

You will see secured folder, Now you can add files/folders in this folder to share with other samba users.

 

You have successfully created Samba share.

========

 

Configure Samba Client on Linux:

--------------------------------

Login as root and install samba client packages.

# dnf install -y samba*

 

Check the Samba Share on Client.

# smbclient -L //192.168.1.115 -U demo

 

Mount the samba share using below command.

# mount -t cifs -o username=demo,password=redhat //192.168.1.115/private /mnt/samba-private/

===

 

 

 

 

amba is a free and open-source software suite that provides file and print services to allow computers running Microsoft Windows to access resources stored on computers running Unix-like operating systems, such as Linux or macOS. Samba servers allow you to share files and printers between different operating systems and devices on a network.

 

To set up a Samba server, you will need a computer running a Unix-like operating system with Samba installed. You will also need to configure the server by editing the Samba configuration file (smb.conf) to specify the resources you want to share and the access permissions for those resources.

 

Once the Samba server is configured and running, users on other computers on the network can access the shared resources by entering the server's IP address or hostname in the address bar of their file browser, or by mapping a network drive to the shared resources on the server.

 

Samba servers are commonly used in small and medium-sized businesses, as well as in home networks, to allow users to share files and printers between different devices and operating systems.

 

 

Samba is a file & printer sharing software which is used to share printers and files between same or different operating systems.

Today, You will learn that how to install and configure Samba share on RHEL 8 and how to access it from other Linux and Windows systems.

 

Use below command to install samba with necessary packages.

 

# yum install samba samba-common samba-client -y

 

Before configurations, make sure Windows machine is in same workgroup.

open the cmd prompt in Windows machine and run the following command

 

net config workstation

 

Samba Configuration

before configuration rename samba default configuration file /etc/samba/smb.conf as backup.

 

# cp /etc/samba/smb.conf /etc/samba/smb.conf.default

 

Samba Anonymous File Sharing

Now create a shared folder on the server where all files/folders will be stored and set appropriate permissions on it and allow SELINUX for the samba configuration.

 

Run below commands

 

# mkdir -p /srv/samba/anonymous

# chmod -R 0755 /srv/samba/anonymous

# chown -R nobody:nobody /srv/samba/anonymous

# chcon -t samba_share_t /srv/samba/anonymous

 

Now make following changes in new samba configuration file.

# vim /etc/samba/smb.conf

[global]

workgroup = WORKGROUP

server string = Samba Server %v

netbios name = rhel8

security = user

map to guest = bad user

dns proxy = no

 

[Anonymous]

path = /srv/samba/anonymous

browsable =yes

writable = yes

guest ok = yes

read only = no

 

Run below commant to verify samba configurations

 

# testparm

 

Start and Add Samba Services in firewall

Run below command to add samba service in firewall

 

# firewall-cmd --permanent --add-service=samba

# firewall-cmd --reload

 

start and enable samba services

 

# systemctl start smb.service

# systemctl enable smb.service

# systemctl start nmb.service

# systemctl enable nmb.service

 

Access Samba Share Path

Now open Run prompt by pressing win + r key on your keyboard then type \\rhel8 and press enter key.

 

You will see Anonymous folder like below

 

Now you can add files/folders in this folder to share with other users.

 

Create samba secure share

Create a secured share on the server where only allowed user can login and set appropriate permissions on it and allow SELINUX for the samba configuration.

 

Create group for samba users

# groupadd securedgroup

Create samba user with securedgroup

# useradd demo -G securedgroup

 

Now create secure share folder for samba users and set necessary permissions.

# mkdir -p /srv/samba/secured

# chmod -R 0770 /srv/samba/secured

# chcon -t samba_share_t /srv/samba/secured

# chown -R root:securedgroup /srv/samba/secured/

 

 

Add user to samba database and set its password

# smbpasswd -a demo

 

Now add following lines in samba configuration file.

# vim /etc/samba/smb.conf

[secured]

path = /srv/samba/secured

valid users = @securedgroup

guest ok = no

writable = yes

browsable = yes

 

Then restart samba

# systemctl restart smb.service

 

Now access secured share from Windows

Now you can access the RHEL 8 secured folder from windows, open Run prompt by pressing win + r key on your keyboard

Then type \\SAMBA-SERVER-IP and press enter key.

 

Now Click on secured folder and it will ask you to enter samba user login details to access the folder.

 

You will see secured folder, Now you can add files/folders in this folder to share with other samba users.

 

You have successfully created Samba share.

========

 

Configure Samba Client on Linux:

--------------------------------

Login as root and install samba client packages.

# dnf install -y samba*

 

Check the Samba Share on Client.

# smbclient -L //192.168.1.115 -U demo

 

Mount the samba share using below command.

# mount -t cifs -o username=demo,password=redhat //192.168.1.115/private /mnt/samba-private/

===

 


No comments:

Post a Comment

Bottom Ad [Post Page]