![]() Similar to the administrator account in Windows, the root account in Linux should be separate from the normal user account. However, you can register any normal user in the sudoers file to grant root access to that user. It can perform routine tasks and have certain specific permissions. On the other hand, a normal user on a Linux system has moderate privileges. However, it should not be used for routine use. The root is the main user in the Linux system, it has all the administrative permissions and can access any service. Linux is a multi-user operating system, and several types of users exist on the Linux machine-which includes a root user and a normal user. To elaborate, the added user now has administrative privileges. Now you need to disconnect from your server or desktop session and log in again, so that your group membersip is recognised.As a Linux administrator, it is crucial to learn how to add a user to the sudoers file on Linux. Uid=1000(greys) gid=1000(greys) groups=1000(greys),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(netdev),112(bluetooth),116(scanner)Īs you can see, I’m now a member of the sudo group! Step 3: Log out and log back in for group membership to be recognised Uid=1000(greys) gid=1000(greys) groups=1000(greys),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),112(bluetooth),116(scanner) Step 2: add user to sudo groupĮxcellent, now it’s time to add user greys to the group sudo (we must become root again to run usermod command) # usermod -a -G sudo # id greys This incident will be check my groups just to be sure there’s no sudo among them: id greys This needs to be run as your regular user, not as root: sudo -i Add user to sudo group Step 1: let’s make sure sudo is not accessible before we begin ![]() Since this is a very basic tutorial, we don’t have to edit the file at all – just need to add our user (mine is greys, as you remember) to the sudo group and check. Meaning, that this file will contain usernames and privileges required by web-server admins (usually commands like stopping/starting Apache or nginx webserver). … this means you don’t have to edit /etc/sudoers file but instead can create a specific file in /etc/sudoers.d and name it self-descriptively, like: /etc/sudoers.d/web-server-admins This is the line that allows you to debug sudo commands as root user.Īt this means that any user that belongs to group sudo will also be allowed to use sudo commands: %sudo ALL=(ALL:ALL) ALLįinally, this part includes additional configuration files from /etc/sudoers.d directory: #includedir /etc/sudoers.d I’ve highlighted the 3 most important elements of this file at this early stage: root ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: # Allow members of group sudo to execute any command # See the man page for details on how to write a sudoers file.ĭefaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Please consider adding local content in /etc/sudoers.d/ instead of # This file MUST be edited with the 'visudo' command as root. Here’s the default file in Debian 10 Buster: # cat /etc/sudoers It contains list of users and groups that are allowed to become root (or become other users by invoking su command as root). etc/sudoers is the main configuration file for sudo command. Usage: sudo -e file … Configure /etc/sudoers File ![]() Processing triggers for systemd (241-5) # sudo ![]() Processing triggers for man-db (2.8.5-2) … (Reading database … 174742 files and directories currently installed.) Selecting previously unselected package sudo. The following NEW packages will be installed:Ġ upgraded, 1 newly installed, 0 to remove and 0 not upgraded.Īfter this operation, 3,886 kB of additional disk space will be used. You need to become root before you do it, of course (so you must know root user password for your Debian install): su # apt install sudo That’s the very first step you’ll need to do: use apt to install sudo. Since I like and use sudo daily, I decided to install and setup it on Debian VM. This means that sudo command is not found the only privilege escalation method available is becoming root via su command. Apparently, Debian installer doesn’t install or activate sudo by default. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |