User Create

The purpose of this document is to explain how to create a Linux user.

Normal person user

  • username="josh" && homedir="/home/${username}" && useradd --home "${homedir}" --create-home "${username}"

  • passwd "${username}"

    • vim /etc/sudoers

      • ## Allow root to run any commands anywhere

      • ...

      • josh ALL=(ALL) ALL

        • or

      • josh ALL=(ALL:ALL) ALL

Machine user

  • username="opendkim"

  • homedir="/var/run/opendkim"

  • supp_groups="mail"

  • initial_group="mail"

    • useradd --home "${homedir}" --gid "${initial_group}" --shell "/usr/sbin/nologin" "${username}"

      • useradd --home "${homedir}" --gid "${initial_group}" --groups "${supp_groups}" --shell "/usr/sbin/nologin" "${username}"

MySQL user

  • username="mysql"; homedir="/var/mysql"; initial_group="mysql";

    • useradd --home "${homedir}" --gid "${initial_group}" --shell "/usr/sbin/nologin" "${username}"

        • May need:

      • groupadd "${initial_group}"

[Edit]