Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStudio may not show SSH password prompt on macOS #206

Open
mhesselbarth opened this issue Sep 28, 2020 · 19 comments
Open

RStudio may not show SSH password prompt on macOS #206

mhesselbarth opened this issue Sep 28, 2020 · 19 comments

Comments

@mhesselbarth
Copy link

The HPC cluster I'm using does not allow to use a SSH key pair unfortunately. I know that some packages allow an interactive password prompt. Would something also be possible for the clustermq package?

Thanks a lot for the help!

@mschubert
Copy link
Owner

If I remember correctly, it already asked for a password on the console if no keys are set up.

Does it not work? If no, can you describe you setup and what you see?

@mhesselbarth
Copy link
Author

mhesselbarth commented Oct 1, 2020

Okay, so I think the problem is that ZeroMQ is not installed on the cluster. I talked to the admin and they were not super excited about installing it unfortunately.

Are there any resources which explain a bit more why clustermq need zeroMQ and what zeroMQ is actually used for within the package? This would hopefully help me explaining to them why it would be cool if they could install the library.

@mschubert
Copy link
Owner

mschubert commented Oct 1, 2020

ZeroMQ provides that TCP/IP sockets that clustermq communicates with its workers.

There is a high chance the library is already installed on your cluster, e.g. as part of any IPython/Jupyter setup.

If not, it should be as simple as downloading the release and:

# tar -xf ... and change into directory
./configure
make
make install # probably "make DESTDIR=/somewhere/in/your/home/dir install"

followed by:

# if you find the library installed somewhere you can just add that path here
LD_LIBRARY_PATH=/somewhere/in/your/home/dir/lib R -e "install.packages('clustermq')"

I should probably still write this down step-by-step in the docs. Please let me know if this works and if you run into any problems!

@mhesselbarth
Copy link
Author

mhesselbarth commented Oct 1, 2020

Okay, ZeroMQ should be now installed on the HPC and I can also load the package on the HPC without any errors.

But trying to connect from my local R session I get the following errors and the password prompt never shows up. Not sure if that is a problem with my laptop and the SSH though. I did re-install ssh-askpass but that did not help.

Connecting [email protected] via SSH ...

ssh_askpass: exec(/usr/X11R6/bin/ssh-askpass): No such file or directory

Error in .subset2(public_bind_env, "initialize")(...) : publickey,keyboard-interactive).
  Remote R process did not respond after 5000 seconds. Check your SSH server log.

I'm on macOS Catalina 10.15.6

@mschubert
Copy link
Owner

Please have a look at this and see if it helps: https://mschubert.github.io/clustermq/articles/userguide.html#ssh-1

@mhesselbarth
Copy link
Author

So ssh -R 54709:localhost:6687 <user@host> R --vanilla did run without any problems and started an R session.

I also have a .log-file setup in my local .Rprofile options but can't find it anywhere if I try to excuse the Q function from RStudio

@mschubert
Copy link
Owner

My guess is that ssh-askpass is incorrectly set up in RStudio.

What is your:

echo SSH_ASKPASS # shell
Sys.getenv("SSH_ASKPASS") # R and RStudio

Does the file /usr/X11R6/bin/ssh-askpass actually exist?

Does the clustermq example work if you start it from R instead of RStudio?

@mhesselbarth
Copy link
Author

I tried R and RStudio and both do not work.

Here is what the two commands returned.

echo SSH_ASKPASS
SSH_ASKPASS
> Sys.getenv("SSH_ASKPASS") # R and RStudio
[1] "rpostback-askpass"

@mschubert
Copy link
Owner

I've updated the SSH troubleshooting page to also test

system("ssh -R 54709:localhost:6687 <user@host> R --vanilla")

from R so we can see if the SSH connection works that way.

Above, echo SSH_ASKPASS should have been echo $SSH_ASKPASS.

@mhesselbarth
Copy link
Author

Okay, so echo $SSH_ASKPASS returns nothing. Could that be the problem that ASKPASS is not setup correctly?

@mschubert
Copy link
Owner

I think SSH_ASKPASS within R is trying to use a client that does not exist (/usr/X11R6/bin/ssh-askpass)

You could try and fix that, or try unsetting SSH_ASKPASS within R and see if this changes anything

These may also be a solution/workaround: (1) microsoft/vscode#32097, (2) http://it.gerull.nl/blog/2018/ssh-agent-on-mac/

@mschubert
Copy link
Owner

@mhesselbarth Did any of the hints help?

@mhesselbarth
Copy link
Author

Not really...I was able to reach another cluster that I have access to from the machine. So it's seems to be a problem on the cluster side I think..

@mhesselbarth
Copy link
Author

Here is the debug from system("ssh -v -R 54709:localhost:6687 [email protected] R --vanilla").

OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/Maximilian/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
  debug1: Connecting to greatlakes.arc-ts.umich.edu port 22.
debug1: Connection established.
debug1: identity file /Users/Maximilian/.ssh/id_rsa type -1
debug1: identity file /Users/Maximilian/.ssh/id_rsa-cert type -1
debug1: identity file /Users/Maximilian/.ssh/id_dsa type -1
debug1: identity file /Users/Maximilian/.ssh/id_dsa-cert type -1
debug1: identity file /Users/Maximilian/.ssh/id_ecdsa type -1
debug1: identity file /Users/Maximilian/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/Maximilian/.ssh/id_ed25519 type -1
debug1: identity file /Users/Maximilian/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/Maximilian/.ssh/id_xmss type -1
debug1: identity file /Users/Maximilian/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to greatlakes.arc-ts.umich.edu:22 as 'mhessel'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Dae1G3gu0mtro2Rm15U6l8aQg4bGFnDQJhmGH3k+fKs
debug1: Host 'greatlakes.arc-ts.umich.edu' is known and matches the ECDSA host key.
debug1: Found key in /Users/Maximilian/.ssh/known_hosts:8
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/Maximilian/.ssh/id_rsa 
debug1: Will attempt key: /Users/Maximilian/.ssh/id_dsa 
debug1: Will attempt key: /Users/Maximilian/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/Maximilian/.ssh/id_ed25519 
debug1: Will attempt key: /Users/Maximilian/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
  debug1: SSH2_MSG_SERVICE_ACCEPT received
************************************************************************
  * By your use of these resources, you agree to abide by Proper Use of  *
  * Information Resources, Information Technology, and Networks at the   *
  * University of Michigan (SPG 601.07), in addition to all relevant     *
  * state and federal laws. http://spg.umich.edu/policy/601.07           *
  ************************************************************************
  
  debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/Maximilian/.ssh/id_rsa
debug1: Trying private key: /Users/Maximilian/.ssh/id_dsa
debug1: Trying private key: /Users/Maximilian/.ssh/id_ecdsa
debug1: Trying private key: /Users/Maximilian/.ssh/id_ed25519
debug1: Trying private key: /Users/Maximilian/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured

However, a password prompt is never showing up

@mschubert
Copy link
Owner

Do you have a /dev/tty on both your computer and the SSH login node?

@mhesselbarth
Copy link
Author

I just checked and yes. It also tried to find some help with that error using google, but can't really figure out what the problem might be

@mhesselbarth
Copy link
Author

mhesselbarth commented Oct 30, 2020

Okay...So it does work when R is started directly in the Terminal, but not if RStudio/R.app is used.

@mhesselbarth
Copy link
Author

mhesselbarth commented Nov 3, 2020

Just out of curiosity, I also tried if I can access the HPC directly from RStudio using the ssh package, which worked. A password prompt window showed up and I was able to connect. So in general, I am able to establish a connection from my machine.

@mschubert mschubert changed the title Using clustermq without SSH key pair RStudio may not show SSH password prompt on macOS Nov 16, 2020
@mschubert
Copy link
Owner

Possibly related: #280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants