Bobcares

Adduser Digitalocean Droplet: A Note on

by | May 15, 2023

Let us take learn how to adduser Digitalocean droplet with the support of our DigitalOcean support services at Bobcares.

Adduser command in DigitalOcean droplet

adduser digitalocean droplet

One of the most important system administration jobs to learn is how to add and remove users on a Linux system.

When starting a new system, the root account is the only one accessible by default.

While operating as the root user provides us unlimited authority over a system and its users, it is also risky and potentially disastrous.

It’s advisable to add an unprivileged user and do typical system administration activities without root rights. We may also establish new unprivileged accounts for any other users on the system. Every user on a system should have their own account.

How to adduser in a Digitalocean droplet?

If we sign in as the root user, we can create a new user at any time by typing the following command:

adduser newuser

If we are the root user with sudo rights, we can add a new user using the command:

sudo adduser newuser

In any case, we will be required to reply to a series of questions to adduser digitalocean droplet:

  • Assign and confirm the new user’s password.
  • Fill in the blanks with any other information about the new user.
  • If we do not want to use these fields, we may skip this step by clicking ENTER.
  • Finally, we’ll be asked to validate the accuracy of the information we gave. Continue by pressing Y.

The new user is now available for usage and may be accessed using the password you specified.

Continue to the following section if the new user requires administrative rights.

Granting a User Sudo Privileges

If the new user is to be able to run commands with root (administrative) rights, we must provide the new user access to sudo. Let’s look at two ways to this task:

  • first, adding the user to a pre-defined sudo user group, and
  • second, setting rights in sudo’s setup on a per-user basis.

Adding the New User to the Sudo Group

On Ubuntu 20.04 computers, sudo is set to grant full rights to any user in the sudo group by default. This is the next step to adduser digitalocean droplet

Using the groups command, we can see which groups the new user is a member of:

groups newuser

output

newuser : newuser

As adduser produces this in addition to the user profile, a new user is only in their own group by default. The names of a user and its own group are the same. We may use the usermod command to add the user to a new group:

usermod -aG sudo newuser

The -aG option instructs usermod to add the user to the groups specified.

Please keep in mind that the usermod command requires sudo access. This implies that the root user or another sudo group member must login to add people to the sudo group.

In the latter instance, we must prefix this command with sudo, as seen below:

sudo usermod -aG sudo newuser

Specifying Explicit User Privileges in /etc/sudoers

Instead of adding the user to the sudo group, we may use the visudo command, which opens a configuration file named /etc/sudoers in the system’s default editor and allows us to directly define rights for each user.

Visudo is the best technique to modify /etc/sudoers as it locks the file against concurrent modifications and performs a validity check before overwriting.

This helps to avoid a situation in which we misconfigure sudo and are unable to resolve the issue because we have lost sudo access.

If currently we are in as root, run the following command:

visudo

If we are a non-root user with sudo rights, we can use the sudo prefix:

sudo visudo

Visudo has traditionally opened /etc/sudoers in the vi editor, which might be perplexing for new users.

Visudo will use the nano text editor by default on new Ubuntu installs, which provides a more comfortable and accessible text editing experience.

Move the cursor with the arrow keys and look for the line that looks like this:

/etc/sudoers
root    ALL=(ALL:ALL) ALL

Include the highlighted line below this one. Make careful to replace newuser with the name of the user profile to which we want to grant sudo privileges:

/etc/sudoers
root    ALL=(ALL:ALL) ALL
newuser ALL=(ALL:ALL) ALL

Add a new line like this for each person who should have full sudo access. When done, save and close the file using CTRL + X, then Y, and finally ENTER to confirm.

[Need assistance with similar queries? We are here to help]

Conclusion

To sum up we have now seen how to adduser Digitalocean droplet with the support of our tech team.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF