Setup a passwordless SSH connection using SSH keys
### REMOTE_SERVER=redantig@redantigua.com
REMOTE_SERVER="redantig@kuu.se -p 7822"
Create private/public key pair if needed:
test ! -d ~/.ssh/ && mkdir ~/.ssh/ && chmod 700 ~/.ssh/
test ! -e ~/.ssh/id_rsa && ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub | ssh ${REMOTE_SERVER} "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
Alternative: Use another SSH key type if the remote server does not accept ssh-rsa
Generate a ecdsa-sha2-nistp384
key:
ssh-keygen -t ecdsa -b 384
cat ~/.ssh/id_ecdsa.pub | ssh ${REMOTE_SERVER} "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
To access the server using SSH keys (should not ask for password)
ssh $REMOTE_SERVER
Clone
JustHost
fossil clone ssh://redantig@redantigua.com://home1/redantig/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil
A2
### fossil clone ssh://redantig@a2ss29.a2hosting.com:7822/fossil/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil
fossil clone ssh://redantig@kuu.se:7822/fossil/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil
Problem with fossil clone
when using non-standard SSH port
The SSH URL syntax when including a port number is ambigous.
This example, using SSH port 7822, works on FreeBSD, but not on MSYS2:
# WORKS ON FREEBSD, FAILS ON MSYS2
fossil clone ssh://redantig@kuu.se:7822/fossil/repos/navbar.fossil navbar.fossil
A workaround is to changed Fossil's ssh-command
and then forget about the SSH port completely:
# WORKS ON BOTH FREEBSD AND MSYS2
fossil settings --global ssh-command "ssh -p 7822"
fossil clone ssh://redantig@kuu.se/fossil/repos/navbar.fossil navbar.fossil
For plink
users on Windows
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter7.html