openssh-portable icon indicating copy to clipboard operation
openssh-portable copied to clipboard

send COLORTERM environment variable

Open caarlos0 opened this issue 1 year ago • 2 comments

most terminals that support truecolor set the COLORTERM=truecolor environment variable.

currently, openssh only sends TERM by default. I believe we could send COLORTERM, too, so things running on the target server may properly detect colors.

That said, it has been a long time since I last did any C, and I don't know the codebase, but this is a try... happy to work more on it with some guidance if you think this is a good thing to do.

Cheers!

caarlos0 avatar May 09 '24 17:05 caarlos0

This isn't sufficient, as TERM has special handling in the ssh session protocol (see https://datatracker.ietf.org/doc/html/rfc4254#section-6.2) that doesn't exist for COLORTERM.

Fortunately you can get COLORTERM sent without any code changes at all, using the existing environment variable passing support. Just put SendEnv COLORTERM in your ~/.ssh/config and AcceptEnv COLORTERM in your /etc/ssh/sshd_config and it should work.

djmdjm avatar Jun 14 '24 02:06 djmdjm

Hey! Thanks for the response!

Yep, I'm aware of SendEnv...

My idea was to send/accept COLORTERM by default, so the users don't have to, and all the CLIs that use it will get true color support.

Not sure if it makes sense, nor if its something SSH wants as a project, but I thought it would be nice.

caarlos0 avatar Jun 14 '24 12:06 caarlos0