![]() ![]() 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? The difference that you need to be mindful of is a group must be prefixed with ‘%’.If you don’t need cPanel, don't pay for it. ![]() You may have a large number of users that need sudo rights, and those users likely belong to a common set of groups.Ĭreating a User Alias with groups instead of users is very much the same, as we just replace the user names with group names. The example of provide add a few users to the alias. User_Alias ::= students = student1, student2, student3 We call the alias students and add students 1 through 3. Lets add a few users to a User Alias, after which we will set the sudo privileges for the alias. The syntax for creating an alias is as follows: User_Alias ::= The alias can then be used to set sudoers permissions, which is useful when you have a list of groups or users that share the same access levels. User aliases allow us to create a predefined group of users, user IDS, group names, group IDS. student1, %java_students ALL : (ALL) ALL Using User Alias We can add users and groups to sudoers on the same line of configuration, however, this could get sloppy. Granting groups sudoers permissions is the same as users, except a group name must be prefixed with a %. To simplify your task we can add users and groups to sudoers. When you have more than few users to add to sudoers it may start to become cumbersome to mange their permissions individually. student1 ALL : (ALL) ALL Adding a Group to Sudo To allow student1 access to all commands on all hosts as all other users, the following entry would be created. : [(įor example, to allow user student1 access to all commands on all hosts, we would create the following entry. The syntax for creating a sudoers entry is as follows. sudo vi /etc/sudoers Adding a User to Sudo visudoĪlternatively, you can edit the sudoers file directly. The first is to use the Visual Sudo command. There are a number of ways to grant users the right, but the one we will look at in this tutorial is by editing the /etc/sudoers file. In order for a user to use sudo they must be granted the right to. Sudo is a command found in Unix and Linux operating systems that allows a user to temporarily elevate their privileges, as well as run as another user. In this tutorial, you will learn how to add users and groups to sudoers on Centos and Ubuntu. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |