Just wanted to register my interest in being able to use mosh with PythonAnywhere. Once you've gotten used to remote login sessions that survive sleeping/waking your computer and changing networks, going back to plain old ssh is like going back to some terrible past you'd thought you'd left behind*. Any interest in adding mosh support? Thanks for your consideration.

* No lack of dramatic flair here.

Hi J,

I'm pretty sure that PA supports screen, which is similarly useful...

Many thanks, Robert

Ah, I'm not too bright. Mosh is a little different. Looks very cool, mind,


Yes, screen/tmux does complement mosh but does not replace it.

And for what it's worth, I don't have screen installed in my PythonAnywhere environment:

16:45 ~ $ which screen
16:45 ~ $ echo $?

I actually just posted about that earlier today.

And I was the person who started the original screen thread!

Oh nice, I hadn't noticed. Solidarity!

(Wait, so when you said you were pretty sure PA supports screen above, were you mistaken, or am I missing it somehow?)

I don't think it has screen (sorry) :-(

However, can I just say thanks for pointing me to mosh. I love the Chrome shell, and it was super easy to install on my VPS.

Devs: please add an upvote for mosh from me!

I've created a ticket and given it 2 upvotes.

Glad to spread the word, Robert, and thanks for creating the ticket, Glenn!

Using linuxbrew I was able to brew install mosh, and now I can remotely log into PythonAnyhwere via mosh rather than ssh, but after displaying the PythonAnywhere welcome banner that is shown upon login and then my shell's welcome message, it never makes it to displaying an interactive prompt:

<<<<<<:>~ PythonAnywhere SSH. Help @
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
(cursor hangs here)

Just thought I'd post here with my progress in case it helps anyone else / anyone else can take it from here.

One other clue, when I brew installed mosh I got this:

==> Installing mobile-shell
sudo: unknown user: root
sudo: unable to initialize policy plugin
==> Downloading

==> ./configure --prefix=/home/j0452/.linuxbrew/Cellar/mobile-shell/1.2.4_1 --enable-completion
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

I may return to this when my yak-shaving batteries are charged back up, but for now I'll leave it there.

linuxbrew looks interesting.

Good luck with that yak shaving.

Is there an equivalent of bashrc, that mosh needs to jump into an interactive shell?

Has this ever been completed? Also interested in using mosh =)

No, we haven't done anything on this. To be honest, it's quite low on our priority list since we believe that most of the benefits of mosh are provided by our in-browser consoles and general system performance and features are taking priority at the moment.

Tmux is available (and I'd heartily recommend stealing the excellent screen bindings for it). I'm definitely intrigued about the thought of using Linuxbrew for installing non-root applications. I was just pining for the latest Tmux (2.4? as it is only 1.8 is on the dangermouse image) and Linuxbrew could be an answer for that. I've used it to bootstrap Chromebrew on my Chromebook in the past and it is fantastic.

I'll certainly update the thread if I come up with anything.

We don't tend to chase the latest versions of all of the packages that we install because that would leave us with no time to do anything else. We tend to follow what is packaged with the distribution that we're building from. If you absolutely need to chase the new shiny, then LinuxBrew may be the way for you to go.

After a couple days of futzing with this I think I have the yaks shaved in the proper order to make this setup repeatable, but I'm fairly certain this won't work on free accounts due to the myriad external download links that brew uses pulling the software from the original hosting locations.

Because the certificates PyA uses appear to come from an older "stable" distribution they sometimes throw warnings when sites have an updated certificate that they don't trust yet, and currently Linuxbrew (and Homebrew) don't have a way to pass the underlying curl command the insecure flag -k. To work around this we can use the latest certificate trust bundle from Curl's own website to work around this in some cases.


# Curl -L follows redirects, -O saves using server file name
# Brew requires a tmp dir with world writeable and sticky bits set

Install Linuxbrew following directions from

ruby -e "$(curl -fsSL"
echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bashrc
# Occasionally the first brew command fails if the tmp directory isn't readable
brew doctor
# This may fail without sudo, but PyA users aren't in the sudoers group
chmod +t /tmp
# A workaround if the above doesn't work is to create your own ~/tmp and use it
# mkdir ~/tmp; chmod +t ~/tmp; export HOMEBREW_TEMP=~/tmp
# You may also want to add the export above to your ~/.bashrc

Commands to fix brew for PyA:

mkdir -p ~/.local/ssl/; cd ~/.local/ssl/; curl -L -O
CURL_CA_BUNDLE=~/.local/ssl/cacert.pem brew install curl
# brew installed curl uses its own certificates instead of just the OS ones

Now you can use brew to install whatever software you desire.

brew install mosh
brew install tmux

It would be great if a PythonAnywhere staff member could test this in a fresh free and fresh paid user environment and make sure I haven't missed anything. I currently don't have my environment backed up to the point where I could blow it away and retest.

Thanks for the detailed instructions! We'll double-check against fresh free and paid accounts, and report back.

It appears that Mosh needs to open a UDP port between 60,000 and 61,000 (or use a custom port) and these don't appear to be open on PythonAnywhere, and judging from a couple other posts, opening additional ports is a low priority as it increases maintenance and monitoring requirements.

It would be great if 8080 were open for TCP/UDP and running a secondary web server instance for an app admin interface or something similar (that could also be used for Mosh), but I definitely understand not wanting to have to maintain the extra complexity of more ports in the firewall times however many users there are.

That said, Linuxbrew works great for getting the latest Tmux and other goodies, so Mosh would have just been extra icing on the cake.

Here are some updated install instructions for Linuxbrew -- these should work on any paid account:

ruby -e "$(curl -fsSL"
export PATH="$HOME/.linuxbrew/bin:$PATH"
echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bashrc
mkdir ~/tmp; chmod 755 ~/tmp; export HOMEBREW_TEMP=~/tmp
echo 'export HOMEBREW_TEMP=~/tmp' >>~/.bashrc
cd ~/.cache/Homebrew/
brew doctor

+1 for Mosh support (allow UDP on Mosh ports)

Thanks! I've added an upvote to the ticket on our to-do list.

Have there been any updates on this?

No there have not.

I followed the updated install instructions for Linuxbrew, but get the following error in brew doctor: /home/philiplessner/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby: No such file or directory @ rb_readlink - /proc/self/exe (Errno::ENOENT)

This Stack Overflow answer looks like it might be useful...?