Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.)

share|improve this question

1 Answer 1

up vote 0 down vote accepted

It's a problem with nano, not the alias. Try using vim.

share|improve this answer
    
Could you please provide a link for that? –  user25656 Nov 29 '12 at 8:11
    
Why, did it work? :P –  penner Nov 29 '12 at 8:12
    
I can't find any resources but it seems the OS is killing the process off after you start it up or nano is running out of memory. –  penner Nov 29 '12 at 8:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.