Skip to content

Commit 5e60f59

Browse files
committed
upstream: Pass "ControlMaster no" to ssh when invoked by scp & sftp.
If you have ControlMaster auto (or yes) in your config, and the first connection you make is via scp or sftp, then you may get a few unexpected options applied to it (eg ForwardX11 no), since sftp and sftp explicitly disable those for reasons. These effects will persist beyond the initial scp or sftp command. This explicitly disables persistent session *creation* by scp and sftp. It will not prevent them from using an existing session if one has already been created. From Github PR#557, ok djm@ kn@ OpenBSD-Commit-ID: 9dad7c737466837e0150c4318920f46d844770c4
1 parent bbd3686 commit 5e60f59

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

scp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: scp.c,v 1.262 2025/03/19 06:11:15 dtucker Exp $ */
1+
/* $OpenBSD: scp.c,v 1.263 2025/03/28 06:04:07 dtucker Exp $ */
22
/*
33
* scp - secure remote copy. This is basically patched BSD rcp which
44
* uses ssh to do the data transfer (instead of using rcmd).
@@ -505,6 +505,7 @@ main(int argc, char **argv)
505505
addargs(&args, "-oClearAllForwardings=yes");
506506
addargs(&args, "-oRemoteCommand=none");
507507
addargs(&args, "-oRequestTTY=no");
508+
addargs(&args, "-oControlMaster=no");
508509

509510
fflag = Tflag = tflag = 0;
510511
while ((ch = getopt(argc, argv,

sftp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: sftp.c,v 1.239 2024/06/26 23:14:14 deraadt Exp $ */
1+
/* $OpenBSD: sftp.c,v 1.240 2025/03/28 06:04:07 dtucker Exp $ */
22
/*
33
* Copyright (c) 2001-2004 Damien Miller <[email protected]>
44
*
@@ -2463,6 +2463,7 @@ main(int argc, char **argv)
24632463
addargs(&args, "-oForwardX11 no");
24642464
addargs(&args, "-oPermitLocalCommand no");
24652465
addargs(&args, "-oClearAllForwardings yes");
2466+
addargs(&args, "-oControlMaster no");
24662467

24672468
ll = SYSLOG_LEVEL_INFO;
24682469
infile = stdin;

0 commit comments

Comments
 (0)