.net core 对文件的权限被拒绝。使用带samba装载的C#dotnet core CENTOS复制
使用File.Copy时.net core 对文件的权限被拒绝。使用带samba装载的C#dotnet core CENTOS复制,.net-core,centos,samba,.net Core,Centos,Samba,使用File.Copy时 File.Copy(file.FullName, Path.Combine(config.DestinationDir, file.Name), true); 我遇到了以下问题: "ClassName": "System.UnauthorizedAccessException", "Message": "Access to the path is denied.",
File.Copy(file.FullName, Path.Combine(config.DestinationDir, file.Name), true);
我遇到了以下问题:
"ClassName": "System.UnauthorizedAccessException",
"Message": "Access to the path is denied.",
"Data": null,
"InnerException": {
"ClassName": "System.IO.IOException",
"Message": "Operation not permitted",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": null,
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": 1,
"Source": null,
"WatsonBuckets": null
}
这看起来是权限问题。然而:
- 我对源文件夹和目标文件夹都有正确的权限
- 我可以在目标文件夹上执行mv/cp/touch等命令,而不会出现问题
- 仅当目标文件夹是SAMBA mnt时,才会出现此问题
- 我使用File.Read和File.Write没有问题(如果它链接到一些基本的权限问题,那么应该触发异常)
- 如果我用SUDO运行命令,没有问题
drwxrwxr-x. 2 svc_smb_share grp_smb_share 0 24 jui 14:49 DestinationFolder
我的用户属于grp\U smb\U共享,因此具有读/写/执行权限
关于我的配置的说明:
- 使用Centos的服务器(Centos-release-7-7.1908.0.el7.Centos.x86_64)
- dotnet核心(3.1.100)