我正在尝试针对我的 Active Directory 服务器对 Ubuntu 服务器上的 vsftpd 进行身份验证。我按照本文成功加入了域: https://nerdonthestreet.com/wiki?find=Authenticate+Ubuntu+19.04+against+Active+Directory 我可以正常登录 Linux 系统。然后我在 Ubuntu 20 上安装了 vsftpd。现在我可以使用本地用户正常访问 FTP 服务器,但使用 AD 用户时出现错误:“530 登录不正确。”。下面我将添加我的 vsftpd、pam 和 sssd conf,任何帮助都将不胜感激。
vsftpd.conf:
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=0022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
allow_writeable_chroot=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
SSD 配置如下:
[sssd]
services = nss, pam
config_file_version = 2
domains = server.local
[nss]
entry_negative_timeout = 0
#debug_level = 5
[pam]
#debug_level = 5
[domain/server.local]
#debug_level = 10
enumerate = false
id_provider = ad
auth_provider = ad
chpass_provider = ad
access_provider = ad
dyndns_update = false
ad_hostname = client1.server.local
ad_server = dc02.server.local
ad_domain = server.local
ldap_schema = ad
ldap_id_mapping = true
fallback_homedir = /home/%u
default_shell = /bin/bash
ldap_sasl_mech = gssapi
ldap_sasl_authid = CLIENT1$
krb5_keytab = /etc/sssd/my-keytab.keytab
ldap_krb5_init_creds = true
以下是 pam common-session conf:
session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session optional pam_umask.so
session required pam_unix.so
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
session optional pam_sss.so
session optional pam_systemd.so
# end of pam-auth-update config
vsftpd Pam 配置:
# Standard behaviour for ftpd(8).
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
# Note: vsftpd handles anonymous logins on its own. Do not enable pam_ftp.so.
# Standard pam includes
@include common-account
@include common-session
@include common-auth
auth required pam_shells.so
感谢您花时间阅读本文。
答案1
改变这些行 /etc/vsftpd/vsftpd.conf
匿名启用=是
#secure_chroot_dir=/var/run/vsftpd/空
添加以下几行:
用户列表启用=NO
tcp_wrappers=否
session_support=是
将这些行添加到/etc/pam.d/vsftpd
身份验证需要 pam_env.so
身份验证充分 pam_sss.so
帐户足够的pam_sss.so
会话需要 pam_loginuid.so
然后重新启动 vsftpd 服务:
sudo systemctl restart vsftpd