Ubuntu 20.04 で ユーザを追加する


はじめに


Ubuntu 20.04 で ユーザを追加するためのメモ。

環境


$ hostnamectl status
   Static hostname: ---
         Icon name: computer-container
           Chassis: container
        Machine ID: ---
           Boot ID: ---
    Virtualization: lxc
  Operating System: Ubuntu 20.04.2 LTS
            Kernel: Linux 5.4.0-67-generic
      Architecture: x86-64

ユーザを追加


adduser コマンドでユーザを追加します
以下では、ユーザ名を test-user としているパスワードの入力以外は基本すべてEnterを入力する

# adduser test-user
Adding user `test-user' ...
Adding new group `test-user' (1001) ...
Adding new user `test-user' (1001) with group `test-user' ...
Creating home directory `/home/test-user' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for test-user
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n]

sudoグループに追加

追加した一般ユーザにsudoを許可する場合、sudoグループへの追加が必要です

# gpasswd -a test-user sudo

以上、終わり