INPUT/OUTPUT question

Hi All,

Is it wrong to do something like this:

ssh -T $PROXY_USER@$PROXY_SERVER < script.txt > ssh_output.log

I ran and it works fine and does what I need. I wanted to pass a set of commands to the ssh session and store an output in the log file.

Thanks

It's ok.

1 Like

Might want to log stderr as well:

ssh -T $PROXY_USER@$PROXY_SERVER < script.txt > ssh_output.log 2> ssh_error.log

or

ssh -T $PROXY_USER@$PROXY_SERVER < script.txt > ssh_output.log 2>&1
1 Like

Since you're redirecting, you probably don't need the -T at all. The -T option is useful if you want a semi-interactive session, but without a pseudo-tty... in other words something that is more like (in layman terms) talking to a line printer (sort of).

It can be an evil option in that you get something that is somewhat interactive but doesn't leave as much of a 'trail" with regards to things like wtmp, etc.. I only mention this because tricks like this are possible using rsh (remote shell) as well. In case somebody may be thinking differently.

Thanks, I was actually thinking about how to handle ssh errors in this case.