The things I cover here would be a principle that applies to setting up SSH with public key encryption to any remote server/system. I don’t use the DMS to copy over the needed public key, rather interface directly with the NAS over SSH to do that.
The unique encryption keys are generated on the client system (your workstation). Something like this command, but when asked, leave the passphrase empty so you can connect to your NAS without needing to enter a password to use these keys:
ssh-keygen -t ed25519 -C “nomad@nomadsPC” -f ~/.ssh/nomadsnas_ed25519
That will generate two files in ~/.ssh/
. The first is your private key (keep it safe!), the second (.pub) is your shareable public key:
nomadsnas_ed25519
nomadsnas_ed25519.pub
The simplest way to get the public key on the NAS is:
ssh-copy-id -p 22 -i ~/.ssh/nomadsnas_ed25519.pub nomad@nomadsnas
You’ll need to change the port (22
), key name (nomadsnas_ed25519.pub
), username (nomad
) and NAS IP (nomadsnas
) accordingly.
If for some reason that doesn’t work, there are two other methods you might try:
- A slightly more manual way is to pipe it through the standard method of ssh connection, into the target file on the NAS, again changing the details as necessary:
cat ~/.ssh/nomadsnas_ed25519.pub | ssh -p 22 nomad@nomadsnas "cat >> ~/.ssh/authorized_keys"
- Manually: Copy the contents of your public key file, then
ssh
into your NAS and paste that as a new line in the~/.ssh/authorized_keys
file on the NAS. You’ll probably need to usevi
to edit the file on the NAS, so hopefully you’re familiar with that. If you get stuck with this option, say, I can offer some other pointers.
If all has gone well, and everything is correctly configured in your PC’s ~/.ssh/config
file, you should be able to ssh
into your NAS without it any prompt for a password, and sftp
should behave the same way.
Where this sometimes fails, is a simple permissions issue within the ~/.ssh directory of NAS or PC. If these aren’t tight enough, ssh will consider the folder at risk and fail the connection. Permissions should be:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*