What & How: Add Sudo User in any Ubuntu System.

What & How: Add Sudo User in any Ubuntu System.

1. Create a new user

adduser username

2. Add it to Sudoers Group so it can have the privilege of sudo access.

usermod -aG sudo username

3. Now If you want to enable password-based login for this user and you are getting an error like "Permission denied (public key)", it means that you can't log in with a password. You can only log in with the key. 

Steps to enable password based login:

1. edit sshd_config file 

vi /etc/ssh/sshd_config

2. Edit two lines

      - PasswordAuthentication yes
      - PermitRootLogin yes # if and only if you want to enable password authentication for root user  #Optional

3. Set password of the newly created user (If not set earlier) (optional)

passwd username  # set that user's password

4. service ssh restart


Now try login with that credentials, We hope it works!!!


PS: sshd_config file name can be different for different Ubuntu OS/ Debian OS versions. 



    • Related Articles

    • Jail User

      #reference :  https://askubuntu.com/questions/93411/simple-easy-way-to-jail-users Jailkit is a set of utilities that can limit user accounts to a specific directory tree and to specific commands. Setting up a jail is much easier using the Jailkit ...
    • Ticketing System

      Hello @Xcellities What is the ticketing system? A way to manage your DevOps related queries. What's the need of implementing a ticketing system? 1. To keep track of all of your queries. 2. To provide Transparency in the flow of work in a properly ...
    • What & How : MySQL User

      Run below commands to create MySQL user. 1. For local MySQL 1.CREATE USER 'username'@'%' IDENTIFIED BY 'password'; 2.GRANT ALL ON *.* TO 'username'@'%'; 2. For AWS RDS 1. CREATE USER 'username'@'%' IDENTIFIED BY 'password'; 2. GRANT SELECT, INSERT, ...
    • CHANGE GITLAB RUNNER

      Required Details : - server architectures type [ x86, AMD64, ARM64, ARM, s390x, ppc64le ] - super user access [ sudo password ] SSH in server where you want to set git runner. Step 1) #download binary for your system Warning : Select binary as per ...
    • Nginx : How To Block Exploits, SQL Injections, File Injections, Spam, User Agents, Etc.

      server { [...] ## Block SQL injections set $block_sql_injections 0; if ($query_string ~ "union.*select.*\(") { set $block_sql_injections 1; } if ($query_string ~ "union.*all.*select.*") { set $block_sql_injections 1; } if ($query_string ~ ...