Solved

Linux: Change name of the "tail -f /var/log/log.txt" process in PS and TOP

Posted on 2014-03-08
2
377 Views
Last Modified: 2014-03-08
As said above I need the process to be hidden/name-changed for all users. Embedding it into another process like sshd is also acceptable.
0
Comment
Question by:Sanction
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
Comment Utility
Why would you want to do that?

Anyway, I think it's not possible using high level languages like bash or ksh.

Maybe Perl's "File::Tail" module could be useful.

Here is the very basic example from CPAN, slightly adjusted:

  use File::Tail;
  $file=File::Tail->new("/var/log/log.txt");
  while (defined($line=$file->read)) {
      print "$line";
  }

and here is the link, containing a more sophisticated example:
http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm

You could of course go the very easy way by creating softlinks to "tail" as well as to "/var/log/log.txt":

cd /some/dir
ln -s /usr/bin/tail foo
ln -s /var/log/log.txt bar

Now you can run:

cd /some/dir
./foo -f bar
0
 

Author Comment

by:Sanction
Comment Utility
Thanks, exactly what I was looking for! And to answer your question I am learning Linux Security using offensive tactics.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now