0

I have a SSH + LDAP installation with users public keys stored in LDAP.

I want that when some user in a list (configured into server) do a ssh connection with ssh user@server always log in as root. user user not exists on server, only on LDAP.

Now I have working this steps if I have configured my LDAP uid as root and ssh connection is ssh root@server.

But I need to login with ssh user@server.

Is SSH able to do this map?

Moved from StackOverflow.

1 Answer 1

0

On the SSH server, try adding the following line to bottom of /etc/passwd for the ldap user:

user:x:0:0::/root:/bin/bash

(replace user with the ldap username)

This will map the username user to root. I know it works if you have a corresponding entry in the shadow file and log in using that type of auth. So hopefully will work without the shadow entry for LDAP.

4
  • Users should not exists on server, only on LDAP, and once checked public key, must be log in as root. Maybe is not possible. Commented Mar 14, 2017 at 20:51
  • With my answer the user does not really exist on the server. Is just a mapping to root. Commented Mar 14, 2017 at 23:25
  • Yes, but I need to configure the "virtual" user in /etc/passwd. I need some solution only LDAP dependent. Thanks anyway :) Commented Mar 15, 2017 at 8:44
  • 1
    AFAIK it's not possible the way you want :-) Commented Mar 15, 2017 at 10:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.