Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an LDAP user who accesses a server based on having the appropriate LDAP host attribute via sssd. This user does not show up in /etc/passwd because he is not local. How do I modify his home dir location if he has already logged in and it was created in the default location? RHEL 6 Is it just usermod -d /new/location -m?

share|improve this question
    
It says user not found in /etc/passwd when I try useradd but the user is reconized in LDAP and I cant add the user because it already exists. I believe my config is: files ldap. –  Gregg Leventhal Dec 23 '13 at 20:44

2 Answers 2

I don't believe that RHEL's usermod (or any stock NSS tools) supports changing the contents of NSS. You will probably need to actually modify the contents of LDAP, then move his home directory. Possible tools for you: diradm (look at the v2 fork in Gentoo esp.), ldapvi, cpu, ldapscripts (might be debian-only)

share|improve this answer
up vote 0 down vote accepted

This is actually shockingly easy. If your nsswitch is files ldap; just add an entry for them in /etc/passwd and modify whatever parameter you want. If they don't already exist in /etc/passwd, you could do getent passwd <username> | sed 's|/home/<username>|/home/remoteusers/<username>|g' >> /etc/passwd for instance to change their home directory from the root of /home to a subfolder of home called remoteusers. The caveat is that you cannot use useradd or usermod, you must edit the file with an editor.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.