Friday, 2 October 2020

How to create New User in Ubuntu 18

 By default, the cloud server comes with a user named ubuntu. You can use such primary user account for system admin tasks on Ubuntu. However, sometimes you need to add a new user account on Ubuntu for additional sysadmin tasks. This page shows how to create a user account or sysadmin account on the Ubuntu server.

Steps to create a user account on Ubuntu Linux

  1. Open the terminal application
  2. Log in to remote box by running the ssh user@your-ubuntu-box-ip
  3. To add a new user in Ubuntu run sudo adduser userNameHere
  4. Enter password and other needed info to create a user account on Ubuntu server
  5. New username would be added to /etc/passwd file, and encrypted password stored in the /etc/shadow file

Let us see all commands in details and

Ubuntu create user account commands

Let us say you need to add a new user in Ubuntu called vivek, type the following command in your shell:
$ sudo adduser vivek
Type your own password and other info:
Create a user account on Ubuntu Linux

Verification

Use the grep command or cat command as follows:
$ cat /etc/passwd
$ grep '^vivek' /etc/passwd

Sample outputs:

vivek:x:1001:1001:Vivek Gite,,,:/home/vivek:/bin/bash

How do I log in using ssh?

From your Windows (WSL) or macOS or Linux desktop, run:
$ ssh vivek@your-aws-ubuntu-server-ip
OR
$ ssh -i ~/.ssh/aws.pub.key vivek@your-aws-ubuntu-server-ip
Enter the password when prompted.

No comments:

Post a Comment