You are not logged in.
Hello. I write in visudo:
USER_NAME HOST_NAME=/usr/bin/pacman -S
But when i try "sudo pacman -S opera" it says i cant du that. I understand that "pacman -S" it's not the same "pacman -S opera".
What i have to write in "pacman -S (in there)" to allow install any applications?
Solution. Make script 'pac_setup'
if [[ $1 != -* ]]
then
pacman -S $1
fi
Change owner script to root. And write in visudo USER_NAME HOST_NAME=/path to script/pac_setup*
Last edited by TaTuKoMa (2022-01-19 12:20:29)
Offline
Interesting that work with "mount" command
Last edited by TaTuKoMa (2022-01-11 07:35:11)
Offline
man sudoers | less -p "PASSWD and NOPASSWD"
Offline
You can use wildcards to allow arbitrary arguments:
https://man.archlinux.org/man/sudoers.5#Wildcards
https://serverfault.com/questions/38302 … doers-file
The wildcards are somewhat limited so it's difficult to correctly restrict the arguments. For example, you should prevent users from passing options such as "pacman -S foo -y" and other variations that lead to full or partial upgrades, or options that can change install reasons (--asdeps, --asexplicit). The recommended solution would be to create a dedicated wrapper that filters command-line options to pacman -S. For example,
#/usr/bin/bash
set -eu
pkgnames=()
for arg in "$@"
do
if [[ $arg == -* ]]
then
continue
fi
pkgnames+=("$arg")
done
/usr/bin/pacman -S "${pkgnames[@]}"
This is untested but should serve as a starting point.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Sorry. It's just start work. I think problem was that i'm was not restart second terminal after save changes in visudo.
Offline
After reboot it's not work again.
It's because i was testet wildcards * and he not work. But start work after reboot terminal. And then i was delete it from visudo, because sink he don't need anymore.
Last edited by TaTuKoMa (2022-01-11 08:20:47)
Offline
#/usr/bin/bash set -eu pkgnames=() for arg in "$@" do if [[ $arg == -* ]] then continue fi pkgnames+=("$arg") done /usr/bin/pacman -S "${pkgnames[@]}"
Please help me understand. Where i need write it? And what i have to write in visudo?
Offline
Offline
Problem solved
Offline
Problem solved
Please edit your first post, edit the title, and prepend [SOLVED] to the title. You may need to shorten the title to get it all to fit.
Thanks
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Offline
TaTuKoMa wrote:Problem solved
Please edit your first post, edit the title, and prepend [SOLVED] to the title. You may need to shorten the title to get it all to fit.
Thanks
Done
Offline