Ubuntu 24.04
Sponsored Link

Initial Settings : Add User Accounts2024/04/26

 
After installing Ubuntu System, there is only a user you configured during installation except System Accounts and he is an administrative user.
If you'd like to add more common user accounts on System, Configure like follows.
[1] For example, Add a [noble] user.
ubuntu@localhost:~$
sudo adduser noble

[sudo] password for ubuntu:  # input your password
info: Adding user `noble' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `noble' (1001) ...
info: Adding new user `noble' (1001) with group `noble (1001)' ...
info: Creating home directory `/home/noble' ...
info: Copying files from `/etc/skel' ...
New password:           # set user password
Retype new password:    # confirm
passwd: password updated successfully
Changing the user information for noble
Enter the new value, or press ENTER for the default
        Full Name []:   # input user info (OK with empty all if you do not need)
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
info: Adding new user `noble' to supplemental / extra groups `users' ...
info: Adding user `noble' to group `users' ...
ubuntu@localhost:~$
[2] If you'd like to give privileges to a new user, Configure like follows.
ubuntu@localhost:~$
sudo
usermod -aG sudo noble

ubuntu@localhost:~$
su - noble

Password:
# try to run a command which requires root privilege

noble@localhost:~$
sudo ls -la /root

[sudo] password for noble:    
# input self password

total 28
drwx------  4 root root 4096 Apr 26 01:43 .
drwxr-xr-x 23 root root 4096 Apr 26 01:07 ..
-rw-------  1 root root   21 Apr 26 01:43 .bash_history
-rw-r--r--  1 root root 3106 Apr 22 13:04 .bashrc
drwx------  2 root root 4096 Apr 26 01:43 .cache
-rw-r--r--  1 root root  161 Apr 22 13:04 .profile
drwx------  2 root root 4096 Apr 26 01:09 .ssh
[3] If you'd like to remove user accounts, Configure like follows.
# remove a user [noble] (only removed user account)

ubuntu@localhost:~$ sudo
deluser noble
# remove a user [noble] (removed user account and his home directory)

ubuntu@localhost:~$ sudo
deluser noble --remove-home
Matched Content