Access the Linux server shared folder through samba

Table of contents

background

I recently joined a new company and got used to developing with a Mac. The source code of the new company's AOSP project was synchronized to a compilation server. In order to improve the efficiency of code reading, modification and compilation, refer to the guidance on the Internet to use samba to access the shared directory of the compilation server on macOS.

server side

  1. First confirm whether your server has installed Samba, the installed situation is as follows:
[administrator@test]$ rpm -qa | grep samba
samba-libs-4.10.16-18.el7_9.x86_64
samba-client-libs-4.10.16-18.el7_9.x86_64
samba-common-4.10.16-18.el7_9.noarch
samba-common-tools-4.10.16-18.el7_9.x86_64
samba-common-libs-4.10.16-18.el7_9.x86_64
samba-4.10.16-18.el7_9.x86_64
  1. If Samba is not installed, you can install it with the following command:
[administrator@test]$ yum -y install samba
  1. Add samba login password for Linux users:
[administrator@test]$ sudo smbpasswd -a administrator
  1. Create the directory that needs to be shared, configure smb.conf, and restart the Samba service:
[administrator@test]$ mkdir myShared
[administrator@test]$ vim /etc/samba/smb.conf
//在后面添加自己的Samba共享目录
[administrator]
        comment = administrator shared dirs with password
        path = /media/administrator/myShared
        browseable = yes
        writable = yes
        create mask = 0664
        directory mask = 0777
 
[administrator@test]$ sudo service smb restart

macOS side

  1. Open Finder->Go->Connect to Server
  2. Enter smb:server ip
    insert image description here

Note: If you find that the folder is empty after samba is successful, go to the server and turn off the selinux permission and try again (knock the command setenforce 0).

Guess you like

Origin blog.csdn.net/lgglkk/article/details/127397852