2007-06-15-duplicate-ssh-sessions-without-password-prompt.md 1.77 KB
Newer Older
Danesh Manoharan's avatar
Danesh Manoharan committed
1
2
---
title: Duplicate ssh sessions without password prompt
3
author: Danesh Manoharan
Danesh Manoharan's avatar
Danesh Manoharan committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
date: 2007-06-15T03:33:08+00:00
pvc_views:
  - 4191
dsq_thread_id:
  - 889737661

---
I work with multiple ssh sessions whenever I connect to a server. Typically I would have about 3 sessions initiated from my host machine to the destination server.

Found away to duplicate my session without retyping my password every time I initiate a connection the the server from my host machine thanks to  [Linux By Examples.][1]

Add the following 2 lines to your /etc/ssh/ssh_config file and feature will be ready for you to use once you restart the sshd service.

_**ControlMaster auto  
ControlPath ~/.ssh/socket-%r@%h:%p**_

[![ssh-dup.jpg][2]][3]

<!--more-->

**ControlMaster**  
Enables the sharing of multiple sessions over a  single  
26
network  connection.   When  set  to  "yes"  ssh will  
Danesh Manoharan's avatar
Danesh Manoharan committed
27
28
29
listen for connections on a  control  socket  specified  
using  the  ControlPath  argument.  Additional sessions  
can connect to this socket using the  same  ControlPath  
30
with  ControlMaster set to "no" (the default).  These  
31
sessions will reuse the master instance's network  con-  
Danesh Manoharan's avatar
Danesh Manoharan committed
32
nection  rather than initiating new ones.  Setting this  
33
to "ask" will cause ssh to listen for control connec-  
Danesh Manoharan's avatar
Danesh Manoharan committed
34
35
36
37
38
39
40
41
42
43
44
tions,  but  require confirmation using the SSH_ASKPASS  
program before they are accepted  (see  ssh-add(1)  for  
details).

**ControlPath**  
Specify  the  path  to  the  control  socket  used  for  
connection sharing.  See ControlMaster above.

 [1]: http://linux.byexamples.com/archives/286/duplicate-ssh-session/
 [2]: /wp-content/uploads/2007/06/ssh-dup.jpg
 [3]: /wp-content/uploads/2007/06/ssh-dup.jpg "ssh-dup.jpg"