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

zabbix custom monitoring nginx status implementation process

Table of contents Zabbix custom monitoring nginx ...

Detailed explanation of the this pointing problem in JavaScript

Summarize Global environment ➡️ window Normal fun...

Analysis of the process of deploying pure HTML files in Tomcat and WebLogic

1. First, the pure HTML file must have an entry i...

Solve the problem of MySQL using not in to include null values

Notice! ! ! select * from user where uid not in (...

Detailed explanation of transactions and indexes in MySQL database

Table of contents 1. Affairs: Four major characte...

How to deploy nginx with Docker and modify the configuration file

Deploy nginx with docker, it's so simple Just...

Vue implements student management function

This article example shares the specific code of ...

A colorful cat under Linux

Friends who have used the Linux system must have ...

How to implement the paging function of MyBatis interceptor

How to implement the paging function of MyBatis i...

Using HTML+CSS to track mouse movement

As users become more privacy-conscious and take m...

Detailed process of building nfs server using Docker's NFS-Ganesha image

Table of contents 1. Introduction to NFS-Ganesha ...

Detailed explanation of the spacing problem between img tags

IMG tag basic analysis In HTML5, the img tag has ...

Discussion on Web Imitation and Plagiarism

A few months after entering the industry in 2005, ...

Vue realizes adding watermark to uploaded pictures (upgraded version)

The vue project implements an upgraded version of...