Linux

Samba 配置、狀態ñ噸小號噸一個_在小號一種CC和小號小號D和ñ一世和Dñ噸小號噸一種噸在小號一種CC和小號小號D和ñ一世和DNT_STATUS_ACCESS_DENIED,

  • October 30, 2019

我正在嘗試使用 centos7 配置 samba,以便從 Windows 10 客戶端訪問。

日誌級別 = 1在重新安裝 centos 後,我使用了來自同一伺服器的以前工作的 smb.conf。

log level = 10 你實際上可以跳過閱讀它,它的 10 級詳細資訊。

開始

我對配置 linux 伺服器非常陌生,我熟悉基本的 linux 命令ls chmod chown ...

我按照這篇文章在wlan網路上配置了一個安全共享,然後和同事一起測試,一切正常,只是他沒有共享的執行權限,路徑是/home/CompanyFiles/All

所以我執行了cd /home/

然後chmod -R 777 /

然後我成功更改了整個centos文件的權限並破壞了centos安裝。

經過一番Google搜尋後,我決定重新安裝 centos 比嘗試從 chmod 命令恢復更好,這是可行的,因為我只在上面安裝了 samba,所以我將 smb.conf 複製到另一台機器,重新安裝 centos 並重新安裝 samba,然後我使用舊的 smb.conf。

結尾

smb.conf:

[global]
       workgroup = WORKGROUP
       security = user
       map to guest = Bad User
       printing = cups
       printcap name = cups
       load printers = yes
       cups options = raw
       log level = 4
       #ntlm auth = yes
       passdb backend = tdbsam
       netbios name = adServer

[homes]
       comment = Home Directories
       valid users = %S, %D%w%S
       browsable = No
       read only = No
       inherit acls = Yes
[CompanyFiles]
       path = /home/CompanyFiles
       guest ok = yes
       browsable = no
       writable = yes

[All]
       comment = Company Access
       path = /home/CompanyFiles/All
       guest ok = no
       browsable = yes
       writable = yes
       #access based share enum = yes

文件夾的權限是:

drwxrwx--x. 3 everyad adusers 17 Feb 26 09:32 CompanyFiles

drwxrwx--x. 2 everyad adusers 42 Feb 26 11:43 All

其中所有使用者都是 adusers 組的成員。

嘗試訪問的使用者也是在 smb 上創建的smbpasswd -a username

但是嘗試從 Windows 10 訪問伺服器時出現以下錯誤

您沒有訪問伺服器的權限…

請不要說我刪除了 samba 並重新安裝它沒有成功。

當我收到日誌級別 4 時status[NT_STATUS_ACCESS_DENIED],但級別較低時我沒有收到錯誤。

[2018/03/07 12:16:46.480678,  4] ../source3/smbd/uid.c:384(change_to_user)
 Skipping user change - already user
[2018/03/07 12:16:46.480788,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.480835,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.480864,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.480913,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.481098,  4] ../source3/smbd/uid.c:384(change_to_user)
 Skipping user change - already user
[2018/03/07 12:16:46.481145,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.481172,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.481202,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.481244,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.481407,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.481671,  4] ../source3/rpc_server/rpc_ncacn_np.c:89(make_internal_rpc_pipe_socketpair)
 Create of internal pipe srvsvc requested
[2018/03/07 12:16:46.485044,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.485191,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.485232,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.485286,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.485387,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.485519,  4] ../source3/smbd/uid.c:384(change_to_user)
 Skipping user change - already user
[2018/03/07 12:16:46.485564,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.485593,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.485617,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.485662,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.486887,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.647037,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.647199,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.647244,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.647280,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.647399,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.647849,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.648141,  3] ../source3/rpc_server/srv_pipe.c:732(api_pipe_bind_req)
 api_pipe_bind_req: srvsvc -> srvsvc rpc service
[2018/03/07 12:16:46.648192,  3] ../source3/rpc_server/srv_pipe.c:355(check_bind_req)
 check_bind_req for srvsvc context_id=0
[2018/03/07 12:16:46.648242,  3] ../source3/rpc_server/srv_pipe.c:398(check_bind_req)
 check_bind_req: srvsvc -> srvsvc rpc service
[2018/03/07 12:16:46.762983,  4] ../source3/smbd/uid.c:384(change_to_user)
 Skipping user change - already user
[2018/03/07 12:16:46.807647,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.807736,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.807758,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.807777,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.807808,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.816357,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.816537,  4] ../source3/smbd/sec_ctx.c:217(push_sec_ctx)
 push_sec_ctx(1006, 1014) : sec_ctx_stack_ndx = 1
[2018/03/07 12:16:46.816566,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 1
[2018/03/07 12:16:46.816606,  4] ../source3/rpc_server/srv_pipe.c:1434(api_rpcTNP)
 api_rpcTNP: srvsvc op 0x10 - api_rpcTNP: rpc command: SRVSVC_NETSHAREGETINFO
[2018/03/07 12:16:46.816664,  4] ../source3/smbd/sec_ctx.c:439(pop_sec_ctx)
 pop_sec_ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.845244,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.845361,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.845381,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.845393,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.845409,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.845461,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.859382,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.859442,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.859458,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:46.859467,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:46.859482,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2449
[2018/03/07 12:16:46.859547,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:46.859580,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_FS_DRIVER_REQUIRED] || at ../source3/smbd/smb2_ioctl.c:309
[2018/03/07 12:16:48.603901,  4] ../source3/smbd/sec_ctx.c:321(set_sec_ctx_internal)
 setting sec ctx (1006, 1014) - sec_ctx_stack_ndx = 0
[2018/03/07 12:16:48.604057,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:48.604105,  4] ../source3/smbd/vfs.c:874(vfs_ChDir)
 vfs_ChDir to /home/CompanyFiles/All
[2018/03/07 12:16:48.604171,  3] ../source3/smbd/service.c:102(set_current_service)
 chdir (/home/CompanyFiles/All) failed, reason: Permission denied
[2018/03/07 12:16:48.604228,  3] ../source3/smbd/smb2_server.c:3097(smbd_smb2_request_error_ex)
 smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c

線上搜尋總是導致 selinux 的東西,防火牆或權限:

selinux是允許的

防火牆被禁用

仍然遇到同樣的問題

我終於設法解決了這個問題。

首先,我使用net use * /delete命令行從 Windows 10 中刪除了現有連接,因為憑據已保存,我在伺服器上更改了它們

也出於某種原因,我不得不smbpasswd在 /etc/samba/smb.conf 中指定:passdb backend = smbpasswd在該[global]部分

還有 /home 權限錯誤,我的所有共享都在 /home 中,所以我將權限重置為 755:chmod -R 755 /home

然後我根據我的需要重置所有共享權限和組訪問權限。

引用自:https://serverfault.com/questions/900440