this post was submitted on 06 Jun 2024
4 points (66.7% liked)
linux4noobs
1340 readers
1 users here now
linux4noobs
Noob Friendly, Expert Enabling
Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.
Seeking Support?
- Mention your Linux distro and relevant system details.
- Describe what you've tried so far.
- Share your solution even if you found it yourself.
- Do not delete your post. This allows other people to see possible solutions if they have a similar problem.
- Properly format any scripts, code, logs, or error messages.
- Be mindful to omit any sensitive information such as usernames, passwords, IP addresses, etc.
Community Rules
- Keep discussions respectful and amiable. This community is a space where individuals may freely inquire, exchange thoughts, express viewpoints, and extend help without encountering belittlement. We were all a noob at one point. Differing opinions and ideas is a normal part of discourse, but it must remain civil. Offenders will be warned and/or removed.
- Posts must be Linux oriented
- Spam or affiliate links will not be tolerated.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So, you mean that you want specific users who don't have "sudo" in their list of supplemental groups in /etc/group to also be able to invoke specific commands with
sudo
, but not arbitrary ones? Sure, you can do that.The line in /etc/sudoers in Debian that lets members of group "sudo" run arbitrary commands with "sudo" is this:
But you can have individual users in there too. Here's an example of setting a specific user to being able to run the
whoami
command andapt
command as root, without requiring a password to do so:https://www.baeldung.com/linux/sudo-privileges-user
If you're gonna modify /etc/sudoers, though, use
visudo
to do so:Well my other comement saying this is exactly what i need did not get posted as a reply to your comment, my mistake. I followed rhe example for "/usr/bin/wg/" intending to be able to use
but it still requires sudo. I tried rebooting and nothing changed, any ideas? I did
to get the command location for the sudoer file.
What the line I listed will do will let a specific user have permission to use sudo without a password to run
wg
as root without a password. So they (and not other users) can type:And the command will run as the root user, without them being prompted to enter a password.
It doesn't mean that when that user runs:
In their shell, what will actually run is:
If you also want to avoid typing the extra characters, you can set up an alias in your shell.
I don't know what shell you're using, but most Linux systems use
bash
as a default:If you're using bash, you can tell your current bash shell invocation to do that with the
alias
command:If you want that command run in every bash shell you invoke, you can do so by editing
~/.bashrc
and adding the line:Awesome now I understand what you and the other commenter were talking about with aliasing. Well this works perfect without the alias, many thanks