Ubuntu user creation tutorial: Add a non-root account with sudo permissions

888u

Last update at :2024-02-05,Edit by888u

This article table of contents show 1. 1. Add a new account 2. 2. Add the user to the Sudo group 3. 3. Test 4. 4. Discount for novice bricklayers Performing server administration as a non-root user is a security best practice. After launching your VPS, your first task as root should be to set up a non-root user with sudo access. By default, the account and password initialized by Banwagonhost are for root, that is, the default username is root (note the case, all lowercase). In this case, the recommended approach is to create a non-root user after logging in, and then add sudo permissions, so the operation is more secure and you will not accidentally use the wrong permissions. This tutorial applies to the following versions:
  • Ubuntu 20.04 LTS
  • Ubuntu 19.10
  • Ubuntu 18.04 LTS
  • Ubuntu 16.04 LTS

1. Add a new account

Use the adduser command to create a new user account. Use strong passwords for new users. You can enter values ​​for user information or press ENTER to leave these fields blank. # adduser example_user Adding user `example_user' ... Adding new group `example_user' (1001) ... Adding new user `example_user' (1001) with group `example_user' ... Creating home directory `/home/example_user' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for example_user Enter the new value, or press ENTER for the default Full Name []: Example User Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y

2. Add the user to the Sudo group

Add the new user to the sudo group. # adduser example_user sudo

3. Testing

Switch to new user. #su-example_user Use whoami to verify you are the new user, then test sudo access using sudo whoami , which should return root. $ whoami example_user $ sudo whoami [sudo] password for example_user: root The new user account is ready for use. As a best practice, use this sudo user for server administration. You should avoid using root to perform maintenance tasks.

4. Discount for novice bricklayers

Official website of Banwagonhost: https://bwh81.net Banwagonhost discount code: BWH3HYATVBJW, save 6.58%, applicable to all, annual payment is as low as 24% off! Recommended solutions for bricklayers Real-time inventory of bricklayers: https://stock.bwg.net Warm reminder: If you have difficulty choosing, just choose the CN2 GIA-E plan in the middle. The quarterly payment is $49.99, and you can switch between up to 12 computer rooms at will. plan Memory CPU harddisk Traffic/month bandwidth engine room price Buy Banwagonhost Discount Code: BWH3HYATVBJW BandwagonHost purchase tutorial: "2021 new BandwagonHost Bandwagon VPS host purchase graphic tutorial cost-effective CN2 optimized line provider"
CN2 (The cheapest) 1GB 1 core 20GB 1TB 1Gbps DC3 CN2 DC8 ZNET $49.99/year Buy
CN2 2GB 1 core 40GB 2TB 1Gbps $52.99/half year $99.99/year Buy
CN2 GIA-E (most recommended) 1GB 2 cores 20GB 1TB 2.5Gbps DC6 CN2 GIA-E DC9 CN2 GIA Japan SoftBank JPOS_1 Netherlands EUNL_9 $49.99/quarter $169.99/year Buy
CN2 GIA-E 2GB 3 core 40GB 2TB 2.5Gbps $89.99/quarter $299.99/year Buy
HK 2GB 2 cores 40GB 0.5TB 1Gbps Hong Kong, China CN2 GIA $89.99/month $899.99/year Buy
HK 4GB 4 core 80GB 1TB 1Gbps $155.99/month $1559.99/year Buy
TOKYO 2GB 2 cores 40GB 0.5TB 1.2Gbps Tokyo, Japan CN2 GIA $89.99/month $899.99/year Buy
TOKYO 4GB 4 core 80GB 1TB 1.2Gbps $155.99/month $1559.99/year Buy
Suggestions for choosing bricklayers:
  • Getting started: Los Angeles CN2 package, currently the cheapest, optional CN2 GT computer room, the entry-level choice.
  • Recommended: Los Angeles CN2 GIA-E package, super fast, with many optional computer rooms (DC6, DC9, Japan SoftBank, Netherlands Unicom, etc.), the most cost-effective.
  • High-end: Hong Kong CN2 GIA package, the price is higher, but impeccable. The Tokyo CN2 GIA package is also a very good high-end option.

Recommended site searches: virtual host evaluation, free virtual host, domain name query, server space rental, domain name registration official website, 1g US virtual host, free php mysql space, US website server, domain name registration price, US high defense space, < /p>

Ubuntu user creation tutorial: Add a non-root account with sudo permissions

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码