![]() ![]() If youâre working with multiple users, understanding the sudo command and the sudoers file is an absolute must. Now the user bill will be able to run the tcpdump command along with other networking related commands. Next we add user bill to the netadmin group: sudo adduser bill netadmin The command tcpdump is under CAPTURE alias i.e. NETALL in turn include all commands under CAPTURE and SERVERS aliases. Users in the netadmin group can run commands specified in NETALL. What we have done in the above file is create a netadmin group. Use the following command to create the file: sudo visudo -f /etc/sudoers.d/networkingĪdd following text in the file: Cmnd_Alias CAPTURE = /usr/sbin/tcpdumpĬmnd_Alias SERVERS = /usr/sbin apache2ctl, /usr/bin/htpasswd To do so we create a configuration file in /etc/sudoers.d/ called networking. What if we want bill to be able to run only specific kinds of commands with sudo privileges, like networking? Use the Sudoers File to Grant Specific Privileges Now the user bill can no longer perform actions that require sudo privileges. Next, weâll add this line at the end of the file: ALL (ALL) ALL.The deluser command will remove bill from the sudo group. This will open up an editor on the command line. To remove a user from sudo: deluser bill sudo If you want to give anyone root privileges just add them to sudo. If we use the grep command to check who is in the group, weâll see the username bill. ![]() To add a user called bill to the sudo group, we use the adduser command in the command line, like so: adduser bill sudo ![]() To see which users are in the sudo group we can use a grep command: grep âsudoâ /etc/group Visudo makes sure that sudoers is edited by one user at a time and provides necessary syntax checks. It is recommended to use visudo to edit the sudoers file. To edit /etc/sudoers file, use following command: sudo visudo -f /etc/sudoers
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |