Ubuntu20.04/22.04 configures samba service and uses winodws/mac to connect

Preparation

1. Prepare samba for connecting users

sudo useradd user

2. Create a folder to share

sudo mkdir -p /home/mark/data

3. Open folder permissions

sudo chmod 777 /home/mark/data/

Install Samba service

1. Use apt-get to install

sudo apt-get install samba samba-common-bin

2. Configure the /etc/samba/smb.conf file

sudo nano /etc/samba/smb.conf

To the last line, write the following configuration information

# 共享文件夹显示的名称,也是你之后访问需要指定的文件夹路径名
[home]
# 说明信息
comment = datasets
# 可以访问的用户,这里需要改成你自己linux系统里的账户名
valid users = root,user
# 共享文件的实际路径,这里需要你自己修改
path = /home/mark/data
# 可被其他人看到资源名称(非内容)
browseable = yes
# 可写
writable = yes
# 新建文件的权限为 664
create mask = 0664
# 新建目录的权限为 775
directory mask = 0775

ctr+x save and exit

3. Enter testparm to check whether the configuration information is correct
insert image description here
4. Configure account and password for smb

sudo smbpasswd -a user

5. Restart the service

sudo systemctl restart smbd

other computers to connect

windows

configure connection

Choose to map the network drive.
insert image description here
For example, my samba service is installed on the 192.168.3.34 machine.
Then write down our address here

//192.168.3.34/home

Then just connect, note that the home here is the [home] configured in samb

other

If you are trying to use windows to connect to other samba services, the connection may fail due to the outdated samba protocol of the other party.

Microsoft reminds: "SMBv1 will have serious security vulnerabilities, and we strongly recommend you not to use it." There are multiple versions of Samba, and v2 or v3 is currently the mainstream, and Win10 also disables the v1 protocol by default.

If we want to add it successfully, we need to open the SMBv1 protocol.

Open the Control Panel - Programs - Enable or disable Windows features, check the options circled in the figure below, click OK, and restart the system according to the prompts to add support for the SMBv1 protocol. See:
https://blog.csdn.net /qianglei6077/article/details/86575224

mac

Open Finder, cmmand + k, enter the ip address of smb, and you can connect.
That is,
insert image description here
comman + k to enter the server connection
, enter 192.168.3.34
and click to connect

Guess you like

Origin blog.csdn.net/crazyjinks/article/details/130505476