Some notes on the Raspberry Pi samba configuration file

Set up direct access, read and write without username and password.

Add the following to the end of the configuration file /etc/samba/smb.conf, and restart samba

   comment = public path
   path = /upan/download/
   guest ok = yes
   browseable = yes
   writeable = yes
   create mask = 0777
   directory mask = 0777

Resolve Samba shared soft connection file inaccessibility, access denied

Just add the following three lines at the end of the [global] global setting in the samba configuration file and restart samba vi /etc/samba/smb.conf

follow symlinks = yes
wide links = yes
unix extensions = no

sudo systemctl restart smbd

samba share enabled recycle bin (can retrieve deleted files)

It needs to be configured for each shared resource, for example to add recycle bin functionality to the [upan] share above, add the following 7 lines to the bottom of [upan].

vfs object = recycle
recycle:repository = .deleted/%U
recycle:versions = Yes
recycle:keptree = Yes
recycle:maxsixe = 0
recycle:exclude = .tmp|.mp4
recycle:noversions = *.doc

# Comments.
#(1) vfs object = recycle: load Samba's module for recycle bin function.
#(2) recycle:repository = . deleted/%U: relative path to the recycle bin. This option specifies what directory the deleted files will be stored in, i.e. the path to the recycle bin, which is related to the actual path to the shared resource.
#In the above example, the actual path to the share "[upan]" is "/upan/download/", so any deleted content is moved to this directory under . The %U variable indicates the username of the current user browsing the share, so each user's deleted files will be stored in the directory named after his username.
#For example, when user "pi" accesses the share, the deleted files will be saved in the "/upan/download/.deleted/pi" directory. Only relative paths can be used for this parameter.
#Other users must have write access to the configured directory. If there is a file to be put into this directory, Samba server will write it to the log if there is a problem, and continue the file deletion operation.
#(3) recycle:keptree = Yes: When moving files into the recycle bin, create the corresponding directory structure.
#(4) recycle:versions = Yes: If there are files with the same name in the directory where the recycle bin is located, they are distinguished by the "Copy #x of" file name, such as "Copy #1 of mindblog.txt, Copy #2 of mindblog.txt, Copy #3 of mindblog.txt, Copy #4 of mindblog.txt. Copy #2 of 心靈博客.txt"
#(5) recycle:maxsixe = 0: the maximum space of the recycle bin, in bytes. "0" means there is no limit to the maximum space used.
#(6) recycle:exclude = .tmp|.mp4: the type of file to be deleted without putting it in the recycle bin.
#(7) recycle:noversions = *.doc: If there is a file with the same name in the recycle bin directory, the file type that overwrites the original file, i.e. does not enable file versioning.

Deleted file test, the same file name will distinguish the version, the effect is as follows: .deleted hidden folder and pi directory are automatically generated, if not, it means /upan/download/ permission is not enough.

After modifying the configuration file, remember to restart samba before it takes effect

sudo systemctl restart smbd

All of the above are old high demand

Leave a Reply

Your email address will not be published. Required fields are marked *