I am using a RHEL6 host that is set up using LDAP for authenication. Upon first login it is supposed to create the home directory for the user (e.g. /home/gisle where gisle is my login username). I have not configured this host myself.

I goofed up. I am supposed to connect from another host (staff.example.com) in the cluster using the following command:

ssh [email protected]

I've done this on dozen of identically configured hosts, and it works.

However, this time I typed:

ssh remote.example.com

I was not prompted for a username, but username gisle was obviously assumed. When I typed in the password (using the same password as I use to authenticate on staff.example.com), I was authenticated with LDAP and logged in, but no home directory was created on this inital login (instead my account was set up with my home directory set to the home directory path picked up from the machine I was coming from - i.e. /home/staff/g/gisle).

Logging out and logging in again (with ssh [email protected]) does not fix the problem. The notion about the "wrong" home directory persists.

I have the same username (gisle) on both systemes. My home directory on staff.example.com is /home/staff/g/gisle. This directory does not exist on remote.example.com - nor is it supposed to exist.

Here is the result of logging in on the remote now:

$ ssh [email protected]
Last login Sun Jan 19 16:22:40 2014 from staff.example.com
Could not chdir to home directory /home/staff/g/gisle
$ whoami
$ echo $HOME
$ pwd

I need to "reset" the status of my account so that the RHEL6 host forget all about me logging in, believe I am logging in for the first time, and automatically create the home directory. I have root access on remote.example.com, but do not know what to do.

  • What you're describing makes no sense, please edit your question and clarify. i) Log in to the remote with ssh [email protected] and run whoami, echo $HOME and pwd ii) do you have the same username on both systems? If you do your $HOME will have the same path on both systems. iii) do you have root access to the remote system?
    – terdon
    Jan 19, 2014 at 16:38
  • @terdon, I've edited the question to address your comment. I am now using my real username on both systems in a hope that this makes the question clearer. Jan 19, 2014 at 16:58
  • OK, thanks, that's much clearer, the key points hre are LDAP and the fact that you do have the same username. Do you have root access to all the machines involved?
    – terdon
    Jan 19, 2014 at 17:02
  • 1
    Here's a big clue guys: server-world.info/en/note?os=CentOS_6&p=ldap&f=2. Notice the pam module that auto creates the user's home dir. in this tutorial? This is likely the source of the issue. I don't have time to debug this though I really want to, have to step out w/ family for most of the rest of today. Be back later though.
    – slm
    Jan 19, 2014 at 18:38
  • 1
    @slm I don't agree that it's the source. Everything I see points to a misconfigured server. The server should not be picking up the home directory path from the connecting client. The fact that it is sounds like someone pointed this server at the wrong authentication backend.
    – phemmer
    Jan 19, 2014 at 18:41

1 Answer 1


To me this sounds like the server has been misconfigured.

As you stated, the system automatically picked up your username (gisle) upon logging in. This is the only thing that prefixing your username with an '@' does. Meaning, on all the following commands, if the user you are runnning as is 'gisle', they are exactly equivalent.

ssh [email protected]
ssh -l gisle remote.example.com
ssh remote.example.com


Your question indicates that your work environment has 2 sets of systems, one that uses /home/staff/g/gisle, and one that uses /home/gisle. This obviously means you have 2 authentication backends (LDAP, NIS, etc). The behavior you are seeing would indicate that the system you are logging into is configured to use the wrong authentication backend.
If you were to change your password on the systems which use /home/staff/g/gisle, I'd bet you'd find your password changed on this system as well.

Meaning this is not an issue on your part. The solution here is to contact the administrator of the system and request they fix it.

  • "If you were to change your password on the systems which use /home/staff/g/gisle, I'd bet you'd find your password changed on this system as well." Sure. That is what LDAP authentication is supposed to do. My entry in /etc/passwd on the remote is simply +gisle (and nothing more). I am told that this means that authentication should be done using LDAP against my account on staff.example.com. However, if first time login to the remote is done using ssh [email protected], this problem does not happen. I guess I need to talk to the administrator to esolve this. Jan 19, 2014 at 19:16
  • @GisleHannemyr Yes, but it sounds like you have 2 separate authentication systems. Your authentication system is not just responsible for your password, it's responsible for your account info, including your home directory. Meaning one system contains /home/staff/g/gisle and the other contains /home/gisle. So if you change your password on the /home/staff/g/gisle system, anything with /home/gisle should use your old password. While it is technically possible for some sort of directory mapping to be going on, I would not consider it likely.
    – phemmer
    Jan 19, 2014 at 22:36
  • 1
    You're right. This particular server is misconfigured (it was missing homedir_override from its cfengine policy). That I forgot to give my username when logging in the first time was a coincidence. My initial login should have worked if the configuration had been correct. Jan 20, 2014 at 3:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .