Installing ssh-copy-id on a Synology NAS
ssh-copy-id isn’t installed on DSM 7+ and is unavailable from the Synology Package Center (or the SynoCommunity Package repo).
I wanted to copy SSH keys between my DS420+ and my other servers so let’s install the tool to do that.
mkdir -p "$HOME/.local/bin" "$HOME/.ssh"chmod 700 "$HOME/.ssh"
curl -fL \ https://raw.githubusercontent.com/openssh/openssh-portable/master/contrib/ssh-copy-id \ -o "$HOME/.local/bin/ssh-copy-id" &&chmod 755 "$HOME/.local/bin/ssh-copy-id"Validate the installation and add to the PATH
"$HOME/.local/bin/ssh-copy-id" -h
# make the command available on the PATH in the current sessionexport PATH="$HOME/.local/bin:$PATH"
# [optional] persist it across new sessionsecho 'export PATH="$HOME/.local/bin:$PATH"' > ~/.profileFinally we can call it with the key we wish to copy
ssh-copy-id -i "$HOME/.ssh/id_ed25519.pub" username@destinationIf you don’t have a key yet, generate one using ssh-keygen which is installed on DSM 7+
ssh-keygen -t ed25519I also add an SSH conf entry to make it easier to connect to each server
Host desktop HostName <ip_address> User <user> IdentityFile /var/services/homes/<user>/.ssh/id_ed25519 IdentitiesOnly yesThen we can simply call ssh desktop to connect.