我可以使用 AD/LDAP 身份验证登录 Ubuntu 16.04 系统并访问所有内容。但是,当我将 samba 配置为从 Windows 客户端连接时,它会失败。
来自另一台 Ubuntu 机器的 smbclient 成功并列出所有文件夹
smbclient -k -L serverip -U user%password
Sharename Type Comment
--------- ---- -------
public Disk
user Disk
IPC$ IPC IPC Service (Samba Server 4.3.11-Ubuntu)
Server Comment
--------- -------
servername Samba Server 4.3.11-Ubuntu
Workgroup Master
--------- -------
workgroup
任何人都可以为这种情况提供正确的 smb.conf 文件吗?互联网上的任何配置都不起作用。下面是我的 smb.conf
[global]
workgroup = {{ workgroup}}
server string = Samba Server %v
netbios name = server-fqdn
# Active Directory System
passdb backend = tdbsam
security = ads
idmap config * : range = 1000000-2000000
os level = 0
# With .tld
realm = {{ realm_id }}
local master = no
preferred master = no
domain master = no
#Auth
client use spnego = yes
client ntlmv2 auth = yes
ntlm auth = yes
lanman auth = no
encrypt passwords = yes
password server = *
restrict anonymous = 2
#log
log file = /var/log/samba/samba.log
log level = 2
#mapping
map to guest = bad user
guest account = nobody
unix extensions = yes
[ubuser]
path = /opt/samba/ubuser
valid users = %S, domain\ubuser
admin users = %S, domain\ubuser
writable = yes
read only = no
force create mode = 0660
create mask = 0777
directory mask = 0777
force directory mode = 0770
access based share enum = yes
hide unreadable = yes
我得到的错误是
../auth/credentials/credentials_secrets.c:396(cli_credentials_set_machine_account_db_ctx)
Could not find machine account in secrets database:
[2017/08/29 08:16:16.879389, 0] ../source3/auth/auth_domain.c:121(connect_to_domain_password_server)
connect_to_domain_password_server: unable to open the domain client session to machine machine.host.com. Error was : NT_STATUS_CANT_ACCESS_DOMAIN_INFO.
[2017/08/29 08:16:16.883324, 1] ../auth/credentials/credentials_secrets.c:396(cli_credentials_set_machine_account_db_ctx)
Could not find machine account in secrets database: Failed to fetch machine account password for WBI from both secrets.ldb (Could not find entry to match filter: '(&(flatname=domain)(objectclass=primaryDomain))' base: 'cn=Primary Domains': No such object: (null)) and from /var/lib/samba/private/secrets.tdb: NT_STATUS_CANT_ACCESS_DOMAIN_INFO
[2017/08/29 08:16:16.883435, 0] ../source3/auth/auth_domain.c:121(connect_to_domain_password_server)
connect_to_domain_password_server: unable to open the domain client session to machine machine.host.com. Error was : NT_STATUS_CANT_ACCESS_DOMAIN_INFO.
[2017/08/29 08:16:16.883811, 0] ../source3/auth/auth_domain.c:184(domain_client_validate)
domain_client_validate: Domain password server not available.
[2017/08/29 08:16:16.884142, 2] ../source3/auth/auth.c:315(auth_check_ntlm_password)
check_ntlm_password: Authentication for user [ubuser] -> [ubuser] FAILED with error NT_STATUS_NO_LOGON_SERVERS
[2017/08/29 08:16:16.884211, 2] ../auth/gensec/spnego.c:716(gensec_spnego_server_negTokenTarg)
SPNEGO login failed: NT_STATUS_NO_LOGON_SERVERS
[2017/08/29 08:16:17.238067, 2] ../source3/librpc/crypto/gse_krb5.c:196(fill_mem_keytab_from_secrets)
../source3/librpc/crypto/gse_krb5.c:196: failed to fetch machine password
通过在 samba 文件夹上设置正确的权限来解决。权限应与用户的主文件夹相同