LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-24-2015, 12:20 PM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,375

Rep: Reputation: Disabled
why do I have to su - instead of sudoing this command?


I was purging the residual config files left behind after I deleted various software, and something happened that is more a curiosity than a problem.

So I entered the command
Code:
deborphan --find-config | xargs dpkg --purge
That didn't work, just because I forgot to sudo--
Quote:
dpkg: error: requested operation requires superuser privilege
--so I entered it again.

Code:
sudo deborphan --find-config | xargs dpkg --purge
The peculiar result is that I got the same error message despite sudoing.
Quote:
dpkg: error: requested operation requires superuser privilege
Why is the command still asking for the superuser privilege when I just entered it? I already solved the problem by su-ing to root for a minute (my distro does not have sux), but why was sudo not good enough for this command?
 
Old 05-24-2015, 12:54 PM   #2
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Because the second (`dpkg`) command is after a pipe and this is run as a normal user.

Try this instead:
Code:
sudo bash -c 'deborphan --find-config | xargs dpkg --purge'
EDIT: Nice command BTW -- thank you!

Last edited by Head_on_a_Stick; 05-24-2015 at 12:56 PM.
 
Old 05-24-2015, 06:28 PM   #3
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,375

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
EDIT: Nice command BTW -- thank you!
Well, thank you, but I just picked it up from a site linked to by one of the gurus, in http://www.linuxquestions.org/questi...-files-938113/ . It doesn't work perfectly. For some reason, it won't delete all the files in one attempt, so I have to enter it several times; and after multiple deletions, it starts falsely claiming all the files have been deleted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 01:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 03:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 11:21 AM
Some basic stuff, sudoing etc. ookamiueru Linux - Newbie 10 11-16-2009 10:42 AM
sudoing raven Linux - General 4 01-21-2002 08:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration