Using yay --sudoloop, how can I pipe password to it?
Hi there, Is there away to pipe sudo password to yay or paru with sudoloop?
I've tried the following but non worked for me
echo "password" | yay -S --sudoloop --noconfirm pkg(s)
printf "password" | yay -S --sudoloop --noconfirm pkg(s)
echo "password" | sudo -u user yay -S --sudoloop --noconfirm pkg(s)
yay -S --sudoloop --noconfirm pkg(s) <<< password
it works okay with sudo -S, but otherwise it just skips.
Thanks
About this post
- Posted
- Archived
- Score
- 2 · 67% up
- Kind
- Text
- ID
- kfbcvi
11 comments
What is it you're trying to achieve?
echoing your password is generally a bad idea - it will become visible to anyone with access to your shell's historyfile (well, this is easy to avoid) and to your process table.Run installation script with a list of aur and official packages
Okay, so you wrote an installation script and want to run this? I think the best option would be to let
sudoask for the password once at the beginning of the script (for example with asudo id) and then useyaywith the--sudoloopoption.Another option as /u/parkerlreed suggested is to allow your user to run pacman as sudo without having to enter a password.
your_username ALL= NOPASSWD:/usr/bin/pacmanin your sudoers file should work. See https://wiki.archlinux.org/index.php/Sudo#Example_entriesLast option: use something like
echo 'your_password' | sudo -S -kin your script and then useyaywith--sudoloopoption. This is not secure, as your password will be stored in plaintext in your script.As a general rule: if you want to solve a problem always describe your original problem and include as much information as possible. It's way better than just asking why your solution does not work.
you can just use makepkg instead. you don't need to use yay to install/build from AUR. I don't know from memory but if makepkg requires you to build using non-root user you can just
sudo -u nobodyor something along those lines to build with a user without permissions.Or you could just set NOPASSWD for pacman. Not ideal but a hell of a lot better than having your password exposed in plain text.
Interesting, how can this be done. Thanks
Doesn't sudoloop just "save" the password for the duration of the yay command, meaning you dont have to re-enter it? I mean it seems what you are trying to do is just the standard behaviour of paru...?
sudoloop in yay and paru just runs a command with sudo on an interval during long builds. It keeps the sudo timeout from expiring. yay/paru are never aware of your password.
Thats what i meant. Is that not what op is trying to achieve?