this post was submitted on 06 Jun 2024
4 points (66.7% liked)
linux4noobs
1356 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
What do you mean by "not require sudo privileges"?
Do you mean not require root permissions? that depends on what are you trying to do. You'll need to make changes in your system to allow normal users to have permissions for it, and in many cases that's not possible (or very safe).
If what you mean is that you don't want to need to type"sudo" every time, but still be able to have the commands run with root permissions, then there's multiple ways to do this:
Add an alias such as
alias command='sudo command'
. If you don't want to type the password, you can change the sudores file so that your user doesn't need to enter a password when running sudo for that command (someone else in the comments already explained how to do that, using an entry withNOPASSWD: /usr/bin/command
in the sudoers config).alternatively: set the SUID bit of the executable you want to run, so that every time the file is executed (by anyone) it will always execute as the user who owns the file (so if the owner is root, the file will always be executed as root)... this is not something I'd recommend though, since it can lead to security vulnerabilities.
Most software isn't written to be hardened for that kind of invocation.
Also, IIRC you can also do the same thing with the sgid bit.
goes to check
Yeah.
True, SGID would affect the group it runs as, while SUID affects the user.
You could set up things so that a group has permissions to do what you want, instead of the root user. But then this also depends on the usecase, I'm not sure if having root group permissions would be enough in all cases.
Thank you both