Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can tmux pane remote ssh-connection

Tags:

linux

tmux

Can I run tmux locally and connect via ssh to remote machine.. and after that any new pane and/or screen to be with the remote-machine-shell... What I'm saying I can't install tmux on the remote machine, but I don't want to do a ssh connection from every pane, but ssh-login just once.

Is such thing possible.. thanks

like image 219
sten Avatar asked May 10 '12 15:05

sten


People also ask

Does tmux work over SSH?

With tmux you only need one SSH connection to the server. The great thing about tmux is it allows you to have multiple panes open at the same time, each with their own shell running, but using the same, single SSH connection.

How do I remotely connect to SSH?

To initiate an SSH connection to a remote system, you need the Internet Protocol (IP) address or hostname of the remote server and a valid username. You can connect using a password or a private and public key pair. Because passwords and usernames can be brute-forced, it's recommended to use SSH keys.

What is tmux pane?

A tmux pane is the entity that we actually use to run commands, scripts, and processes, such as ssh, backup, vim, htop, and what have you. Technically, they are pseudoterminals encapsulating shells, like Zsh or Bash. In other words, they are terminals within a terminal.


1 Answers

If you want to login just once, you can use ControlMaster feature of ssh. Add some config like this to your ~/.ssh/config:

ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

If you login to the same server (as the same user) multiple times (either in one tmux or not), ssh will reuse the connection so that you don't need to make connection and login again.

like image 72
lilydjwg Avatar answered Oct 16 '22 09:10

lilydjwg