Building a Samba server under Linux - it is convenient for file interaction between the Windows environment and the Linux environment.


Samba service introduction

SambaIt is Linuxa Microsoftsoftware that allows the system to apply the network communication protocol, SMBnot Server Message Blockthe abbreviation of , which is the server message block, which SMBis mainly used Microsoftas the network communication protocol of the system. Later, the communicationSamba protocol was applied to the system to form the current software . Later, Microsoft renamed it to the public file system, and added many new functions, which made Samba more powerful.SMBLinuxSambaSMBCIFS(Common Internet File System)Internet

SambaThe biggest function is that it can be used Linuxfor windowsdirect file sharing and printing sharing with the system, Sambait can be used windowsfor Linuxfile sharing between and, and it can also be used Linuxfor Linuxresource sharing between and, because NFS(network file system) can be well completed The data sharing betweenLinux Linuxand , so Sambais more Linuxused windowsin the data sharing between and .

When using sambaand windowsto share files, please make sure windowsthat NetBIOS(that is, the function of My Network Places) is turned on.

update software

sudo apt-get upgrade 
sudo apt-get update 
sudo apt-get dist-upgrade

install samba server

sudo apt-get install samba samba-common

insert image description here

Create a file path for sharing

The operation is similar TFTP, nfsetc., Sambawhich can be set as the root directory, so that they can be accessedsudo mkdir /home/linuxidc/linuxidc.com/share

Setting permissions

sudo chmod 777 /home/linuxidc/linuxidc.com/share

Add the user password used by Samba, which Windows will use when accessing

sudo smbpasswd -a linuxidc ( linuxidc是我的用户名)

insert image description here

Configure the configuration file of samba.

sudo vim /etc/samba/smb.conf

Add the following at the end of the file:

[share]
comment = share folder
browseable = yes
path = /home/linuxidc/linuxidc.com/share  #这里配置共享目录
create mask = 0700
directory mask = 0700
valid users = linuxidc
force user = linuxidc
force group = linuxidc
public = yes
available = yes
writable = yes

Restart the Samba server

sudo service smbd restart

Access under Windows

Win+R: Enter in the pop-up running window \ip( ubuntuuse ifconfigview in ip) to access.

Guess you like

Origin blog.csdn.net/qq_37596943/article/details/127343776