Detailed explanation of samba folder sharing server configuration under centos

Detailed explanation of samba folder sharing server configuration under centos

1. Introduction

Recently I found that there are many inconveniences in developing under centos. The code changes for windows/mac must be synchronized to the centos folder before they can be compiled. This results in low work efficiency, and a lot of time is spent on code synchronization between window/mac and centos systems. So I want to share the folder in centos to windows/mac, so that I can directly modify the code under centos on window/mac to quickly improve efficiency. The samba server can solve this problem very well. It allows Windows and Mac users to access folders under CentOS just like accessing shared folders on the LAN.

2. Configure the samba server

2.1 Installing the Samba Server

$ yum install samba

2.2 Setting up a shared folder

Open the smb configuration file:

Add the shared folder at the end of the file

$[centos_share_folder]
      comment = share folder#Shared folder path = /home/centos/share#Specify the shared folder path available = yes
      public = yes
      writable = yes
      valid users = centos
      create mask = 755
      directory mask = 755
      guest ok = no

Then press wq to save and exit.

2.3 Add user (you can directly use the current user, so there is no need to add a user and password, skip this step)

$ adduser centos

Set password

$ smbpasswd -a samba

3 Enable smb service

3.1 Turn off the firewall

$ systemctl stop firewalld.service

3.2 Disable setlinux

$ vi /etc/sysconfig/selinux
Set SELINUX=enforcing to disabled
$ setenforce 0 #Turn off selinux firewall

3.3 Enable samba service

$ systemctl start smb.service
$ systemctl stop smb.service
$ systemctl restart smb.service

3. Verify smb service

3.1 Access centos shared folders on mac: Folder menu -> Connect to server -> Go to

smb://192.168.1.53

After connecting, you will be prompted to enter your username and password. After verification, you will enter the centos shared folder.

3.2 Accessing shared folders under Windows

//192.168.1.53

After connecting, you will be prompted to enter your username and password. After verification, you can enter the centos shared folder.

4. Set up a static IP

During use, I found that the IP of centos often changes, which brings a lot of inconvenience to the connection on the windows/mac side. The solution is to set the centos IP to a static IP:

$ vi /etc/sysconfig/network-scripts/ifcfg-$eth

Note: $eth can be obtained by ifconfig. For example, ifconfig output is: eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 150..., then $eth=eth0.

After opening, modify it to:

After the modification, press wq to save and exit. After exiting, restart the network card driver:

$ systemctl restart network

At this point, the smb server has been created successfully, and you can start efficient encoding work!

This is the end of this article about the detailed configuration of samba folder sharing server under centos. For more information about samba folder sharing service under centos, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to set up folder sharing in CentOS 7 in VMware

<<:  How to ensure transaction characteristics of MySQL InnoDB?

>>:  Echarts tutorial on how to implement tree charts

Recommend

Markup language - for

Click here to return to the 123WORDPRESS.COM HTML ...

MySQL latest version 8.0.17 decompression version installation tutorial

Personally, I think the decompressed version is e...

Vue simulates the shopping cart settlement function

This article example shares the specific code of ...

Detailed explanation of efficient MySQL paging

Preface Usually, a "paging" strategy is...

CSS style does not work (the most complete solution summary in history)

When we write pages, we sometimes find that the C...

Summary of MySQL string interception related functions

This article introduces MySQL string interception...

Element sample code to implement dynamic table

Table of contents 【Code background】 【Code Impleme...

Simple example of HTML checkbox and radio style beautification

Simple example of HTML checkbox and radio style b...

Detailed explanation of Linux Namespace User

User namespace is a new namespace added in Linux ...

MySQL multi-instance deployment and installation guide under Linux

What is MySQL multi-instance Simply put, MySQL mu...

Example of implementing grouping and deduplication in MySQL table join query

Table of contents Business Logic Data table struc...