-
Notifications
You must be signed in to change notification settings - Fork 215
Conversation
By default, sshcode will now start a master connection with no command so that users only need to authenticate once and multiple connections don't need to be established. This speeds up load times significantly as there are less handshakes required. To disable this behaviour you can use `--no-reuse-connection`.
I tried running this on my MacOS Mojave, and it didn't work. I still had to log in 4 times. Here's what I did: cd /tmp
git clone git@github.com:cdr/sshcode.git
git checkout -b reuse-ssh-connection
rm $GOPATH/bin/sshcode
go clean
go build
go install
sshcode <ssh alias> |
@sumanthratna Does |
- Replace the `ssh -O exit` tidyup command with just a SIGTERM on the master - Add `exec` to the front of the SSH master cmd so it replaces the `sh` process (so we can send SIGTERM to it easier)
Checks if the master process is running by sending signal 0 to it. According to kill(2), sending a signal of 0 will send no signal but will still perform error checking. To prevent the SSH master from becoming a zombie process, a wait call was added in a goroutine.
It does, so I guess I could set up a |
The changes I've made are a more robust version of the ssh-flags thing. That flag will leave SSH commands behind for 5 minutes after sshcode exits. I'd be interested in working out what the problem is with Mac, but I don't have one that I can test on. Could you try (with the released version of sshcode) opening a terminal and running The first process acts as the connection to the server, and all of the other ones should connect through it if it works properly. If that doesn't work, could you try with a different ControlPath (like |
That's the output when I run the second command. The normal I tried using
|
Could you show me the exact command you used? It shouldn't be trying to dial it as a TCP host if it has the |
@sumanthratna Oh wait, my bad. This is totally my mistake. The |
Checks: - if it exists - if it's a directory (if not warn and disable reuse connection feature) - if it has safe permissions (not writable by anyone except the owner, if not then warn)
This needs to be tested in more environments before being merged. |
Adding the |
It's strange that this branch doesn't work then, since what I told you to do is basically what this branch does for you. The |
I just tried again, and it worked! Originally, I didn't remove the current Here's the output:
Everything looks okay, but there's that |
@sumanthratna I've fixed the |
It works great, I think this can be merged. |
By default, sshcode will now start a master connection with no command so that users only need to authenticate once and multiple connections don't need to be established. This speeds up load times significantly as there are less handshakes required. Currently, it requires you to enter your password or SSH key passphrase 4 times (6 times with sync back) unless you are using an agent.
To disable the added behaviour you can use
--no-reuse-connection
.You can do this now on the current sshcode version by doing
--ssh-flags '-o "ControlPath=/tmp/test" -o "ControlMaster=auto" -o "ControlPersist=5m"'
, but this will keep SSH connections open after sshcode exits which likely isn't desired.Closes #115.
TODO:
checkSSHMaster()
also check if the master process is dead incheck
~/.ssh
doesn't exist (and maybe if it's permissions aren't safe)