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

Detailed process of installing and configuring MySQL and Navicat prenium

Prerequisite: Mac, zsh installed, mysql downloade...

How to automatically import Vue components on demand

Table of contents Global Registration Partial Reg...

The background color or image inside the div container grows as it grows

Copy code The code is as follows: height:auto !im...

Design a data collector with vue

Table of contents Scenario Core Issues Status mon...

Learning Vue instructions

Table of contents 1. v-text (v-instruction name =...

CSS makes tips boxes, bubble boxes, and triangles

Sometimes our pages will need some prompt boxes o...

Tomcat multi-instance deployment and configuration principles

1. Turn off the firewall and transfer the softwar...

How to modify the root password of mysql in docker

The first step is to create a mysql container doc...

The whole process of configuring hive metadata to MySQL

In the hive installation directory, enter the con...

JS implements WeChat's "shit bombing" function

Hello everyone, I am Qiufeng. Recently, WeChat ha...

How to write a picture as a background and a link (background picture plus link)

The picture is used as the background and the lin...

Markup Languages ​​- What to learn after learning HTML?

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

Mysql GTID Mha configuration method

Gtid + Mha + Binlog server configuration: 1: Test...

Centos7 installation of Nginx integrated Lua sample code

Preface The computer I use is a Mac, and the oper...