Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Tutorials»How To Add and Delete User in Ubuntu, Debian & LinuxMint

    How To Add and Delete User in Ubuntu, Debian & LinuxMint

    RahulBy RahulJanuary 28, 20162 Mins ReadUpdated:April 24, 2019

    You may need to create a separate account for every user want to connect this system. For adding new users in system there are two commands available in your system, useradd and adduser. adduser command is the enhanced version of the useradd command. adduser command uses useradd command in the backend. This tutorial will help you to add and delete a user in Ubuntu, Debian, and LinuxMint operating systems.

    1. Add a New User

    For this tutorial, we are using adduser command for examples. The following command will create a new user account named ‘rahul’ in your system.

    sudo adduser rahul
    
    Adding user `rahul' ...
    Adding new group `rahul' (1006) ...
    Adding new user `rahul' (1005) with group `rahul' ...
    Creating home directory `/home/rahul' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password: **************
    Retype new UNIX password: **************
    passwd: password updated successfully
    Changing the user information for rahul
    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] y
    

    Chane home directory – By default above command will create users home directory as /home/. But you can specify home directory at any other location using following command.

    sudo adduser rahul --home=/var/home/rahul
    

    Change login shell – You can also specify any other shell for user in place of default, use –shell switch followed by shell name as below.

    sudo adduser rahul --shell=/bin/bash
    

    Without home directory – If you don’t want to create users home directory. You can use –no-create-home switch with adduser command as below.

    sudo adduser rahul --no-create-home
    

    2. Delete User from System

    Now its good to lock or delete any user from the system which is no longer required. Use the following command to delete any user from the system.

    sudo deluser rahul
    

    The above command will not delete the users home directory. If you also want to delete users home directory add –remove-home parameter with the command, For example below command, will delete user rahul and their home directory permanently.

    sudo deluser rahul --remove-home
    

    You may also take a backup of users home directory before deleting it using the following command.

    sudo deluser rahul --remove-home --backup  --backup-to /var/archives/
    
    adduser linux user account useradd
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Symfony 2 Framework on CentOS / RHEL / Fedora
    Next Article How to Install Java 9 on Debian 9/8 via PPA

    Related Posts

    How to Setup Squid Proxy Server on Ubuntu and Debian

    Updated:June 17, 20225 Mins Read

    How to Delete a Let’s Encrypt Certificate using Certbot

    Updated:June 3, 20222 Mins Read

    How to Install Latest Git on Ubuntu 22.04

    Updated:May 31, 20222 Mins Read

    How To Install LibreOffice on Ubuntu 22.04

    Updated:May 23, 20222 Mins Read

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    4 Comments

    1. Bruce B on April 22, 2021 8:26 pm

      Worked perfectly, thanks…

      Reply
    2. checkvilricky on August 22, 2019 7:10 pm

      i am Checkvil. This i my login on this forum. it is good ? 🙂

      Reply
    3. Relcarne on January 17, 2019 7:54 am

      Hello i am from Andora and i can help you with all of problems.

      Please write. Relgise

      Reply
    4. jim on May 22, 2018 2:41 pm

      Those commands did nothing, I copied and pasted them nothing changed.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    • How to Install Composer on Ubuntu 22.04
    • How to Create DMARC Record For Your Domain
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.