LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-30-2010, 01:53 PM   #1
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Rep: Reputation: 18
Tail users commands


Hello All,

I have a quick question , This happened to me when I was logged in as a regular user in a production server . I was executing few commands , the person who was helping me was logged into the same host from another location (NY or something).I executed a script which is not accurate for that version of application running in the host . Then he pinged me via Microsoft communicator and instructed me not to use that script rather to use correct script for that version.

From then I was intrigued by how he found that out , I know that if one has root access he can view other users command history file but even root cannot tail the command history file.root can only cat the file once the user has ended the session.

Although "top -U username" will briefly show the command executed by the user.

Anyone here has any idea of how to tail other users commands or tail their command history file when they are in action.

thanks in advance,
 
Old 01-30-2010, 01:59 PM   #2
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
Perhaps he just saw the results of the script and realised it was the wrong one? Is the script names differently? perhaps he ran the ps or top command?
 
Old 01-30-2010, 02:03 PM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Maybe he's paranoid and watches logged on users with the 'w' command. That'll tell him what you are doing. He can even tail it with the use of a fifo pipe.

Kind regards,

Eric
 
Old 01-30-2010, 02:17 PM   #4
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Original Poster
Rep: Reputation: 18
Thanks devnull10,
Result of the script is not something logged anywhere or it doesnt leave any trace around , and yes the 2 scripts names are different.

Thanks EricTRA,
As far as i knew "w" command will only show who logged in from where and time. Am not sure about what you mean by "He can even tail it with the use of a fifo pipe" could you please elaborate

Thanks,
 
Old 01-30-2010, 02:25 PM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Output of who:
Code:
root     tty1         2010-01-30 12:06
root     pts/0        2010-01-30 14:58 (:0)
root     pts/3        2010-01-30 20:59 (:0.0)
compared to output of w:
Code:
 21:18:52 up  9:14,  5 users,  load average: 0.73, 0.83, 0.67
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                12:06    6:20m  0.16s  0.01s /bin/sh /usr/bin/startx
root     pts/0    :0               14:58    6:20m  0.00s  1.09s kded4
root     pts/3    :0.0             20:59    0.00s  0.02s  0.00s w
You'll notice that with who you get what you mentioned. The output of w also lists what the logged on users are currently doing. A fifo pipe is like a wormhole to which you can send data. You create it using:
Code:
mkfifo nameyougive
and then you can send data to it from another console, another user, whatever you like. And you can follow it (fifo = first in first out) with the tail command on your console:
Code:
tail -f nameyougive
So if you then have like a little script that executes:
Code:
w > nameyougave
in a loop with a sleep interval of 30 seconds, you can kind of follow what your logged on users are doing.

Kind regards,

Eric
 
Old 02-04-2010, 02:03 PM   #6
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Original Poster
Rep: Reputation: 18
Thanks EricTRA,

mkfifo gives me the following error,

mkfifo: cannot create fifo `test': Operation not permitted

is it possible only for root to mkfifo . Kindly advise
 
Old 02-04-2010, 02:16 PM   #7
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 100
Blog Entries: 1

Rep: Reputation: 20
He was probably monitoring the log file for the application that you used in the script in a terminal via the "tail -f filename" command.
 
Old 02-04-2010, 02:21 PM   #8
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Original Poster
Rep: Reputation: 18
Thanks for the response,

However this command worked

$mkfifo /tmp/myfifo

seems like a permission issue.
 
Old 02-04-2010, 02:34 PM   #9
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Original Poster
Rep: Reputation: 18
Hello All,

The use of named pipe doesn't seem to work the expected way . whichever command (w , who , top -U <username>) doesn't seem to work the exact way as expected , none of the command redirected into the named pipe seems to show what that user is executing ,Is there any other way to accomplish the intial cause of this thread

Thanks.
 
Old 02-04-2010, 06:04 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
Lateral approach; ask the guy who was monitoring you ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Restrict what commands users can use? jasone *BSD 1 11-30-2006 06:50 AM
commands to Add Users bickyz Linux - Networking 2 11-12-2004 09:13 AM
Using 'r' commands as root users lapthorn Linux - Networking 2 11-24-2003 08:03 AM
Is it possible to hide users from the 'who' and 'w' commands? BxBoy General 8 03-30-2003 01:33 AM
Allowing Users commands Atroxic Linux - Newbie 2 02-01-2002 11:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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