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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-30-2010, 01:53 PM
|
#1
|
Member
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107
Rep:
|
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,
|
|
|
01-30-2010, 01:59 PM
|
#2
|
Member
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572
Rep:
|
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?
|
|
|
01-30-2010, 02:03 PM
|
#3
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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
|
|
|
01-30-2010, 02:17 PM
|
#4
|
Member
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107
Original Poster
Rep:
|
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,
|
|
|
01-30-2010, 02:25 PM
|
#5
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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:
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:
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
|
|
|
02-04-2010, 02:03 PM
|
#6
|
Member
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107
Original Poster
Rep:
|
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
|
|
|
02-04-2010, 02:16 PM
|
#7
|
Member
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 100
Rep:
|
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.
|
|
|
02-04-2010, 02:21 PM
|
#8
|
Member
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107
Original Poster
Rep:
|
Thanks for the response,
However this command worked
$mkfifo /tmp/myfifo
seems like a permission issue.
|
|
|
02-04-2010, 02:34 PM
|
#9
|
Member
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107
Original Poster
Rep:
|
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.
|
|
|
02-04-2010, 06:04 PM
|
#10
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397
|
Lateral approach; ask the guy who was monitoring you ...
|
|
|
All times are GMT -5. The time now is 04:59 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|