I want to be able to configure a screen session through screenrc or within a session to behave just like an xterm terminal. Currently I have a c# app that uses ssh.net libraries to ssh to a Linux box from a windows machine where I attach to a screen session and send commands and receive responses back. I see two different kind and responses for the same command if I am attached to a screen session compare to when I am not attached to a screen session. To demonstrate the problem I will duplicate the issue using a putty terminal and log the data.
- Open a putty terminal from windows
- Change the Session->Logging setting and select SSH Packets, also browse to a location to save the putty.log file
- Set your IP address and connect to a Linux machine
- Once logged in, issue the following command printf "abc\6\n", this string contains an ack character
- the response will print abc and of course it would not show the \6 since it is not a printable character
- Open putty.log file and you will see the response packets data contains \6 which is the correct behavior.
- Now create a session by issuing the following command: screen -dmS test
- Attach to the session by issuing the following command: screen -Rr test
- issue the following command again printf "abc\6\n"
- abc will be printed as expected, but if you look at response packets data in putty.log it won't have the \6 character anymore
- I can solve this issue by piping the command like this printf "abc\6\n" | cat -v to convert \6 to printable form and show ^F on the screen, I would rather receive \6 in my packets data and this is not a desirable solution but at least it provides a solution to my problem.
The following is a more serious issue that I haven't been able to resolve. To demonstrate please do the following:
- Open a putty terminal from windows
- Change the Session->Logging setting and select SSH Packets and also browse to a location to save the putty.log file
- Set your IP address and connect to a Linux machine
- Once logged in, Change the stty setting by issuing the following command (tells the terminal to not replace the new line by carriage return): stty -onlcr
- then issue the command ls -al,
- The putty.log file will contain the correct set of data with no extra characters.
- Now create a session by issuing the following command: screen -dmS test
- Attach to the session by issuing the following command: screen -Rr test
- issue the following command again stty -onlcr
- issue ls -al again
- if you look at response packet data in putty.log it you will see that after a certain number of packets received the response will contain extra characters in front of each response. the extra characters are in the following format [13C. the numbers between [ and C varies.
I would like to make my responses behave the same way as an standard xterm terminal, Why is there a difference and is there a way to configure the screen to get responses consistent with a xterm type of terminal.