CentOS 6 + LDAP + NFS การเป็นเจ้าของไฟล์ค้างอยู่ที่“ ไม่มีใคร”


11

ฉันพยายามรับการรับรองความถูกต้องของ LDAP และ NFS ส่งออกไดเรกทอรีบ้านใน CentOS 6 ทำงานได้สองสามวันแล้ว ฉันได้รับจนถึงจุดที่ฉันสามารถเข้าสู่ระบบเครื่องลูกค้าโดยใช้ชื่อผู้ใช้และรหัสผ่านใน LDAP บนไคลเอ็นต์ / home และ / opt ถูกเมาท์ใน fstab บน NFS อย่างไรก็ตามทุกไฟล์ในทั้ง / opt และ / home นั้นเป็นของnobody:nobody(uid: 99, gid: 99) บนไคลเอ็นต์

อย่างไรก็ตาม uid และ gid ของฉันดูเหมือนจะถูกตั้งค่าอย่างถูกต้อง:

-bash-4.1$ id
uid=3000(myusername) gid=3000(employees) groups=3000(employees)

ฉันจะตรวจสอบอะไรอีก นี่คือไฟล์ปรับแต่งบางอย่างในไคลเอนต์ของฉัน:

/etc/nsswitch.conf

passwd:     files sss
shadow:     files sss
group:      files sss

hosts:      files dns

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   files sss

publickey:  nisplus

automount:  files ldap
aliases:    files nisplus

/etc/sssd/sssd.conf

[sssd]
config_file_version = 2
services = nss, pam

domains = default
[nss]

[pam]


[domain/default]
auth_provider = ldap
ldap_id_use_start_tls = True
chpass_provider = ldap
cache_credentials = True
krb5_realm = EXAMPLE.COM
ldap_search_base = dc=mycompany,dc=com
id_provider = ldap
ldap_uri = ldaps://server.subdomain.mycompany.com
krb5_kdcip = kerberos.example.com
ldap_tls_cacertdir = /etc/openldap/cacerts

# Configure client certificate auth.
ldap_tls_cert = /etc/openldap/cacerts/client.pem
ldap_tls_key = /etc/openldap/cacerts/client.pem
ldap_tls_reqcert = demand

/ etc / fstab

/dev/mapper/vg_main-lv_root /                       ext4    defaults        1 1
UUID=4e43a15d-4dc0-4836-8fa6-c3445fde756c /boot                   ext4    defaults        1 2
/dev/mapper/vg_main-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
storage1:/nas/home  /home  nfs   soft,intr,rsize=8192,wsize=8192
storage1:/nas/opt  /opt  nfs   soft,intr,rsize=8192,wsize=8192

เอาต์พุต authconfig:

[root@test1 ~]# authconfig --test
caching is disabled
nss_files is always enabled
nss_compat is disabled
nss_db is disabled
nss_hesiod is disabled
 hesiod LHS = ""
 hesiod RHS = ""
nss_ldap is enabled
 LDAP+TLS is enabled
 LDAP server = "ldaps://server.subdomain.mycompany.com"
 LDAP base DN = "dc=mycompany,dc=com"
nss_nis is disabled
 NIS server = ""
 NIS domain = ""
nss_nisplus is disabled
nss_winbind is disabled
 SMB workgroup = ""
 SMB servers = ""
 SMB security = "user"
 SMB realm = ""
 Winbind template shell = "/bin/false"
 SMB idmap uid = "16777216-33554431"
 SMB idmap gid = "16777216-33554431"
nss_sss is disabled by default
nss_wins is disabled
nss_mdns4_minimal is disabled
DNS preference over NSS or WINS is disabled
pam_unix is always enabled
 shadow passwords are enabled
 password hashing algorithm is sha512
pam_krb5 is disabled
 krb5 realm = "EXAMPLE.COM"
 krb5 realm via dns is disabled
 krb5 kdc = "kerberos.example.com"
 krb5 kdc via dns is disabled
 krb5 admin server = "kerberos.example.com"
pam_ldap is enabled
 LDAP+TLS is enabled
 LDAP server = "ldaps://server.subdomain.mycompany.com"
 LDAP base DN = "dc=mycompany,dc=com"
 LDAP schema = "rfc2307"
pam_pkcs11 is disabled
 use only smartcard for login is disabled
 smartcard module = ""
 smartcard removal action = ""
pam_fprintd is enabled
pam_winbind is disabled
 SMB workgroup = ""
 SMB servers = ""
 SMB security = "user"
 SMB realm = ""
pam_sss is disabled by default
 credential caching in SSSD is enabled
 SSSD use instead of legacy services if possible is enabled
pam_cracklib is enabled (try_first_pass retry=3 type=)
pam_passwdqc is disabled ()
pam_access is disabled ()
pam_mkhomedir or pam_oddjob_mkhomedir is enabled ()
Always authorize local users is enabled ()
Authenticate system accounts against network services is disabled

คุณไม่จำเป็นต้องเชื่อมต่อ NAS ของคุณกับ LDAP เช่นกันหากคุณต้องการให้ ID เดียวกันกับแขกของคุณใช่ไหม
— Yanick Girouard

Yanick ขอบคุณสำหรับการตอบกลับ หน่วย NAS ของฉันเป็นเพียง CentOS อีกกล่องที่ใช้ NFS daemon มันกำหนดค่าเช่นเดียวกับไคลเอนต์ LDAP อื่นของฉันและมีปัญหา "ไม่มีใคร" เหมือนกัน
— jamieb

คำตอบ:


22

หมายเหตุที่เพิ่มลงในสิ่งนี้สำหรับผู้ค้นหา google - เรามีปัญหาเดียวกันโดยไม่คำนึงถึงสิ่งที่เราทำการเมาต์ nfs จะไม่แมปรหัสผู้ใช้อย่างถูกต้อง

ปัญหาคือ idmapd ได้แคชรหัสที่ไม่ถูกต้องจากการตั้งค่าผิดพลาดและไม่มีการแก้ไขการกำหนดค่าจะเรียงลำดับ

คำสั่งบน centos เพื่อแก้ไขปัญหานี้คือ nfsidmap -c (ล้างแคช)

หวังว่านี่จะช่วยผู้ค้นหาบางรายได้


18

แก้ไข!

ฉันบังเอิญสังเกตเห็นบรรทัดนี้ใน/var/log/messagesเซิร์ฟเวอร์ NFS ของฉันเมื่อฉันพยายามเมาท์การส่งออกจากไคลเอนต์ระยะไกล:

Feb 28 15:54:02 storage1 rpc.idmapd[1651]: nss_getpwnam: name 'nobody' does not map into domain 'localdomain'

นี่ทำให้ฉันดูสองสามบรรทัดแรกของ/etc/idmapd.conf:

[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
#Domain = local.domain.edu

ฉันเพิ่มแล้วDomain=subdomain.mycompany.comภายใต้บรรทัด "โดเมน" แสดงความคิดเห็น ที่บันทึกไว้ออกแล้ววิ่งและ/etc/init.d/rpcidmapd restart/etc/init.d/nfs restart


สิ่งนี้ช่วยฉัน ฉันจะทราบว่าฉันต้องทำการเปลี่ยนแปลงนี้ทั้งบนเซิร์ฟเวอร์และไคลเอนต์ทั้งหมด
— Michael Hampton

1

ฉันพบโพสต์บล็อกที่อาจแก้ไขปัญหาของคุณ: http://whacked.net/2006/07/26/nfsv4nfs-mapid-nobody-domain/ซึ่งฉันพบได้จากโพสต์ในฟอรัมต่อไปนี้: https: //www.centos org / modules / newbb / viewtopic.php? topic_id = 32977


ฉันโพสต์เรื่องนี้ล่าช้า แต่ดูเหมือนว่ามันเป็นสิ่งที่คล้ายกันซึ่งแก้ไขเพื่อคุณ สิ่งที่ดี!
— Yanick Girouard

0

เซิร์ฟเวอร์ NFS ของคุณใช้ Centos / RHEL 5 โดยบังเอิญหรือไม่?

ถ้าเป็นเช่นนั้นมันกำลังส่งออก NFSv3 NFSv4 เป็นค่าเริ่มต้นสำหรับ Centos6 (และรุ่นล่าสุดของ Ubuntu)

การแก้ไขอย่างรวดเร็วคือการเพิ่ม "vers = 3" ในตัวเลือกการติดตั้งใน / etc / fstab

เช่น

//10.0.0.1:/home / home ค่าเริ่มต้น nfs, vers = 3, rw, noatime 0 0


ขอบคุณสำหรับคำแนะนำ เซิร์ฟเวอร์ LDAP ไคลเอ็นต์และเซิร์ฟเวอร์ NFS กำลังทำงานทั้งหมด CentOS 6.2 ฉันได้รับอนุญาตถูกปฏิเสธข้อผิดพลาดในไคลเอนต์เมื่อฉันพยายามที่จะเมามันด้วยตัวเลือกรุ่น 3
— jamieb

คุณกำลังทดสอบสิ่งนี้ในฐานะผู้ใช้รูทหรือไม่? บางที่มีประโยชน์อ่านแสงlinuxtopia.org/online_books/rhel6/rhel_6_storage_admin/... อาจคุ้มค่าที่จะเปิดใช้งาน no_root_squash บนเซิร์ฟเวอร์ NFS
— NcA

แก้ไขแล้ว (ดูคำตอบด้านล่าง)! ขอบคุณที่ให้ฉันคิดถึง NFS มากขึ้นเพราะฉันดู LDAP เป็นส่วนใหญ่
— jamieb

0

ทุกอย่างถูกแมปกับ "ไม่มีใคร" ดูเหมือนว่า all_squash เปิดอยู่

ดูที่:

http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-nfs-server-config-exports.html

และตรวจสอบว่าไฟล์ / etc / exports ของเซิร์ฟเวอร์ NFS ไม่ได้ทำการสควอช UID โดยไม่ได้ตั้งใจ "no_all_squash" ควรจะเป็นค่าเริ่มต้น แต่คุณสามารถลองตั้งค่าได้อย่างชัดเจนและดูว่าเกิดอะไรขึ้น


1
โชคไม่ดีโชคไม่ดี แต่ที่น่าสนใจmount storage1:/nas/opt /mnt/testในไคลเอนต์แบบสแตนด์อโลนยังคงให้ฉัน "ไม่มีใคร" ปัญหา แต่คำสั่งเดียวกันบนเซิร์ฟเวอร์ NFS ทำงานได้โดยไม่มีปัญหา ฉันหวังว่าฉันจะรู้ว่านี่เป็นปัญหาของ NFS หรือ SSSD / NSS
— jamieb

0

การแก้ไขสำหรับฉันคือการตรวจสอบให้แน่ใจว่ามีการบันทึก DNS สำหรับเครื่องท้องถิ่น ช่วยได้เช่นกันหากมีการบันทึกการค้นหาแบบย้อนกลับ เป็นผลให้ไม่มีผู้ใช้และกลุ่มที่ถูกแทนที่ด้วยรูท มันง่ายแค่ไหน!? PS อย่าลืมรีบูตเครื่องท้องถิ่นเมื่อสร้างระเบียน DNS แล้ว

โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.