首页 > 解决方案 > 使用带有 samba 挂载的 C# dotnet core CENTOS 对 File.Copy 的权限被拒绝

问题描述

使用 File.Copy 时,

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
        }

这看起来是一个权限问题。然而:

这是目标文件夹上 ls -ld 的结果:

drwxrwxr-x. 2 svc_smb_share grp_smb_share 0 24 jui 14:49 DestinationFolder

我的用户属于 grp_smb_share,因此具有读/写/执行权限。

关于我的配置的说明:

你有什么线索吗?

标签: .net-corecentossamba

解决方案


推荐阅读