我有一台本地服务器,其中有共享,用于本地计算机备份内容。
服务器有一个备份用户 (1002:1002)。
客户端有用户 alex(1000:1000),他也在该机器上的备份用户 (1002) 组中。
为了查找错误,我在代码片段中以备份用户身份登录。
有时(使用 chmod 777)我可以用 nano 编辑测试文件,有时不行,有时在第二次尝试时可以成功。所以这里肯定有什么可疑之处。
计划是让用户 alex 能够完全访问文件夹 snapraid_ignored 的内容。
服务器运行 Proxmox,客户端运行 Antergos Gnome。
服务器/etc/exports
/home/fileserver/storagepool 192.168.1.24(fsid=1,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/storagepool 192.168.1.24(fsid=1,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/storagepool/kodi 192.168.1.24(fsid=2,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/storagepool/Upload 192.168.1.24(fsid=3,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk6/Seafile 192.168.1.24(fsid=4,async,rw,no_subtree_check,all_squash,anonuid=1007,anongid=1000)
/home/fileserver/storagepool/test 192.168.1.24(fsid=5,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/storagepool/music 192.168.1.24(fsid=6,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/snapraid_logs 192.168.1.24(fsid=7,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk1 192.168.1.24(fsid=8,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk2 192.168.1.24(fsid=9,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk3 192.168.1.24(fsid=10,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk4 192.168.1.24(fsid=11,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk5 192.168.1.24(fsid=12,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/media/pool/disk6 192.168.1.24(fsid=13,async,rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
/home/fileserver/storagepool/Backups_external/snapraid_ignored 192.168.1.24(fsid=14,async,rw,no_subtree_check,all_squash,anonuid=1002,anongid=1002)
#/home/fileserver/storagepool/Backups_external/snapraid_ignored 192.168.1.24(fsid=14,async,rw,no_subtree_check)
/home/fileserver/storagepool/surveillance 192.168.1.24(fsid=15,async,rw,no_subtree_check,all_squash,anonuid=1001,anongid=1000)
客户/etc/autofs/auto.master
/nfs /etc/autofs/auto.myshares --ghost
/nfs/rpiradio /etc/autofs/auto.rpiradio --ghost
/nfs/torrent /etc/autofs/auto.torrent --ghost
/nfs/proxmox /etc/autofs/auto.proxmox --ghost
/nfs/terraria /etc/autofs/auto.terraria --ghost
/nfs/web14 /etc/autofs/auto.web14 --ghost
/nfs/web16 /etc/autofs/auto.web16 --ghost
/nfs/quake /etc/autofs/auto.quake --ghost
/net -hosts
+dir:/etc/autofs/auto.master.d
+auto.master
客户/etc/autofs/auto.proxmox
kodi -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/kodi
test -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/test
music -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/music
upload -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/Upload
backup -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/Backups_external/snapraid_ignored
homeassistant -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/homeassistant
surveillance -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/storagepool/surveillance
seafile -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/media/pool/disk6/Seafile
snapraid_logs -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.10:/home/fileserver/snapraid_logs
服务器:
root@pve:/home/fileserver/storagepool/Backups_external/snapraid_ignored# id backupuser
uid=1002(backupuser) gid=1002(backupuser) groups=1002(backupuser)
root@pve:/home/fileserver/storagepool/Backups_external/snapraid_ignored# ls -l
total 20
drwxrwxr-x 9 backupuser backupuser 4096 Jul 24 2016 Alex Dator
drwxrwxr-x 3 backupuser backupuser 4096 Jul 18 15:27 piRadio
drwxrwxr-x 3 backupuser backupuser 4096 Jul 18 15:37 Tbox
-rwxrwxr-x 1 backupuser backupuser 2 Aug 7 17:24 test
drwxrwxr-x 4 backupuser backupuser 4096 Oct 20 2017 Ubuntu
客户:
[backupuser@AlexStora backup]$ id backupuser
uid=1002(backupuser) gid=1002(backupuser) grupper=1002(backupuser),998(wheel)
[backupuser@AlexStora backup]$ id alex
uid=1000(alex) gid=985(users) grupper=985(users),1002(backupuser)
[backupuser@AlexStora backup]$ ls -l
totalt 20
drwxrwxr-x 9 backupuser backupuser 4096 24 jul 2016 'Alex Dator'
drwxrwxr-x 3 backupuser backupuser 4096 18 jul 15.27 piRadio
drwxrwxr-x 3 backupuser backupuser 4096 18 jul 15.37 Tbox
-rwxrwxrwx 1 backupuser backupuser 3 7 aug 18.24 test
drwxrwxr-x 4 backupuser backupuser 4096 20 okt 2017 Ubuntu
[backupuser@AlexStora backup]$ mv test test2
mv: kan inte flytta 'test' till 'test2': Åtkomst nekas
[backupuser@AlexStora backup]$ mkdir testfolder
mkdir: kan inte skapa katalog ”testfolder”: Åtkomst nekas
我通过尝试用 nano 编辑测试文件或尝试用 重命名它来测试写访问mv
。
A类似问题这里建议尝试使用 lsattr:
root@pve:/home/fileserver/storagepool/Backups_external/snapraid_ignored# lsattr
--------------e---- ./Ubuntu
--------------e---- ./piRadio
--------------e---- ./Tbox
--------------e---- ./test
--------------e---- ./Alex Dator
编辑
当我通过 ssh 进入我的 Raspberry Pi 时,它运行良好,我可以在共享上添加和编辑。我在 中使用它/etc/fstab
。
192.168.1.10:/home/fileserver/storagepool/Backups_external/snapraid_ignored /media/backup_on_server nfs _netdev,auto,noatime,nolock,bg,intr,tcp,actimeo=1800 0 0
在 Raspberry Pi 上,我没有备份用户,我以用户 pi 的身份执行所有操作。
因此,我在尝试使其工作的机器上做了同样的事情。我在 fstab 中添加了相同的行。我还删除了备份用户和组,并将自己从中删除。
这没什么区别。
答案1
我不确定为什么它会起作用,但将所有权更改/home/fileserver/storagepool/Backups_external/
为 backupuser:fileserver(而不是 backupuser:backupuser)却起作用了。我现在可以从我的电脑上添加、删除和编辑服务器上的文件。