Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to Create local user in LDAP enabled linux systems


    Hi,

    During my application install, I used to create a new group and a new user using the 'groupadd' and 'useradd' commands

    groupadd my_group
    useradd -r -s /sbin/nologin -g my_group my_user

    But in one of the linux machines, where the LDAP is enabled (the LDAP server is not running on this machine, but it's configured for LDAP client), I find that the 'groupadd' and 'useradd' commands are adding the group and user into the LDAP and not as local user / group.

    I didn't want to add the user/group to LDAP, as I actually needed a local user, who will be owning my applications config file and one of the process will be run using the new user. I don't thing that LDAP user's can be used for 'chown' commands to change the file ownerships.


    On googling, I found that there is a 'luseradd' / 'lgroupadd' command which can add the user locally. But these tools are present in only RHEL by default. So on other distros like Ubuntu and SUSE, it' is not present by default and needs to be explicitly installed. So i can not rely on 'luseradd'/'lgroupdadd' utilities.

    I don't want to manually add the user and group in /etc/group and /etc/passwd file as it is a hack and it involves generating a unique group id and user id for my new group and user.

    1) Is there any other alternative to add a local user which can be used across all linux distros ?

    2) What is the best check to see if my machine is LDAP enabled ? I want to use this check to decide if I have to use 'useradd/groupadd' commands or not.

    Any pointers on this will be of great help.

    Thanks
    VJN

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    13,810
    The point of LDAP is enabling single-sign-on across all the linked system. I think you are stuck with installing the local user tools on your new systems if this is what you need. In any case, the /etc/passwd, /etc/shadow, and /etc/group files should be there already on all Linux systems as they are created when the system is installed. That is where a lot of system-level users/groups are installed such as root, etc. You should never have to install/create them manually.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •