coder / sshcode

Run VS Code on any server over SSH.
MIT License
5.74k stars 215 forks source link

Password is asked for multiple times #163

Open sumanthratna opened 4 years ago

sumanthratna commented 4 years ago

From #115:

I ran sshcode <ssh alias> and I was asked for my password 4 times. I can't set up passwordless ssh because of the way Kerberos and AFS are set up on the remote server.

It would be great if there was somehow a way to only ask for the password once. However, this would probably sacrifice some security.

This issue came back. Yesterday, December 29, 2019, I re-ran go get -u go.coder.com/sshcode to update the package.

Output of sshcode tj:

2019-12-29 13:11:06 INFO  starting SSH master connection...
2022sratna@remote.tjhsst.edu's password: 
2019-12-29 13:11:37 ERROR failed to start SSH master connection: SSH master wasn't ready on time: max number of tries exceeded: 30
2019-12-29 13:11:37 INFO  ensuring code-server is updated...
2022sratna@remote.tjhsst.edu's password: 
++ uname -m
+ '[' x86_64 '!=' x86_64 ']'
+ pkill -f /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ mkdir -p /afs/csl.tjhsst.edu/students/2022/2022sratna/.local/share/code-server /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode
+ cd /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode
+ curlflags='-o latest-linux'
+ '[' -f latest-linux ']'
+ curlflags='-o latest-linux -z latest-linux'
+ curl -o latest-linux -z latest-linux https://codesrv-ci.cdr.sh/latest-linux
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
+ '[' -f /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server ']'
+ rm /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ ln latest-linux /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ chmod +x /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
2019-12-29 13:13:11 INFO  syncing settings
2022sratna@remote.tjhsst.edu's password: 
building file list ... done

sent 192 bytes  received 20 bytes  24.94 bytes/sec
total size is 172032  speedup is 811.47
2019-12-29 13:13:19 INFO  synced settings in 7.225311372s
2019-12-29 13:13:19 INFO  syncing extensions
2022sratna@remote.tjhsst.edu's password: 
building file list ... done

sent 76 bytes  received 20 bytes  27.43 bytes/sec
total size is 0  speedup is 0.00
2019-12-29 13:13:22 INFO  synced extensions in 10.508270347s
2019-12-29 13:13:22 INFO  starting code-server...
2019-12-29 13:13:22 INFO  Tunneling remote port 51107 to 127.0.0.1:31419
2022sratna@remote.tjhsst.edu's password: 
info  Server listening on http://127.0.0.1:51107
info    - No authentication
info    - Not serving HTTPS
^C2019-12-29 13:14:30 INFO    shutting down

Output of sshcode --ssh-flags '-o "ControlPath=~/.ssh/control-%h-%p-%r"' tj:

2019-12-29 13:16:03 INFO  starting SSH master connection...
2022sratna@remote.tjhsst.edu's password: 
2019-12-29 13:16:34 ERROR failed to start SSH master connection: SSH master wasn't ready on time: max number of tries exceeded: 30
2019-12-29 13:16:34 INFO  ensuring code-server is updated...
Control socket connect(/Users/suman/.ssh/control-remote.tjhsst.edu-22-2022sratna): Connection refused
2022sratna@remote.tjhsst.edu's password: 
++ uname -m
+ '[' x86_64 '!=' x86_64 ']'
+ pkill -f /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ true
+ mkdir -p /afs/csl.tjhsst.edu/students/2022/2022sratna/.local/share/code-server /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode
+ cd /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode
+ curlflags='-o latest-linux'
+ '[' -f latest-linux ']'
+ curlflags='-o latest-linux -z latest-linux'
+ curl -o latest-linux -z latest-linux https://codesrv-ci.cdr.sh/latest-linux
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
+ '[' -f /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server ']'
+ rm /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ ln latest-linux /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
+ chmod +x /afs/csl.tjhsst.edu/students/2022/2022sratna/.cache/sshcode/sshcode-server
2019-12-29 13:17:10 INFO  syncing settings
Control socket connect(/Users/suman/.ssh/control-remote.tjhsst.edu-22-2022sratna): Connection refused
2022sratna@remote.tjhsst.edu's password: 
building file list ... done
deleting state/global.json
deleting state/empty-window.json
deleting state/-721c4179.json
deleting state/
./

sent 198 bytes  received 26 bytes  10.93 bytes/sec
total size is 172032  speedup is 768.00
2019-12-29 13:17:30 INFO  synced settings in 20.892316347s
2019-12-29 13:17:30 INFO  syncing extensions
Control socket connect(/Users/suman/.ssh/control-remote.tjhsst.edu-22-2022sratna): Connection refused
2022sratna@remote.tjhsst.edu's password: 
building file list ... done

sent 76 bytes  received 20 bytes  21.33 bytes/sec
total size is 0  speedup is 0.00
2019-12-29 13:17:34 INFO  synced extensions in 23.973192331s
2019-12-29 13:17:34 INFO  starting code-server...
2019-12-29 13:17:34 INFO  Tunneling remote port 64098 to 127.0.0.1:60900
2022sratna@remote.tjhsst.edu's password: 
info  Server listening on http://127.0.0.1:64098
info    - No authentication
info    - Not serving HTTPS
^C2019-12-29 13:18:08 INFO    shutting down

I'm on macOS 10.15.3 Beta. sshcode --version prints a newline (#154), but I installed sshcode via go get.

sshcode --ssh-flags '-o "ControlPath=/tmp/test" -o "ControlMaster=auto" -o "ControlPersist=5m"' tj works fine, but I still think #116 should be fixed because the SSH connection will be kept after sshcode is quit.

deansheather commented 4 years ago
2019-12-29 13:11:37 ERROR   failed to start SSH master connection: SSH master wasn't ready on time: max number of tries exceeded: 30

For some reason the master doesn't connect in time. Are you typing in the password and hitting enter quick enough?

sumanthratna commented 4 years ago

Sorry for the late reply! I just tried again and I entered the password immediately after it was asked for. sshcode works fine, but the original problem still stands—I was asked for my password 5 times.

riuriuriu commented 4 years ago

I face the same issue with public key auth:

2020-05-20 09:04:21 INFO    starting SSH master connection...
2020-05-20 09:04:51 ERROR   failed to start SSH master connection: SSH master wasn't ready on time: max number of tries exceeded: 30
2020-05-20 09:04:51 INFO    ensuring code-server is updated...
...

The following sync and startup succeeds, but the first connection always times out.