Get the App
SLTechnology News&Howtos  ›  Servers  › 

Detailed explanation of samba folder sharing server configuration under centos

Shulou Source: shulou.com Published: 2022-06-02 03:58:05 10月03日 Update

1. Preface

   recently found that it is inconvenient to develop under centos. The code of windows/mac must be synchronized to the folder of centos before it can be compiled. As a result, the work efficiency is low, and a lot of time is spent on code synchronization between window/mac and centos systems. So you want to share the folders in centos to windows/mac, so that you can modify the code under centos directly on window/mac to quickly improve efficiency. Samba server can solve this problem very well, it can let windows and mac users access the shared folders of the local area network as well as the folders under centos.

two。 Configure the samba server

2.1 install samba server

$yum install samba

2.2 set up shared folders

Open the smb configuration file:

Add a shared folder at the end of the file

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

Then wq saves and exits.

2.3 add users (you can use the current user directly, then there is no need to add users and passwords, 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 prohibition of 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 the smb service

3.1 access to centos shared folder under mac: folder menu-"Connect server -" go to

Smb://192.168.1.53

After the    connection, you are prompted for a user name and password, and after verification, you enter the centos shared folder.

3.2 access to shared folders under windows

/ / 192.168.1.53

After the    connection, you are prompted for a user name and password, and after verification, enter the centos shared folder.

4. Set static IP

During the use of   , it is found that the IP of centos is often changing, which brings a lot of inconvenience to the connection of windows/ Mac. The solution is to set the IP of centos to static IP:

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

Note: $eth can be obtained from ifconfig, if the ifconfig output is: eth0: flags=4163 mtu 150., then $eth=eth0.

After opening it, change it to:

 

Save and exit the wq after the modification of  , and restart the Nic driver after exiting:

$systemctl restart network

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

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

Tags: Files folders services servers users passwords configuration code articles authentication inconvenience efficiency user names firewalls static synchronization work prompts input fire prevention Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux MariaDB Docker Shulou Information