Skip to content

Instantly share code, notes, and snippets.

@SofijaErkin
Last active July 23, 2022 03:42
Show Gist options
  • Save SofijaErkin/4472f8703804b472fd4b3d55f58eb36f to your computer and use it in GitHub Desktop.
Save SofijaErkin/4472f8703804b472fd4b3d55f58eb36f to your computer and use it in GitHub Desktop.
using samba between macOS and Linux

Samba Share

This Samba Share is from Linux/Cloud(e.g:debian) to Others(like:macos).

1.Install Samba

Just use the below:

sudo apt update

sudo apt install samba

2.Create Samba Password file

sudo touch /etc/samba/smbpasswd

3.Create User Name and Password(Using the current user name and password)

sudo smbpasswd -a username

4.Config Smaba

There will be have a default configuration file smb.conf under /etc/samba.

But you'd better rename the default file into smb.conf.original and create

a new file named smb.conf using the below code:

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.original

sudo nano /etc/samba/smb.conf

Edit the /etc/samba/smb.conf:

sudo gedit /etc/samba/smb.conf

Also, add the below to the Global zone on the file

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of

   workgroup = WORKGROUP

# Refer: https://cloud.tencent.com/developer/article/1184150
# Setting the name of samba server

   server string = samba_server_on_debian_11

# Setting the role type of samba server

   server role = standalone server

# Binding samba to the internet ports

   interfaces = lo eth3

# Making sure that samba only bind to the list of interfaces

   bind interfaces only = yes

# Disabling the not of NetBIOS business's function

   disable netbios = yes

# Setting the listen port for samba server from the outside accessing

   smb ports = 445

# Settings the name and location of log file

   log file = /var/log/samba/smb.log

# Settings the size of the log file

   max log size = 10000

# Settings the info and level of log file

   log level = 3 passdb:5 auth:5

# The below configuration solve the problem(protocol negotiation failed:
# NT_STATUS_CONNECTION_RESET or protocol negotiation failed:
# NT_STATUS_IO_TIMEOUT or protocol negotiation failed: 
# NT_STATUS_INVALID_NETWORK_RESPONSE).
# Adding the protocol configuration for the client and server settings

   client min protocol = CORE
   client max protocol = SMB3

Adding the below to the bottom of that file

[share]
# Refer: https://cloud.tencent.com/developer/article/1184150
# share: the sharing name of login using

   comment = share folder with macOS

# path: the absolute directory of sharing folder under file system   
   path = /home/username/mac_share

# create mask: enhance the writing power to any files under sharing folder
   create mask = 0766

# directory mask: enable the creating directory under sharing folder
   directory mask = 0766

# valid users: the user list of accessing the sharing folder. Set user name,
# user group(e.g: administration or admin, using @admins).
   valid users username
  
   force user = username

   force group = username

   available = yes

# browseable: setting whether other users could accessing the sharing folder or
# not? If enable, then other samba server users could check whether the sharing
# folder live or not, but could not read or write that sharing folder         
   browseable = yes

# read only: setting whether the valid users could write the sharing folder
   read only = no       

   public = yes

   writable = yes

Attention please, "create mask" or "directory mask" 0766 is the Linux

permissions(An introduction to chmod)

or in Japanese

or in chinese.

Notice: No matter any time, Checkout syntax

just use testparm to check your changes after you edit smb.conf,

then let the daemon re-read the config with a "sudo /etc/init.d/smbd restart"

or "sudo service smbd restart".

5.Restart Server Samba

sudo /etc/init.d/smbd restart

6.Checkout the IP of Linux(Notice: virtual local IP not work)

ifconfig

7.Using Folder under Macbook Connect Samba

right click Folder, choose Connect to server, input the IP, e.g:

smb://10.0.1.15

Notice: The IP should be the physical or virtual IP, not that local IP.

The Guest machine and the Host machine should be the bridge connection,

not the host-only or NAT connect.

8.Using User Name and Password Register Account

Just using user name and password under Linux to choose register account to

connect, and then transmit data.

There is best to login samba client via terminal, which means access the

services of samba service by terminal.

10.Refer

Refer from Server to Client.

10.1Refer from Linux/Debian to Host/macOS

Host/macOS smaba client using terminal connects to Linux/Debian samba server.

Not that easy.

1.How to set up Samba in Ubuntu/Linux, and access it in Mac OS and Windows.

2.Configure Samba to Work Better with Mac OS X.

3.How to set up Samba in Ubuntu and access it in MacOS/Windows.

4.Mac OSX client and Linux SAMBA share.

5.How to Share Files Between Windows, Mac, and Linux PCs on a Network.

6.How To Connect To Samba Shares Mac Os X?.

7.Sharing folder between virtual machine ubuntu and macOS(Chinese Blog).

8.Macbook access the sharing folders under Ubuntu(Chinese Blog).

9.Accessing Linux Files from Windows or Mac (via SMB).

10.(Terminal)macOS: How to mount a SMB share from the command line.

11.(Terminal)Using terminal connect SMB(Chinese Blog).

12.(Terminal)The three ways to connect SMB under MacOS terminal(Chinese Blog).

13.(Terminal)MacOSX connect Samba under terminal(Chinese).

14.Sharing Files From a VirtualBox Guest To The Host Using NAT Adapter.

15.Firewalling Samba.

16.The port and protocol of Samba Service(Chinese Blog).

17.4.3. Shared Folders.

18.Chapter 4. Guest Additions.

19.8.40. VBoxManage sharedfolder.

20.Share Ubuntu Home Directories using Samba.

21.21.3.4 Accessing Samba Shares from an Oracle Linux Client.

22.21.3.1 Configuring a Samba Server.

10.2Refer from Host/macOS to Linux/Debian

Linux/Debian samba client using terminal connects to Host/macOS smaba server.

Easy!

1.Configuring Samba on Mac OS X.

2.(Terminal)Macbook build Samba folders to share with Ubuntu for accessing and loading(Chinese Blog).

3.(Windows Port Forwarding+Terminal)Ubuntu16.04 access the sharing folders of Windows via Internet with Samba(Chinese Blog).

4.MacOS build up Samba Server(Chinese Blog).

5.(Terminal)Config the Samba client on Linux to access the remote Samba server contents(Chinese Blog).

6.(Terminal)Ubuntu access te server of Samba using terminal(Chinese Blog).

7.Set up file sharing on Mac.

8.(Terminal)How to connect to samba shares over the internet via ssh from mac os x.

9.(Terminal)Smbclient document.

10.(Terminal)HOWTO: Use Shared Folders.

11.(Host-only+VM+Host+Git)Using Git with shared folders and virtual machines.

12.Direct connect to Maximo running on a NAT virtual machine.

13.How to access Hyper-V VMs behind native NAT.

14.Hot to set Samba sharing for weight COP on Ubuntu(Chinese Blog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment