<commit_before>---
title: Adding a new system administrator to a host
category: infra
authors: quaid
wiki_category: Infrastructure documentation
wiki_title: Adding a new system administrator to a host
wiki_revision_count: 11
wiki_last_updated: 2013-02-19
---

# Adding a new system administrator to a host

Here are the general steps for adding a new system administrator with 'sudo' access to a host.

Modify these steps for giving specific 'sudo' access, such as to backups, restarting web services, etc. when the team is ready to sub-divide admin tasks.

*   Switch to the root user or use 'sudo' (preferable):

<!-- -->

    su -                    ## Or do all this with sudo, preferably

*   Add the new user to the system:

<!-- -->

    useradd foo

*   Create the user's password to activate the account; the user will not use this password to login, but they need it for 'sudo':

<!-- -->

    passwd foo

*   Create the user's SSH config directory:

<!-- -->

    mkdir /home/foo/.ssh

*   Either paste the 'id_rsa.pub' contents in to 'authorized_keys' ...

<!-- -->

    vi /home/foo/.ssh/authorized_keys       ## Then paste the id_rsa.pub
                        ## contents in to the
                        ## 'authorized_keys' file
                        ##
                        ## Or if no file exists ...

*   ... or move the 'id_rsa.pub' file in to the directory with the new name of 'authorized_keys':

<!-- -->

    cp /tmp/foo-id_rsa.pub /home/foo/.ssh/authorized_keys

*   Add the user to the 'sudoers' file:

<!-- -->

    visudo                  ## Add the following stanza
                        ## for 'foo' below the one for
                        ## 'root':

    #* Allow root to run any commands anywhere
    root    ALL=(ALL)       ALL
    quaid   ALL=(ALL)       ALL

*   Change ownership of the user's SSH config directory:

<!-- -->

    chown -R foo:foo /home/foo/.ssh

*   Change file permissions to read/write for the user only:

<!-- -->

    chmod 600 /home/quaid/.ssh

[Category:Infrastructure documentation](Category:Infrastructure documentation) [Category:Infrastructure SOP](Category:Infrastructure SOP)<commit_msg>adding useful info<commit_after>---
title: Adding a new system administrator to a host
category: infra
authors: quaid
wiki_category: Infrastructure documentation
wiki_title: Adding a new system administrator to a host
wiki_revision_count: 11
wiki_last_updated: 2013-02-19
---

# Adding a new system administrator to a host

Here are the general steps for adding a new system administrator with 'sudo' access to a host.

Modify these steps for giving specific 'sudo' access, such as to backups, restarting web services, etc. when the team is ready to sub-divide admin tasks.

*   Switch to the root user or use 'sudo' (preferable):

<!-- -->

    su -                    ## Or do all this with sudo, preferably

*   Add the new user to the system:

<!-- -->

    useradd foo

*   Create the user's password to activate the account; the user will not use this password to login, but they need it for 'sudo':

<!-- -->

    passwd foo

*   Create the user's SSH config directory:

<!-- -->

    mkdir /home/foo/.ssh

*   Either paste the 'id_rsa.pub' contents in to 'authorized_keys' ...

<!-- -->

    vi /home/foo/.ssh/authorized_keys       ## Then paste the id_rsa.pub
                        ## contents in to the
                        ## 'authorized_keys' file
                        ##
                        ## Or if no file exists ...

*   ... or move the 'id_rsa.pub' file in to the directory with the new name of 'authorized_keys':

<!-- -->

    cp /tmp/foo-id_rsa.pub /home/foo/.ssh/authorized_keys

*   Add the user to the 'sudoers' file:

<!-- -->

    visudo                  ## Add the following stanza
                        ## for 'foo' below the one for
                        ## 'root':

    #* Allow root to run any commands anywhere
    root    ALL=(ALL)       ALL
    quaid   ALL=(ALL)       ALL

*   Change ownership of the user's SSH config directory:

<!-- -->

    chown -R foo:foo /home/foo/.ssh

*   Change file permissions to read/write for the user only:

<!-- -->

    chmod 600 /home/foo/.ssh

*   The final file permissions:

<!-- -->

    ls -hal|grep ssh
    drwx------  2 foo  foo  4.0K Dec  3 19:38 .ssh

    ls .ssh/ -hal
    total 12K
    drwx------ 2 foo foo 4.0K Dec  3 19:38 .
    drwx------ 3 foo foo 4.0K Dec  3 19:34 ..
    -rw-r--r-- 1 foo foo  604 Dec  3 19:33 authorized_keys

[Category:Infrastructure documentation](Category:Infrastructure documentation) [Category:Infrastructure SOP](Category:Infrastructure SOP)
{'fraction_non_alphanumeric': 0.10518358531317494, 'fraction_numerical': 0.013174946004319654, 'mean_word_length': 2.1143241425689308, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1693306', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1283, 'n_words': 535}