
Gotty – Share your terminal as a web application - nimitkalra
http://github.com/yudai/gotty
======
StavrosK
By the way, if you want to share your terminal ephemerally with someone over
SSH, I swear by [http://tmate.io/](http://tmate.io/). It was something I
desperately needed a solution for, and tmate delivers very very well.

~~~
mikekchar
One of these days I need to write a blog post on how to do it, but I pair
program with my colleagues over ssh and tmux.

Briefly:

\- Set up a guest account on your computer. Write a small script containing
"tmux attach-session -S /tmp/guest-session -t guest". Make this shell script
the login shell for the guest account (make sure you are patched against
heartbleed ;-) )

\- Create a guest group and add your user and the guest user to it

\- Write a script for you that contains "tmux -S /tmp/guest-session -t guest
new"

\- Configure ssh for RSA login

\- Whenever you want to work with someone, add their ssh key to the guest
account's .ssh/authorized_keys. Then run your script to start the tmux
session.

\- They still won't be able to log in until you give read and write
permissions to the tmux socket (which allows you to have some control over
when people can log in). To allow them to log in: "sudo chgrp guest
/tmp/guest-session"

Note that you still have to trust the person because they will be sharing your
session. However, you will be able to see everything they are doing. When they
ssh in, they will immediately join your tmux session (unfortunately without
any notification -- need to see if there are some hooks you can use to notify
when people attach to the session).

Having a shell script as a login shell is obviously a potential security hole,
so you should make sure that authorized_keys only contains keys when you want
people to log in.

There is a project somewhere that contains a lot of scripts for doing this
kind of thing (I forget what it is called), but I think it is better to learn
how to do it yourself ;-)

~~~
todd3834
I tried this for a while but then I tried ScreenHero and I've never gone back.

~~~
luckman212
Was excited to try ScreenHero but it seems they are closed now as they were
acquired by Slack.

~~~
d_k_f
You can use your existing Slack account to login to ScreenHero as well.

If you don't have one, just try registering a free account with Slack, that
might work as well.

~~~
LiquidFlux
You have to be a paying member of Slack to use ScreenHero.

------
bketelsen
Add this to ngrok [0] and you've got some pretty serious remote collaboration
tooling, with security.

[0] [https://ngrok.com/](https://ngrok.com/)

~~~
inconshreveable
yep, i'd love to see this integrated with ngrok. would a gotty+ngrok
combination be something folks would pay for?

~~~
jackcouch
I'd like to use this to provide a development environment for a friend in
Africa trying to learn to program. He has random access to random computers so
any client side install is a problem.

I would be happy to pay for the product or just pay someone to build it if it
isn't hard.

Here are my assumptions: 1\. I could enable this on a cheap cloud server to
expose a terminal that will work with tmux and vim. 2\. I could create an
account for my friend(s) so that they could access the server securely from
within thier browser. 3\. There is no clientside install or config needed.

Let me know if you are willing to wire it together.

~~~
patio11
I recommend taking a look at CodePicnic, which gives him a fully-functional
Linux image front-ended by a JavaScript UI which you can embed anywhere. I
have successfully used it from e.g. iPhone Safari.

------
avivo
I believe that the last time I tried running emacs in my browser, keyboard
shortcuts didn't work well. With this they work flawlessly!

It's also perfectly performant on desktop (chrome with os x, air 2013), though
still unusably slow on my phone (chrome on original motox).

This may be more of a testament to
[https://github.com/macton/hterm](https://github.com/macton/hterm) though!
(apparently what gotty is using)

~~~
avivo
I wonder if it would be useful to run emacs within a browser based editor like
Atom. It even seems plausible to be able to seamlessly switch editors
"containers" for particular operations without even leaving a file (using the
editors API to replace the pointer in the same place).

~~~
AceJohnny2
> I wonder if it would be useful to run emacs within a browser based editor
> like Atom

Considering Emacs is already thought of as a decent OS ("lacking a good
editor"), I can only think:

"We have to go deeper."

------
jstoiko
Very cool! I was always struggling during live presentations switching from
browser to console window. Now I can use a browser window on the projector
screen for both presentation and console.

Thanks for sharing.

~~~
thinkpad20
Not to be snarky, but what's wrong with Alt+Tab (Or platform-specific
equivalent)? You still have to use multiple windows -- that both happen to be
in the browser doesn't seem particularly important.

------
sloppycee
Reminds me of [https://showterm.io/](https://showterm.io/)

------
johns
See also
[https://github.com/progrium/termshare](https://github.com/progrium/termshare)

------
krishnasrinivas
Check out [https://nutty.io](https://nutty.io) if you find gotty interesting
you'll find nutty interesting too.

------
helper
Everytime I use a terminal in the browser for a live demo I end up running
into horrible keybinding conflicts between the two (hitting C-w to delete
backwards word and instead closing the tab).

------
joshbaptiste
hmm.. uses hterm.js under the hood for the JS terminal, wonder how that
compares to term.js.. very cool project indeed.

~~~
sweetcakes_2600
Is hterm.js in any way related to
[http://41j.com/hterm/](http://41j.com/hterm/) ?

------
techdragon
Damn it, I literally could have used this last night. Ended up using a
disposable VM on DIgitalOcean for shared tmux.

We were going to use tmate, but having to compile manually on OS X caused
issues. Pro tip, if you only include instructions on how to install you tool
with homebrew, at least make sure your makefile works on OS X. Not everyone
has drunk or wants to drink the homebrew cool-aid. I currently use macports
and grow ever tempted with the passage of time to switch over to PkgSrc or
even a Gentoo Prefix install. Gentoo probably would have won by now if it was
better able to integrate with the native shell, path vs entering prefix wise.

~~~
superchink
Can I ask for more detail explaining your aversion to homebrew? Just curious…

------
wspeirs
I've always thought it'd be interesting to write a display driver for
VirtualBox that uses WebGL so you can essentially get a desktop through a web
browser...

~~~
bliti
Something that works like Guacamole[1]?

[1][http://guac-dev.org/](http://guac-dev.org/)

~~~
wspeirs
... well there you go!

------
krat0sprakhar
I can't read much of Go so can anyone explain how does this work at a high-
level? The Vim editing example looks really cool! Does it keep taking a
snapshot of the running command and send the data via a websocket?

~~~
JamesMcMinn
[https://github.com/yudai/gotty/blob/master/app/app.go#L73-L1...](https://github.com/yudai/gotty/blob/master/app/app.go#L73-L103)

^ Those are the key lines really.

It's running the command in a pseudo-terminal, capturing the output (as text)
and sending it over a web socket.

------
hosh
I'll have to try this. This would probably make screen pairing easier.

------
anilgulecha
Gotta give this a shot. Very similar to shellinabox -- which also allows
https, login shell, etc. On the other hand shellinabox has not been maintained
since 2012/13.

------
sparaker
This is such a useful project. Seems to be working well in my tests on OS X
and i was unsuccessful setting up tmate on my machine.

(silent tears of joy)

------
j_baker
Is it just me, or does this seem horrendously insecure? How does this prevent
arbitrary third parties from accessing your terminal?

~~~
anti-shill
what could possibly go wrong?

~~~
Vecrios
Anyone sending to localhost (the IP of the machine running this) would have
access to said command line, and can do as they please.

------
snurk
What are the use cases for this?

------
em3rgent0rdr
Cool use case would be to follow a live stream of your favorite hacker in
action!

------
chilicuil
Mind blowing, obvious once you see/use it.

Gotty + Pagekite (or ngrok) = remote happiness.

------
acd
Cool and great idea!

------
piptastic
twitch for MUDs!

nice.

------
geniium
Pretty cool! Security might be to reconsider.

------
siddcoder
Cool Stuff !!

