Linux – Unable to Create LDAP User’s Home Directory

fedoraldaplinux

I have a Fedora Linux server, connected to LDAP, and I can't log in to it as my normal user.

I can still log in as root, but even then, I can't create my normal user's home directory. LDAP is configured to auto-mount the user's home directory, but this doesn't seem to be happening. Regretfully, mkdir gives me no useful error message. e.g.

[myuser@localhost ~]# ssh myuser@otherhost
Connection closed by otherhost
[myuser@localhost ~]# ssh root@otherhost
[root@otherhost ~]# cd /home
[root@otherhost home]# ls
[root@otherhost home]# mkdir myuser
mkdir: cannot create directory `myuser': No such file or directory

What is causing this error?

I suspect something with LDAP has gotten fubared, and that's preventing the directory creation. However, I'm not sure where to begin researching this, as I'm not seeing any useful error messages.

How should I investigate this? Googling for problems creating home directories only gives me a million entries about using mkdir -p, which doesn't help.

EDIT: otherhost:/etc/fstab contains the following line, which defines the mount point for /home:

/dev/mapper/vg_otherhost-lv_home /home                   ext4    defaults        1 2

EDIT: vgdiplay output

[root@otherhost ~]# vgdisplay -v
    Finding all volume groups
    Finding volume group "vg_otherhost"
  --- Volume group ---
  VG Name               vg_otherhost
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               149.50 GiB
  PE Size               32.00 MiB
  Total PE              4784
  Alloc PE / Size       4784 / 149.50 GiB
  Free  PE / Size       0 / 0   
  VG UUID               UnbJdL-v1XY-2HzI-QoHQ-jwtD-0U6N-Nuh66I

  --- Logical volume ---
  LV Name                /dev/vg_otherhost/lv_root
  VG Name                vg_otherhost
  LV UUID                m1Lp6A-SHqa-V3Of-r8GS-TpE6-R42B-M99DbQ
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             1600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/vg_otherhost/lv_home
  VG Name                vg_otherhost
  LV UUID                pqxV47-8QyV-gFpi-xAdn-gfIq-wdV3-rkIeXN
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                93.66 GiB
  Current LE             2997
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/vg_otherhost/lv_swap
  VG Name                vg_otherhost
  LV UUID                f4tqzv-cxEh-rlmU-mByY-RdkM-V1Iz-o4gCRv
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                5.84 GiB
  Current LE             187
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               lQDn1b-emBB-b75e-e6kt-KxBu-OheR-mB12Ac
  PV Status             allocatable
  Total PE / Free PE    4784 / 0

Autofs appears to be running.

Contents of /etc/auto.master:

/misc   /etc/auto.misc
/net    -hosts
+auto.master

Contents of /etc/auto.misc:

cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

Contents of /etc/auto.net:

#!/bin/bash

key="$1"

opts="-fstype=nfs,hard,intr,nodev,nosuid"

for P in /bin /sbin /usr/bin /usr/sbin
do
    for M in showmount kshowmount
        do
            if [ -x $P/$M ]
                then
                        SMNT=$P/$M
                        break
                fi
        done
done

[ -x $SMNT ] || exit 1

SHOWMOUNT="$SMNT --no-headers -e $key"

$SHOWMOUNT | LC_ALL=C sort -k 1 | \
        awk -v key="$key" -v opts="$opts" -- '
        BEGIN   { ORS=""; first=1 }
                { if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
        END     { if (!first) print "\n"; else exit 1 }
        ' | sed 's/#/\\#/g'

Contents of /etc/auto.smb:

#!/bin/bash

key="$1"
opts="-fstype=cifs"

for P in /bin /sbin /usr/bin /usr/sbin
do
    if [ -x $P/smbclient ]
        then
                SMBCLIENT=$P/smbclient
                break
        fi
done

[ -x $SMBCLIENT ] || exit 1

$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '
        BEGIN   { ORS=""; first=1 }
        /Disk/  {
                  if (first)
                        print opts; first=0
                  dir = $2
                  loc = $2
                  # Enclose mount dir and location in quotes
                  # Double quote "$" in location as it is special
                  gsub(/\$$/, "\\$", loc);
                  gsub(/\&/,"\\\\&",loc)
                  print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
                }
        END     { if (!first) print "\n"; else exit 1 }
        '

Contents of /etc/sysconfig/autofs:

TIMEOUT=300
BROWSE_MODE="no"
MOUNT_NFS_DEFAULT_PROTOCOL=4
USE_MISC_DEVICE="yes"

Best Answer

Please include the output from vgdisplay -v. If autofs is running (ps -ef | grep automount), please include the contents of /etc/auto.* and the autofs configuration file (usually /etc/default/autofs or /etc/sysconfig/autofs).

EDIT:

It's possible that the line

+auto.master

in /etc/auto.master is including an auto.master map from LDAP (or NIS) which defines /home as an automounted directory. To be sure, you would have to check the automount entry in /etc/nsswitch.conf and the autofs config file. If nsswitch is defined to go to nis, you would need to run ypcat -k auto.master; if it's defined to go to ldap, you would need to run ldapsearch with the appropriate options for your LDAP server.

To test the theory, just comment out that line from /etc/auto.master and restart autofs.

Automounted directories do not allow you to create new files or directories at the top level, and would give you an error similar to what you are getting if you tried to do so.

Related Topic