Access to different accounts logs in one login?

Access to different accounts logs in one login?

Posted by: Decio
Posted on: 2007-12-18 04:19:00

Hi,

I´ve heard about the tail command in the ssh shell that would allow me to monitor multiple logs at the same window.

Problem is that I don´t have access to the logs for a different user login, is there a way around it, since we don´t get root access?

Decio.

__________________________
Use promo code US97OFF to get maximum discounts!
Use o código de promoção US97OFF para descontos de até US50!

Re: Access to different accounts logs in one login

Posted by: Mousee
Posted on: 2007-12-18 04:33:00

You could perhaps try sudo'ing to a different user while logged in as another...

ie.: su username

Re: Access to different accounts logs in one login

Posted by: sdayman
Posted on: 2007-12-18 05:49:00

Another "su" trick is to 'sudo -u USER tail /fullpath/blahblah'

-Scott

Re: Access to different accounts logs in one login

Posted by: Decio
Posted on: 2007-12-18 06:07:00

From what I understood, the advantage of using tail is that I could see all the logs merged as one output.

But that won´t work with sudo, would it? As one tail command had to have access to different log folders. Can I change the access priviledge of the log folder?

Decio.

__________________________
Use promo code US97OFF to get maximum discounts!
Use o código de promoção US97OFF para descontos de até US50!

Re: Access to different accounts logs in one login

Posted by: wholly
Posted on: 2007-12-18 06:20:00

Since everything's a stream in linux/unix you can always tail a tail so if you can have multiple files open in a tail you can have multiple tails open in a tail.

Wholly - Use promo code WhollyMindless for discount.

Re: Access to different accounts logs in one login

Posted by: Decio
Posted on: 2007-12-18 14:08:00

How would this command be then?

__________________________
Use promo code US97OFF to get maximum discounts!
Use o código de promoção US97OFF para descontos de até US50!

Re: Access to different accounts logs in one login

Posted by: sdayman
Posted on: 2007-12-18 14:42:00

I would try something like:
sudo -u USER1 tail /fullpath1/blahblah1 &
sudo -u USER2 tail /fullpath2/blahblah2 &
sudo -u USER3 tail /fullpath3/blahblah3 &
sudo -u USER4 tail /fullpath4/blahblah4 &

The ampersand will set it to run in background, but will continue to spew output on your screen in realtime. Do a Google search on the 'fg' and 'bg' commands to see how to manage background tasks.

-Scott

Re: Access to different accounts logs in one login

Posted by: Lensman
Posted on: 2007-12-18 15:07:00

If you find the lines getting mixed up on your tty, you could try redirecting output from each sudo to a different file and then tailing the multiple output files in a separate process. This might net you the nice multi-file output that tail is capable of (labeling output from each file separately, not mixing up lines of output, etc.)

Re: Access to different accounts logs in one login

Posted by: Tor
Posted on: 2007-12-18 15:55:00

In reply to:

will continue to spew output on your screen in realtime.


From man tail:

"Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. "

For continued spew, use watch "tail file".

tor.eff.org
Promos: MaxTOR: Save Maximum TOR: Save Maximum and give $1 to TOR

Re: Access to different accounts logs in one login

Posted by: sdayman
Posted on: 2007-12-18 16:03:00

I think the original poster *wants* all lines interspersed, which is why I suggested running all in background.

Dang, I forgot to say 'tail -f' for each of the above commands. That will get the log to continuously spew as it's updated.

-Scott

Re: Access to different accounts logs in one login

Posted by: Lensman
Posted on: 2007-12-18 16:09:00

I wasn't sure if the output would be line-by-line or mixed up in the middle of a line with all the background processes spewing at once.

Re: Access to different accounts logs in one login

Posted by: sdayman
Posted on: 2007-12-18 16:41:00

In reply to:

I wasn't sure if the output would be line-by-line or mixed up in the middle of a line with all the background processes spewing at once.



Good point. I'm not sure. Maybe the original poster can give it a try and let us know.

-Scott

Re: Access to different accounts logs in one login

Posted by: Decio
Posted on: 2007-12-19 15:34:00

Hi,

I haven't figured out how I can enter the password for that particular user in the sudo command line. Or do I have to do that with some sort of batch script.

I really don't know my way around linux...

Decio.Edited by decio on 12/19/07 03:36 PM (server time).

Tags: ssh shellmaximum discountslogs