LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-26-2011, 12:39 AM   #1
pandunr
LQ Newbie
 
Registered: May 2011
Posts: 12

Rep: Reputation: Disabled
tee command in sudoer file


I have previlige to use tee command with sudo. When I try to execute the tee command with sudo, system is asking root password. How can use tee with sudo without root password. Here is the command

sudo tee file

When I execute the command system prompts for root password. I'm expecting system should prompt for individual id password.
 
Old 07-26-2011, 09:35 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
sudo does NOT ask for the root password (unless you are already root when you invoke it) - It asks for the password of the user that is invoking the sudo command.

What exactly are you trying to do with tee? "tee file" is meaningless. The point of the tee command is to allow you to send output to a second location.

For example if you wanted to see the output of "ls -l" on the screen and also have it stored in a file you would type:
"ls -l |tee /tmp/ls.txt"

Since tee only acts on stdout you might want to also insure stderr went to the file in which case you'd do standard redirection:
"ls -l 2>&1 |tee /tmp/ls.txt"

tee itself does not require root access so I'm not sure why it would be in your sudoers setup. Instead you'd want the command you're running in sudoers. For example if you needed to save the output of /etc/shadow file you might run:
"sudo cat /etc/shadow |tee /tmp/shadow.out" The command would run as root then pipe stdin to tee which would run as your original user and create the file /tmp/shadow.out as your original user.

You could also run something like:
"sudo cat /etc/shadow |sudo tee /tmp/shadow.out" to make it run tee as root and create the output file owned by root.

Maybe if you give us an idea of what you're trying to do with tee it would help.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use tee linux command rami_hachem Linux - Newbie 4 02-08-2011 09:59 AM
how does tee command implemented? hellorajni Linux - Newbie 1 11-04-2010 02:51 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 01:31 PM
I have no sudoer file ?!? zeckx Debian 3 04-19-2009 07:53 PM
not in sudoer file Ishmile Linux - Newbie 1 03-19-2008 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:09 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