FAQ

On Tue, Mar 22, 2016 at 2:27 PM, Srinath wrote:

Hi,

In the context of ssh client in go, (
https://godoc.org/golang.org/x/crypto/ssh) I am looking for

1) some way to disable colors when using session.RequestPty
2) if #1 is not possible, I need some way to strip all colors(they are
formatted as ANSI escape codes) from the string obtained from stdoutpipe of
such session.

Thanks,
Srinath
​I did a quick try on the following, but it is just a straight SSH from my
Linux/Intel system to my Raspberry Pi 3, running Raspbian. Instead of just
entering: ssh rpi3, I entered: TERM=dumb ssh rpi3. This set the terminal to
"dumb" which BASH realizes does not have any coloring capability and so it
doesn't color anything. Looking here:
https://godoc.org/golang.org/x/crypto/ssh#Session.RequestPty The example
shows something like:

// Request pseudo terminal
if err := session.RequestPty("xterm", 80, 40, modes); err != nil {
     log.Fatalf("request for pseudo terminal failed: %s", err)
}

=== change to ===

// Request pseudo terminal
if err := session.RequestPty("dumb", 80, 40, modes); err != nil {
     log.Fatalf("request for pseudo terminal failed: %s", err)
}

Unfortunately, I am ignorant of how to use Go + ssh + public keys. I've
given it a try, but have (so far) failed to get anything working.

--
How many surrealists does it take to screw in a lightbulb? One to hold the
giraffe and one to fill the bathtub with brightly colored power tools.

Maranatha! <><
John McKown

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 22, '16 at 7:27p
activeMar 23, '16 at 10:46a
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase