Skip to content

Commit ba07e4c

Browse files
committed
Makes OpenSSH control sockets path directory configurable
> closes #48
1 parent 9cfd6de commit ba07e4c

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Open your command palette and type in `SSHubl` to select `Connect to server`. On
6767
// Custom path to `umount` program (`fusermount` on Linux)
6868
// /!\ This setting requires plugin reload (or Sublime restart)
6969
"umount_path": null,
70+
// Custom path to OpenSSH control sockets directory
71+
// /!\ This setting requires plugin reload (or Sublime restart)
72+
// If you hit "path [...] too long for Unix domain socket" error, you may set this to e.g. "/tmp/sshubl"
73+
"sockets_path": null,
7074
// Custom options to pass to OpenSSH **master** (e.g. useful for bastion traversal)
7175
"ssh_options": {
7276
//"ConnectTimeout": 30,

SSHubl.sublime-settings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"ssh_path": null,
44
"sshfs_path": null,
55
"umount_path": null,
6+
"sockets_path": null,
67
"ssh_options": {},
78
"ssh_server_alive_interval": 15,
89
"ssh_login_timeout": 10,

sshubl/paths.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22

33
import sublime
44

5+
6+
def _settings():
7+
return sublime.load_settings("SSHubl.sublime-settings")
8+
9+
510
cache_path = Path(sublime.cache_path()) / "SSHubl"
611
cache_path.mkdir(parents=True, exist_ok=True)
712

8-
sockets_path = cache_path / "sockets"
13+
# OpenSSH binds a temporary UNIX domain socket which is 17 bytes longer than the provided path [1].
14+
# Depending on platform and username, such a path may not fit in kernel pre-allocated space [2]. So
15+
# let's allow users to define their own SSHubl control sockets directory location.
16+
# [1] : <https://github.com/openssh/openssh-portable/blob/5e4bfe6/mux.c#L1285-L1303>
17+
# [2] : <https://unix.stackexchange.com/a/367012>
18+
_sockets_path = _settings().get("sockets_path")
19+
if _sockets_path is not None:
20+
sockets_path = Path(_sockets_path)
21+
else:
22+
sockets_path = cache_path / "sockets"
923
sockets_path.mkdir(mode=0o750, exist_ok=True)
1024

1125
mounts_path = cache_path / "mounts"

0 commit comments

Comments
 (0)