Dell Unity:Unity 升級至 5.5 後,無法存取 NFS 匯出中的檔案或資料夾
Summary: Unity 升級至 5.5 後,Linux 使用者可能無法存取網路檔案系統 (NFS) 匯出中的某些檔案或資料夾。(使用者可修正)
This article applies to
This article does not apply to
This article is not tied to any specific product.
Not all product versions are identified in this article.
Symptoms
- 使用者可能會注意到在 Unity 升級至 5.5 後,某些檔案無法存取或資料夾無法列出,
- 此問題僅在以下情況下發生:
- 用戶端使用 NFSv4.2 掛接 NFS 匯出,如果用戶端使用 NFSv3、NFSv4.0 或 4.1 掛接 NFS 匯出,則存取良好。
- SELinux 在 Linux 用戶端上啟用。
下面是一個範例:
- 使用者test_user無法列出 NFS 掛接點的內容
/mnt使用 NFSv4.2 掛接時。
[test_user@RHEL4 ~]$ mount -v | grep -i mnt 10.xx.xx.48:/test on /mnt type nfs4 (rw,relatime,seclabel,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.227.xxx.129,local_lock=none,addr=10.60.15.48) [test_user@RHEL4 ~]$ ls -al /mnt ls: cannot open directory '/mnt': Permission denied
- 在用戶端使用 NFSv4.1 重新掛接 NFS 匯出後,使用者test_user可以列出相同的資料夾。
[test_user@RHEL4 ~]$ mount -v | grep -i mnt 10.xx.xx.48:/test on /mnt type nfs4 (rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.227.xxx.129,local_lock=none,addr=10.60.15.48) [test_user@RHEL4 ~]$ ls -al /mnt total 16 drwxrwxrwx. 6 root root 8192 Jun 18 03:21 . dr-xr-xr-x. 20 root root 271 Jun 8 19:07 .. dr-xr-xr-x. 2 root bin 152 Apr 14 03:56 .etc drwxr-xr-x. 2 root root 152 Jun 18 03:20 folder drwxr-xr-x. 2 root root 8192 Apr 14 03:56 lost+found
Cause
- 從 UnityOS 5.5 開始,Unity 新增了對 NFSv4.2 的支援。NFSv4.2 通訊協定支援帶來額外的安全性和效能,以及備援檔案和 NFS 標籤的 NFS 屬性支援。
- NFSV4.2 中的安全標籤功能允許在 NFS 共用上存儲和強制使用安全標籤(例如 SELinux 上下文)。根據預設,此功能在 Unity NAS 伺服器上為啟用。
- 在 Linux 用戶端上啟用 SELinux 時,它會為系統中的每個物件(包括檔、資料夾、進程、埠和設備)分配一個安全標籤。
- SELinux 指派給使用 NFS v3、v4.0 或 v4.1 掛接的 NFS 匯出檔案的預設安全性上下文為
system_u:object_r:nfs_t:s0。
[root@rhel8 test]# ls -alZ testv4.1 -rw-r--r--. 1 root root system_u:object_r:nfs_t:s0 0 Jun 1 21:47 testv4.1
- 當用戶端使用 NFS v4.2 掛接 NFS 匯出時,NFS 檔案的預設安全性內容會變更為
unconfined_u:object_r:default_t:s0。
[root@rhel8 test]# ls -alZ testv4.2 -rw-r--r--. 1 root root unconfined_u:object_r:default_t:s0 0 Jun 1 2025 testv4.2
- 安全上下文(尤其是安全類型從 nfs_t 更改為 default_t 可能會導致一些訪問問題,因為 SELinux 根據計算使用者或進程以及檔或資料夾的安全類型的策略規則確定訪問許可權。
Resolution
有幾種解決方法。用戶應根據其優先順序選擇一個解決方案:安全性、簡單性或功能要求。
- 使用 NFSv4.1、NFSv4.0 或 NFSv3,從用戶端重新掛接 NFS 匯出
mount -o vers=4.1 <nas server IP>:/<export> /<localmountpoint>
- 使用 NFSv4.2 掛接 NFS 匯出,但請指定安全性核心
mount -o context=system_u:object_r:nfs_t:s0 <nas server IP>:/<export> /<localmountpoint>
- 將 Unity 上支援的最大 NFSv4 版本從 v4.2 降級至 v4.1。
Dell Unity:升級至 Unity OE 5.5 版後,NFSv4 用戶端無法存取資料
- 停用 Unity 上的安全性標籤
Dell Unity:如何在 Unity OE 5.5 上停用 NFS 的安全性標籤 (使用者可修正)
- 根據需求,將 NFS 匯出中的檔案安全性類型變更為適當的檔案。
chcon <user>:<role>:<type>:<level> <file/folders>
For example, change the file type to nfs_t.
[root@RHEL4 /]# ls -alZ /mnt/nfsv4.2
-rw-r--r--. 1 root root system_u:object_r:default_t:s0 0 Jun 17 00:53 /mnt/nfsv4.2
[root@RHEL4 /]# chcon -t nfs_t /mnt/nfsv4.2
[root@RHEL4 /]# ls -alZ /mnt/nfsv4.2
-rw-r--r--. 1 root root system_u:object_r:nfs_t:s0 0 Jun 17 00:53 /mnt/nfsv4.2
Additional Information
您可以遵循以下程序來故障診斷 SELinux 存取問題。
1.確定使用者的安全上下文。
[test_user@RHEL4 ~]$ id -Z user_u:user_r:user_t:s0
- 確認 NFS 匯出已使用 NFSv4.2 掛接,並且
seclabel已啟用。
[test_user@RHEL4 ~]$ mount -v | grep mnt 10.xx.xx.48:/test on /mnt type nfs4 (rw,relatime,seclabel,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.227.xxx.129,local_lock=none,addr=10.xx.xx.48)
- 檢查檔案安全性背景關係並重現問題
[test_user@RHEL4 ~]$ ls -aldZ /mnt drwxrwxrwx. 6 root root system_u:object_r:default_t:s0 8192 Jun 17 07:44 /mnt [test_user@RHEL4 ~]$ ls -al /mnt ls: cannot open directory '/mnt': Permission denied
- 查
auditlog以確認命令失敗的原因。
[root@RHEL4 ~]# ausearch -m avc -ts recent | tail
----
time->Tue Jun 17 18:30:59 2025
type=PROCTITLE msg=audit(1750xxxx59.577:8407): proctitle=6C73002D2D636F6C6F723Dxxxxx46F002D616C002F6D6E74
type=SYSCALL msg=audit(1750203059.577:8407): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=5563f160ca70 a2=90800 a3=0 items=0 ppid=104637 pid=104661 auid=10086 uid=10086 gid=10086 euid=10086 suid=10086 fsuid=10086 egid=10086 sgid=10086 fsgid=10086 tty=pts1 ses=246 comm="ls" exe="/usr/bin/ls" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1750xxxx59.577:8407): avc: denied { read } for pid=104661 comm="ls" name="/" dev="0:47" ino=2 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:default_t:s0 tclass=dir permissive=0
- 當使用者執行時
ls在/mnt,ls進程繼承使用者的安全類型,SELinux系統確定安全類型user_t是否對檔類型default_t具有讀取許可權。在這種情況下,ls命令失敗,因為源安全類型 user_t 對檔的安全類型default_t沒有讀取許可權。
這可以通過檢查安全策略規則來確認。
root@RHEL4 ~]# sesearch -A -s user_t -t default_t -p read [root@RHEL4 ~]#
- 以下命令列出了user_t類型 default_t 上的所有許可權類型。
[root@RHEL4 ~]# sesearch -A -s user_t -t default_t
allow domain base_file_type:dir { getattr open search };
allow domain file_type:blk_file map; [ domain_can_mmap_files ]:True
allow domain file_type:chr_file map; [ domain_can_mmap_files ]:True
allow domain file_type:file map; [ domain_can_mmap_files ]:True
allow domain file_type:lnk_file map; [ domain_can_mmap_files ]:True
allow user_usertype file_type:filesystem getattr;
- 在上述輸出中,user_t 屬於網域,default_t屬於 base_file_type。所以user_t只有
getattr,打開,對default_t類型的目錄的搜索許可權。
[root@RHEL4 mnt]# seinfo -t default_t -x Types: 1 type default_t, base_file_type, file_type, mountpoint, non_auth_file_type, non_security_file_type; [root@RHEL4 mnt]# seinfo -t user_t -x | grep domain type user_t, application_domain_type, nsswitch_domain, corenet_unlabeled_type, domain, kernel_system_state_reader, netlabel_peer_type, privfd, process_user_target, scsi_generic_read, scsi_generic_write, syslog_client_type, pcmcia_typeattr_1, user_usertype, login_userdomain, userdomain, unpriv_userdomain, userdom_home_reader_type, userdom_filetrans_type, xdmhomewriter, x_userdomain, x_domain, dridomain, xdrawable_type, xcolormap_type; /pre>
- 使用者可以
cd的輸出傳送至/mnt因為允許打開。
>allow domain base_file_type:dir { getattr open search }; <<<<
[test_user@RHEL4 ~]$ cd /mnt
[test_user@RHEL4 mnt]$ ls
ls: cannot open directory '.': Permission deniedAffected Products
Dell EMC Unity, Dell Unity Operating Environment (OE)Article Properties
Article Number: 000334013
Article Type: Solution
Last Modified: 25 Jun 2025
Version: 2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.