PDA

View Full Version : [ubuntu] gnome terminal



DukeLuke
September 16th, 2009, 03:22 AM
How can I log ssh and/or telnet sessions when using the gnome terminal? When I am logged into devices I like to log commands, etc.

Thanks

k33bz
September 16th, 2009, 03:28 AM
ssh user@xxx.xxx.xxx.xxx
That is one way you can with ssh, or you can install putty

DukeLuke
September 16th, 2009, 03:37 AM
Thanks., but I would like to log the session output to a log file such as a text file. In the future, if I need to go back to the session to view commands and configuration edits, I can open the text file and browse. I know kermit and other apps may be able to do this, but was hoping I can do this in gnome terminal.

k33bz
September 16th, 2009, 03:44 AM
Thanks., but I would like to log the session output to a log file such as a text file. In the future, if I need to go back to the session to view commands and configuration edits, I can open the text file and browse. I know kermit and other apps may be able to do this, but was hoping I can do this in gnome terminal.

o, ok, sorry, I miss understood, that part is a little above my head.

wojox
September 16th, 2009, 03:52 AM
Try this down and dirty:

ssh user@server.com | tee -ai logfile.log

This will log whatever you type on the server. The problem here is, "tee" will capture every inputs (it will capture even if you press arrow keys, backspace, tab key...... and will log it). So, if you open the log file you will see a lot of unreadable characters.

Using commands like "strings" or "col -b" you can remove unwanted characters to an extend, but not fully. A solution what I found here is to use "cat" to view the log file. (using "tail" also looks fine).

Remember there really isn't a log file for ssh sessions since they are only in your bash history.

DukeLuke
September 20th, 2009, 01:40 AM
Thanks Wojox!