Centos 7 vsftpd ldap 配置,centosvsftpd

來源:互聯網
上載者:User

Centos 7 vsftpd ldap 配置,centosvsftpd

#ldap 安裝配置 環境Centos7
#安裝
yum install -y openldap openldap-clients openldap-servers migrationtools pam_ldap python-ldap
# 關閉防火牆
systemctl stop firewalld.service
#佈建網域名解析
echo "192.168.20.43 aodun.com" >> /etc/hosts
#配置ldap服務

vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{2\}hdb.ldif
olcSuffix: dc=aodun(my-domain),dc=com
olcRootDN: cn=admin,dc=aodun(my-domain),dc=com
新增一行:
olcRootPW: 123456 #密碼根據自己需要修改

vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{1\}monitor.ldif
#修改dn.base=""中的cn、dc項 同上
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=extern
al,cn=auth" read by dn.base="cn=admin,dc=aodun(my-domain),dc=com" read by * none
#準備資料庫
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
chown -R ldap.ldap /var/lib/ldap
slaptest -u

56e7c83d ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif"
56e7c83d ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif"
config file testing succeeded #驗證成功
#啟動服務
systemctl start slapd
#
systemctl enable slapd
#檢查ldap
netstat -lt | grep ldap
netstat -tunlp | egrep "389|636"
#匯入基礎配置
cd /etc/openldap/schema/
#將目錄下所有.ldif檔案 匯入ldap
ldapadd -Y EXTERNAL -H ldapi:/// -D "cn=config" -f cosine.ldif
#產生基礎檔案
cd /usr/share/migrationtools/
vim migrate_common.ph
71行, 更改網域名稱
$DEFAULT_MAIL_DOMAIN = "aodun.com";
74行, 更改名稱
$DEFAULT_BASE = "dc=aodun,dc=com";
90行, 更改 schema 的值
$EXTENDED_SCHEMA = 1;
./migrate_base.pl >/root/base.ldif
#載入基礎檔案
ldapadd -x -W -D "cn=admin,dc=aodun,dc=com" -f /root/base.ldif
#配置vsftpd
yum install vsftpd
vim /etc/nslcd.conf
uri ldap://192.168.20.43/
base dc=aodun,dc=com
ssl no
service nslcd restart
vim /etc/openldap/ldap.conf
添加
host 192.168.20.43

# The distinguished name of the search base.
base dc=aodun,dc=com
uri ldap://aodun.com
binddn cn=admin,dc=aodun,dc=com
bindpw 123456
vim /etc/pam.d/vsftpd
刪除其他添加
auth required pam_ldap.so
account required pam_ldap.so
vim /etc/vsftpd/vsftpd.conf
# 將下面選項注釋去掉
anon_upload_enable=YES(匿名上傳)
anon_mkdir_write_enable=YES(匿名建立目錄)
allow_writeable_chroot=YES
xferlog_file=/var/log/xferlog(日誌,註:/var/log/xferlog需要手動建立)
# 並添加一下內容
pam_service_name=vsftpd(使用者驗證(/etc/pam.d/目錄下的vsftpd檔案)
userlist_enable=YES
tcp_wrappers=YES
use_localtime=YES
user_config_dir=/etc/vsftpd/userconf(虛擬使用者權限配置目錄,需要自己建立)
guest_enable=YES(啟用虛擬使用者)
guest_username=ftp(虛擬使用者宿主使用者)
# 配置各個使用者權限
vim /etc/vsftpd/userconf/admin(此檔案需要與使用者同名)
local_root=/ftp (使用者根目錄)
anon_world_readable_only=NO(上傳下載)
anon_other_write_enable=yes(刪除/重新命名)
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
service vsftpd restart

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.