AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Make a sudo user ubuntu9/25/2023 ![]() This article requires an open terminal, like many other articles on this site. It’s a pretty easy task and you shouldn’t have much trouble with this one. You’ll use sudo to do things like install software or edit system files.Īnyhow, I’ll explain how to create a new user with sudo privileges in this article. They can access anything, change anything, and do anything they please. Users that belong to the sudo group are pretty much omnipotent. I shouldn’t need to mention this, but sudo stands for ‘superuser do’. You may want a multi-user environment, you may want different logs for different users, you may want some customization with one user, you might want to test things with a separate user, etc… There are tons of reasons for wanting a different account and wanting a new user with sudo privileges. Give it a shot and let me know in a comment if it works out for you. It should probably work if you install ‘adduser’ where available, but that’s entirely untested by me. This article doesn’t cover other distros! It has only been tested in a couple of Ubuntu derivatives and not all distros come with ‘adduser’. This will be just a quick article that explains how. To test this out, open a new terminal session and give the login a try: ssh you are logged into your system without a problem then you have completed this tutorial perfectly.It’s not unusual to want to create a new user with sudo privileges and it’s actually really easy. Well done! You should now be able to log into your server using the new sudo user. sshįinally, make sure to restart the SSH service: sudo service ssh restart Paste your public key in the authorized_keys file.Ĭhange permissions on the authorized_keys file: chmod 600 authorized_keysĬhange into the home directory again with cd and change permissions on the. Update the line that begins with PermitRootLogin (if you want to disallow root login): - PermitRootLogin without-password + PermitRootLogin noĬreate an authorized_keys file: nano authorized_keys Whil still logged in as the sudo user, edit the SSH configuration file: sudo nano /etc/ssh/sshd_configĪdd sudo to the line that begins with AllowGroups: Remember, even if you disallow root login, you can always assume the root user using the su command above. Now that you have a sudo user, you can add your public key to new user account and actually disallow root login for added security. See "man sudo_root" for details." How to Log In With SSH KeyĪs you recall when first logging into your server as root, you had to provide a public key in the Account Management Panel, which will be used to authenticate your login, since password authentication is disabled by default. You will see a success message indicating that you have switched to your sudo user: To run a command as administrator (user "root"), use "sudo ". To test the account, you can switch to it: su You have now succeeded in creating a sudo user. you can put in actual values or press Enter to skip and answer “Yes”.įinally, add the new user to the “sudo” group by running this command: usermod -aG sudo For the rest of the rest of the prompts, like “Full Name,” “Room Number,” etc. Run the adduser command followed by the name of your new user: adduser įill in a secure password. With your own “sudo” account, you can run commands as root by appending sudo to the command: sudo įirst, log into your server as root: ssh As an alternative, you can create a personal user account and add “super user” privilege. However, the cPanel user is not strictly a “sudo” user who can invoke root privileges as needed.įor this reason, it is often recommended that you avoid using the root user for everyday tasks. Those of you familiar with managed VPS hosting with cPanel will be familiar with how the cPanel account doubles as an SSH user with appropriate access. ![]() There are some similarities and distinctions between the sudo user and the cPanel user, for traditional VPS users. Likewise, using your root user account to make changes to your system can be inconvenient when creating files that must be shared with other users or the world - like the public files of your website. Your cloud server VPS gives you instant access to the “root” user account, which holds all the power over your system, even the power to delete critical system files. ![]() Only pay for what you need with our scalable Cloud VPS Hosting.ĬentOS, Debian, or Ubuntu No Bloatware SSH and Root Access Why Create a Sudo User? If you don’t need cPanel, don't pay for it.
0 Comments
Read More
Leave a Reply. |