英文:
AzureFiles access denied Linux
问题
我在虚拟机中遇到了文件访问问题。实际上,我有两个应用服务(Linux),它们挂载到AzureFiles。这个方法确实有效,但我试图将其中一个应用程序放在虚拟机上(Ubuntu 20)。
我可以使用Azure提供的SMB协议的脚本连接AzureFiles。但我在我的应用程序(Java)中遇到了一些错误:
AccessDeniedException | NoSuchFileException |
---|---|
Files.move() | // 对于目录中的文件 Files.delete(f) |
在应用服务应用上,文件以777的权限挂载,拥有nobody组,而在Azure VM上以777的权限挂载,拥有root组 | for循环正确检测到文件,但delete方法抛出了NoSuchFileException错误。 |
以下是挂载点:
应用服务:
//mystorage.file.core.windows.net/mypath /mypath cifs rw,relatime,vers=3.1.1,cache=strict,username=myusername,uid=0,noforceuid,gid=0,noforcegid,addr=x.x.x.x,file_mode=0777,dir_mode=0777,soft,persistenthandles,nounix,serverino,mapposix,mfsymlinks,noperm,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1 0 0
虚拟机:
//mystorage.file.core.windows.net/mypath /mypath cifs nofail,credentials=/etc/smbcredentials/mystorage.cred,dir_mode=0777,file_mode=0777,serverino,nosharesock,actimeo=30
编辑:似乎只有VM上应用程序创建的文件才会出现问题。如果我使用Azure Storage Explorer上传文件,delete函数就能正常工作。
有什么原因导致它不工作吗?
谢谢
英文:
I'm stuck with a problem of file access in my virtual machine.
I actually have two app services (linux) with a mounting point to the AzureFiles. This actually works but I'm trying to put one of the app on a virtual machine (ubuntu 20).
I can connect the AzureFiles using the provided script by Azure with the protocol SMB. But I have got some errors using my apps (Java):
AccessDeniedException | NoSuchFileException |
---|---|
Files.move() | // for f in directory Files.delete(f) |
Files are mount with 777 with nogroup nobody on the app service app, and 777 root root on the azure vm | Files are correctly detected by the for loop, but nosuchfile is thrown by delete. |
Here are the mounting points :
App service :
//mystorage.file.core.windows.net/mypath /mypath cifs rw,relatime,vers=3.1.1,cache=strict,username=myusername,uid=0,noforceuid,gid=0,noforcegid,addr=x.x.x.x,file_mode=0777,dir_mode=0777,soft,persistenthandles,nounix,serverino,mapposix,mfsymlinks,noperm,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1 0 0
VM:
//mystorage.file.core.windows.net/mypath /mypath cifs nofail,credentials=/etc/smbcredentials/mystorage.cred,dir_mode=0777,file_mode=0777,serverino,nosharesock,actimeo=30
EDIT : It seems to be stuck only with files created by the application on the VM. If I upload a file with Azure Strorage explorer, the delete function works.
Any idea why it doesn't work ?
Thanks
答案1
得分: 0
这是一个SMB性能问题,调整echo_interval=60,actimeo=1可以解决问题。
英文:
It was a SMB performance issue, adjusting echo_interval=60,actimeo=1 solves the problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论