1. Introduction
Samba is an implementation method of SMB protocol, which is mainly used to realize file and print services of Linux system. The SMB protocol is a client/server protocol through which the client can access the shared file system, printers and other resources on the server.
2. Installation
1. Package installation
yum install -y samba samba-common samba-client
2. Create shared directory
mkdir -p /data/samba/tools
3. Add shared user
useradd -s /sbin/nologin deploy
smbpasswd -a deploy
chown -R deploy.deploy /data/samba/tools
4. Modify the configuration
vim /etc/samba/smb.conf
[tools]
comment = tools Directories
path = /data/samba/tools
writable = yes
force user = deploy
valid users = deploy
invalid users = root
public = no
create mode = 644
directory mode = 755
browseable = yes
veto files = /*.exe/*.com/*.dll/*.bat/
Parameter description
comment = annotation
path = share path
writable = whether it can be written
force user = file generating user
valid users = allowed access user
invalid users = allowed access user
public = whether to allow anonymous user access
create mode = file permissions
directory mode = Directory permissions
browseable = whether to display the shared directory
veto files = set forbidden files
hosts allow = specify the address that is allowed to access
hosts deny = specify the address that is denied access
5. Start the service
systemctl start smb
systemctl enable smb
6. Verify