Friday, January 25, 2008

Tail remote logs


In this post, I mentioned that I was looking for a way to tail log files on a remote computer. Stig commented with a suggestion.  You can specify the sudo and tail command to ssh




ssh user@hostname 'sudo tail -f /var/log/messages'



I am using this solution, but there are two problems:



  1. Your password will appear in the clear in the terminal window when entering it for the sudo command

  2. sudo has to be configured to work on a non-tty terminal, which could be a security hole.


1 comment:

  1. How about using SSH to set up a tunnel between 2 random ports, and then run local and remote instances of 'nc' to pipe the file through the tunnel? That way, you could de-couple the ssh from the cat, and not have the same kind of issues? I can dig up an example if you'd like, but there are some good nc examples on the man page...

    ReplyDelete