SSH troubleshooting
SSH Troubleshooting
NMRhub now requires an SSH key pair to connect. Use SSH / SFTP / rsync and tools like FileZilla to connect to NMRhub virtual machines (VMs).
Where is my private key?
After following the instructions at NMRbox User Dashboard SSH Key Setup, your private key should be at:
- On Mac/Linux:
$HOME/.ssh/id_ed25519
- On Windows:
%HOMEDRIVE%%HOMEPATH%\.ssh\id_ed25519
I have the private key in place, but I can't connect.
- Try connecting to more than one VM to make sure it's not just an issue with that specific VM. (Please let us know if you can SSH to one VM but not another via support@nmrbox.org.)
- Use
ssh -vvv
to verify if SSH is attempting to use your private key.
It's trying to use the key, but it still doesn't work.
If you can't connect after uploading your SSH key, verify the following commands give the same result. Windows users should run these commands from PowerShell:
ssh-keygen -lf $HOME/.ssh/id_ed25519
ssh-keygen -lf $HOME/.ssh/id_ed25519.pub
Ensure the key listed at NMRbox User Dashboard SSH Key matches your $HOME/.ssh/id_ed25519.pub
.
Home Directory Permissions
If your home directory is writable by anyone other than you, SSH will not work. Connect via VNC and run:
ls -l ~
If w
appears after the first group of permissions (e.g., drwx
), use the following command to correct it:
chmod go-w ~
How do I use a private key with rsync
?
Add the following option to your rsync
command:
-e "ssh -i /path/to/your/private_key"
How do I use a private key with sftp
?
Add the following option to your sftp
command:
-i /path/to/your/private_key
How do I use a private key with FileZilla?
Go to FileZilla's Site Manager and make the following settings in the General tab. You can leave the port blank, as it defaults to the correct value (22).
- Protocol: SFTP - SSH File Transfer Protocol
- Host: element.nmrbox.org
- Port: Leave blank
- Logon Type: Key file
- User: username
- Key file: local path/.ssh/id_ed25519
How do I use a private key with WinSCP?
Note that NMRhub allows multiple keys to be uploaded to the dashboard. On Windows, PuTTYgen can be used to generate an additional key. The PuTTYgen window provides the public key to add to the NMRhub dashboard.
(Note: This is not an endorsement of shared accounts, but that is a site-specific decision.)
If multiple users are using a shared account (e.g., from a spectrometer console), the following steps will allow copying local data to each user's account. For this example, we assume your username is rernst
.
- Create another SSH key pair with a passphrase:
ssh-keygen -t ed25519 -C "spectrometer scp"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/rernst/.ssh/id_ed25519): id_ed25519rernst
Enter passphrase (empty for no passphrase): <type a password>
Enter same passphrase again: <retype the password>
Your identification has been saved in id_ed25519rernst
Your public key has been saved in id_ed25519rernst.pub
- Add the contents of
id_ed25519rernst.pub
to NMRbox User Dashboard SSH Key.
- Go to the home directory of the shared account. Create an
.ssh
directory if necessary and ensure it has permissionsdrwx------
:
cd $HOME
mkdir -p .ssh
chmod 700 .ssh
- Create or edit
~/.ssh/config
and add the following lines:
Match User rernst Host *.nmrbox.org
IdentityFile ~/.ssh/id_ed25519rernst
- You should now be able to copy data from the shared account to
nmrbox.org
:
scp fid rernst@*element*.nmrbox.org:
When prompted:
Enter passphrase for key 'home_directory/.ssh/id_ed25519rernst':
Enter the password you used when creating the key pair.