Есть сервер, на нем бегают задания от юзеров. Раньше там юзера хранились локально, проблем с cron не возникало. Потом юзеров перенесли в LDAP. После этого задания от пользорвателей не срабатывали. Погуглив выяснил, что нужно включить службу nscd, которая кеширует имена пользователей. Где-то с неделю все работало отлично, сегодня опять обнаружили, что задания не сработали. В логе появились такие строчки:
crond(pam_unix)[хххх]: could not identify user (from getpwnam(юзернейм))
crond[хххх]: User not known to the underlying authentication module
Как лечить? Как правильно подружить cron и пользователей в LDAP?
Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
Модераторы: SLEDopit, Модераторы разделов
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
-
Ariasp
- Сообщения: 254
- Статус: NixLander
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
getent passwd - юзера выводятся
/etc/nsswitch.conf:
aliases: files nisplus
automount: files nisplus
bootparams: nisplus [NOTFOUND=return] files
ethers: files
group: files ldap
hosts: files dns
netgroup: nisplus
netmasks: files
networks: files
passwd: files ldap
protocols: files
publickey: nisplus
rpc: files
services: files
shadow: files ldap
К LDAP серверу у меня доступа нет.
/etc/nsswitch.conf:
aliases: files nisplus
automount: files nisplus
bootparams: nisplus [NOTFOUND=return] files
ethers: files
group: files ldap
hosts: files dns
netgroup: nisplus
netmasks: files
networks: files
passwd: files ldap
protocols: files
publickey: nisplus
rpc: files
services: files
shadow: files ldap
К LDAP серверу у меня доступа нет.
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
Обманул, файл лежит локально:
cat /etc/ldap.conf|grep -v ^#|grep -v ^$
base "OU=name,dc=my,dc=domain,dc=com"
uri ldaps://xx.xx.xx.xx ldaps://xx.xx.xx.xx ldaps://xx.xx.xx.xx
binddn sysLDAPsearch@mydomain.com
bindpw ########
timelimit 5
bind_timelimit 4
bind_policy soft
scope sub
nss_base_passwd OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub
nss_base_shadow OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub
nss_base_group OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub?&(objectCategory=group)(gidnumber=*)
nss_map_objectclass posixAccount user
nss_map_objectclass shadowAccount user
nss_map_objectclass posixGroup group
nss_map_attribute gecos cn
nss_map_attribute homeDirectory unixHomeDirectory
nss_map_attribute uniqueMember member
ssl on
port 636
tls_checkpeer no
TLS_CACERTDIR /etc/openldap/cacerts/
pam_filter objectclass=User
pam_password ad
sasl_secprops maxssf=0
cat /etc/ldap.conf|grep -v ^#|grep -v ^$
base "OU=name,dc=my,dc=domain,dc=com"
uri ldaps://xx.xx.xx.xx ldaps://xx.xx.xx.xx ldaps://xx.xx.xx.xx
binddn sysLDAPsearch@mydomain.com
bindpw ########
timelimit 5
bind_timelimit 4
bind_policy soft
scope sub
nss_base_passwd OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub
nss_base_shadow OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub
nss_base_group OU=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?sub?&(objectCategory=group)(gidnumber=*)
nss_map_objectclass posixAccount user
nss_map_objectclass shadowAccount user
nss_map_objectclass posixGroup group
nss_map_attribute gecos cn
nss_map_attribute homeDirectory unixHomeDirectory
nss_map_attribute uniqueMember member
ssl on
port 636
tls_checkpeer no
TLS_CACERTDIR /etc/openldap/cacerts/
pam_filter objectclass=User
pam_password ad
sasl_secprops maxssf=0
-
Ariasp
- Сообщения: 254
- Статус: NixLander
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
Для полноты ещё увидеть результат
cat /etc/pam.d/system-auth
cat /etc/pam.d/cron
cat /etc/pam.d/system-auth
cat /etc/pam.d/cron
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
cat /etc/pam.d/crond
#
# The PAM configuration file for the cron daemon
#
#
auth sufficient pam_rootok.so
auth required pam_stack.so service=system-auth
auth required pam_env.so
account required pam_stack.so service=system-auth
account required pam_access.so
session required pam_limits.so
session required pam_loginuid.so
#
# The PAM configuration file for the cron daemon
#
#
auth sufficient pam_rootok.so
auth required pam_stack.so service=system-auth
auth required pam_env.so
account required pam_stack.so service=system-auth
account required pam_access.so
session required pam_limits.so
session required pam_loginuid.so
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
cat /etc/pam.d/system-auth
auth required pam_env.so
auth sufficient pam_unix.so likeauth nullok
auth sufficient pam_krb5.so use_first_pass forwardable
auth required pam_tally.so deny=5 onerr=fail no_magic_root
auth required pam_deny.so
account required pam_tally.so deny=3 reset no_magic_root
account required pam_unix.so
password required pam_passwdqc.so min=disabled,8,8,8,8 passphrase=0 random=0 enforce=everyone
password sufficient pam_unix.so remember=11 use_authtok md5 shadow
password sufficient pam_ldap.so use_authtok use_first_pass
password required pam_deny.so
session required pam_limits.so
session required pam_unix.so
session optional pam_krb5.so
session required pam_mkhomedir.so umask=0022 skel=/etc/skel
auth required pam_env.so
auth sufficient pam_unix.so likeauth nullok
auth sufficient pam_krb5.so use_first_pass forwardable
auth required pam_tally.so deny=5 onerr=fail no_magic_root
auth required pam_deny.so
account required pam_tally.so deny=3 reset no_magic_root
account required pam_unix.so
password required pam_passwdqc.so min=disabled,8,8,8,8 passphrase=0 random=0 enforce=everyone
password sufficient pam_unix.so remember=11 use_authtok md5 shadow
password sufficient pam_ldap.so use_authtok use_first_pass
password required pam_deny.so
session required pam_limits.so
session required pam_unix.so
session optional pam_krb5.so
session required pam_mkhomedir.so umask=0022 skel=/etc/skel
-
danger08
- Сообщения: 715
- ОС: Linux (CentOS, Ubuntu)
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
Неправда ваша, nscd совсем не обязательна (призвана лишь кэшировать запросы имен, и снижать время отклика на их поиске).
На практике я с ним больше проблем поимел, чем пользы. У меня он везде отключен (в т.ч. на DC с сотней пользователей в LDAP).
А так, вообще достаточно pam-ldap настроить. У меня RHEL/Centos, так для быстроты обычно делаю через "Authentication Settings" меню setup
Блогосайт - http://www.fateyev.com
-
guglez
- Сообщения: 394
- ОС: GNU/Linux
Re: Проблема с выполнением заданий cron от юзеров, хранящихся в LDAP
С nscd кое-как работает, без нее совсем не работает. В меню лазить не могу, т.к. не ясно какие файлы затронет гуевая конфигурялка, а сервер не мой и находится очень далеко.