ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How to Manipulate Ubuntu User Accounts and Groups Using Terminal

Updated on March 26, 2016

Before Everything Else!

Before we get to the chase, there are a few steps to make:

1. Boot up your computer.

2. Log in to your User Account (make sure you are not logged in as Guest).

3. Open the Dash by clicking the Ubuntu icon in the upper-left corner of the screen, type "Terminal", and select the Terminal application from the results that appear.


Hit the keyboard shortcut Ctrl+Alt+T.

4. Click the Terminal icon.

A step-by-step procedure before playing with the Terminal.
A step-by-step procedure before playing with the Terminal.

What are User Accounts and Groups?

Linux uses groups for organizing users. Groups are collections of user accounts with the same permissions and/or settings.

Management of group membership is administered through the /etc/group file, which shows a list of groups and their members.

The management of Groups can also be accomplished through the use of Terminal, which is what I'll be teaching you.

By default, every user belongs to a default or primary group. When a user logs in, the group membership is set for their primary group and all the members enjoy the same level of access and privilege. Permissions on various files and directories can be modified at the group level.

Groups are used to establish a set of users who have common interests for the purposes of access rights, privileges, and security considerations. Access rights to files (and devices) are granted on the basis of the user and the group they belong to.

Who Are You?

There is a Terminal command in Ubuntu that let's you check the account you are currently logged in to. This is important as you would want to avoid errors in the configuration of Users and Groups.

1. To check the User Account you are currently logged in with the Ubuntu Terminal, use the command: "whoami".

$ whoami

2. To know which other User Account are currently logged in, in the PC you are working on, type:"who".

$ who

3. To see a more detailed result in the "who" command, try putting "-a" after it.

$ who -a

Click the image to enlarge
Click the image to enlarge

Adding User Accounts

1. To add users with the UbuntuTerminal, you have to use the command: "useradd".

$ sudo useradd <any desired name>

2. To add password to the recently added Account, use the following command:

$ sudo passwd <user account you wish to add a password to>

  • Note that upon pressing enter, the Terminal will then let you assign a password to the User Account you just made.
  • While you are typing in the password, you will see that no characters nor asterisks will show up as you are typing in the password. Don't worry. That is normal.

Deleting User Accounts

To delete a User Account in Ubuntu, that User Account has to exist first. That is, if you want to delete one, make sure you made it before, or else you will get an error.

1. Deleting a User Account is fairly simple. The right command for this task is, you've guessed it, "userdel".

$ sudo userdel <user account you wish to delete>

  • Please note that, if you ever attempt it, deleting the administrator account is not possible.

Adding a Group

A Group in Ubuntu is a a collection of User Accounts. Group is made to ease the management of related User Accounts.

For example, a Group named STUDENT can be created to manage every single User Account of pupils in a class.

1. To add a Group, we use the command "groupadd".

$ sudo groupadd <desired name for a group>

  • The word sudo before the command groupadd is used to denote that you are issuing this command as the Administrator.

Deleting a Group

Deleting a group is just as easy as creating one.

1. To remove a group, you need to type in: "groupdel".

$ sudo groupdel <group name you wish to delete>

How to Add an EXISTING User Account to an Existing Group Account

1. To add a User Account to a particular Group, type this:

$ sudo adduser <name of the existing user account> <the group name>

  • Before doing this, make sure that both the User Account and the Group have already been made.

How to Add a NEW User Account to an Existing Group Account

1. To add a new User Account to a particular Group, type this:

$ sudo adduser <name of the new user account> <the group name>

  • Before doing this, make sure that the Group you wish the new User Account to be a member of has already been made.
  • Make sure to put a password to the recently-added user if you need to.

How to Remove a User Account from a Group

What if you made a your student's User Account a member of the FACULTY group. How do you remove him from there? Here's how.

1. To delete a User Account's membership to a particular Group, use this command.

$ deluser <user account you wish to remove> <group name to which that user is a member of>

  • Before doing this, make sure that the Group you wish the new User Account to be a member of has already been made.
  • Take note that only the membership is what you are deleting, not the User Account itself. If you want to delete the Account itself, you have to use the userdel command.

Summary of Commands (A)

AddUser Account
sudo useradd <a>
sudo groupadd <a>
sudo userdel <a>
sudo groupdel <a>
Fairly easy to memorize, huh?

Summary of Commands (B)

With an Existing User
With a New User
Add a User to a Group
sudo adduser <a> <b>
sudo adduser <a> <b>
Remove a User from a Group
sudo deluser <a> <b>
You need to refer to the whole article for the complete commands.

Other Things...


  • sudo is a command that denotes the use of Administrative privileges.

"Case Sensitvity":

  • Ubuntu is always case sensitive, even with names, so make sure you type carefully.

"Ctrl + C":

  • press this keyboard combination to stop the process of a command that won't end!


  • This dollar sign you see before the commands is not actually included in the command itself, this was just used in the article to show that you are typing and accessing the Terminal in the unprivileged mode.


    0 of 8192 characters used
    Post Comment

    No comments yet.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)