LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Syndicated Linux News (https://www.linuxquestions.org/questions/syndicated-linux-news-67/)
-   -   LXer: Video Tip – Using Pipes With The sudo Command (https://www.linuxquestions.org/questions/syndicated-linux-news-67/lxer-video-tip-%96-using-pipes-with-the-sudo-command-892352/)

LXer 07-18-2011 02:00 PM

LXer: Video Tip – Using Pipes With The sudo Command
 
Published at LXer:

Now, if you’ve ever tried to use sudo to run a command sequence such as a pipeline, where each step required superuser priveleges, you probably got a Permission denied error. This is because sudo only applies to the first command in the sequence and not the others. There are multiple ways to handle this, but there are two that stand out to me. First, you can use sudo to start a shell (such as bash) with root priveleges, and then give that shell the command string. This can be done using the -c option of bash. To illustrate how this works, I’ll start out using sudo to run cat on a file that I created in the /root directory that I normally wouldn’t have access to.

Read More...


All times are GMT -5. The time now is 06:02 PM.