Edit: echo
and sudo
used together as shown below can have unexpected consequences. Please avoid such usage as far as possible.
I'm on Lubuntu 12.10 fully updated.
I know that what I'm asking could be a security risk but I would still like to understand what's happening.
I can get the following aliases to work:
fast='echo "mypassword" | sudo -S apt-fast update && sudo apt-fast upgrade'
nm='echo "mypassword" | sudo -S service network-manager restart'
aalog='echo "mypassword" | sudo -S aa-logprof'
reloadsm='echo "mypassword" | sudo -S apparmor_parser -r /etc/apparmor.d/usr.local.seamonkey.seamonkey'
reloadgc='echo "mypassword" | sudo -S apparmor_parser -r /etc/apparmor.d/opt.google.chrome.google-chrome'
But when I try this alias
pua='echo "mypassword" | sudo -S nano /etc/privoxy/user.action'
I see this:
[12:32 PM] ~ $ pua
Received SIGHUP or SIGTERMa:
[12:32 PM] ~ $
Can someone please explain why this happens and if there's a way to fix the error-giving alias?
(I don't want to do anything involving sudoers.)