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 & Delete Users on CentOS, RHEL & Fedora

    How To Add & Delete Users on CentOS, RHEL & Fedora

    RahulBy RahulFebruary 15, 20162 Mins Read

    You may need to create 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 useradd command. adduser command uses useradd command in backend. This tutorial will help you to add and delete user on CentOS, RHEL, Fedora and CoreOS operating systems.

    1. Add New User

    For this tutorial we are using adduser command for examples. Following command will create new user named ‘rahul’ on your system

    # adduser rahul
    

    Still you can’t login to your system with this account. You need to set a password to account to active it. Use this command to set new password.

    # passwd rahul
    
    Changing password for user rahul.
    New password: **************
    Retype new password: **************
    passwd: all authentication tokens updated successfully.
    

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

    # adduser rahul --home=/var/home/rahul
    

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

    # adduser rahul --shell=/bin/bash
    

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

    # adduser rahul --no-create-home
    

    2. Delete User from System

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

    # userdel rahul
    

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

    # userdel rahul --remove-home
    
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Run Command In Background on Linux
    Next Article How To Install WordPress with Nginx on Ubuntu 18.04 & 16.04

    Related Posts

    (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

    How To Enable SSH Server on Ubuntu 22.04

    Updated:April 22, 20222 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    10 Best Linux Video Players in 2022

    Updated:February 18, 20226 Mins Read

    How to Switch Python Version in Ubuntu & Debian

    Updated:April 22, 20223 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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