问题原文
原帖链接 · Cutton Eye · CC BY-SA 4.0
A file is hosted by a samba server (18.04). The file contains a backup of this 18.04-server. Some MS-Based backup tool (on a windows-server) needs a so called Archive-Bit set, to backup this specific file. If not set, this file is ignored during the backup from 18.04-server to windows-server.
I feed my shared folder via the local file system on the samba host /var/mySharedFolder/. Which ever file I put it the local folder it's shown in the samba share entered by an other windows-server via //18.04-server/mySharedFolder.
How can I set the archive bit from 18.04-server side to the uploaded file?
已采纳解答
原帖链接 · Wojtek_B · CC BY-SA 4.0
By default Samba preserves archive file attribute (from DOS/Windows file system) on Linux file system.
Here's a detailed explanation about preserving archive attribute.
It's done by setting the executable bit for for the owner when a file has archive attribute on; for example:
-rw-rw---- 1 nobody nogroup 0 Nov 26 11:21 file_no_arch.txt
-rwxrw---- 1 nobody nogroup 0 Nov 26 11:55 smb_crt.txt
As you can see the file "file_no_arch.txt" has executable bit off and when you view it in windows it will say it's non archive. File "smb_crt.txt" has this bit on so it will have archive attribute on too.
If the files uploaded from windows box do not have archive attribute set - check your Samba configuration (/etc/samba/smb.conf) - specifically two things:
- make sure there's no "map archive = no" line in the file. If it's there just delete or comment it.
- check [mySharedFolder] section - if there's "create mask = 0600" change it to "create mask = 0700" or 0755 to give other linux users' ability to view files.
For testing I've set up a Debian 9 box and installed Samba as explained here. The other system used for testing was Windows server 2012.
If you just want to make windows box think, the file has archive attribute on then you can just type:
chmod +x my_backup_file.zip
And if you use some script to create this backup file then just put this command in it and every file will have this bit on.
My example smb.conf file:
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0700
directory mask = 0700
valid users = %S
[public]
comment = public anonymous access
path = /var/samba/
browsable =yes
create mask = 0760
directory mask = 0771
writable = yes
guest ok = yes
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
