Loading...
 
Skip to main content

#Internal Custom backup with SCP export

Check and test

As the real user - not root

Verify the key file exists and permissions are correct

Copy to clipboard
ls -l ~/.ssh/rsyncwikiisil_rsa ~/.ssh chmod 700 ~/.ssh chmod 600 ~/.ssh/rsyncwikiisil_rsa

Verify the port is reachable (2279)

Copy to clipboard
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/happyhome.bsfez.com/2279' && echo OK || echo FAIL

Validate SSH host key (prevents interactive prompt / MITM)

From the new server, fetch the host key and store it (recommended):

Copy to clipboard
ssh-keyscan -p 2279 happyhome.bsfez.com >> ~/.ssh/known_hosts chmod 600 ~/.ssh/known_hosts

Then verify what you stored (optional but good practice):

Copy to clipboard
ssh-keygen -F happyhome.bsfez.com

This avoids the “Are you sure you want to continue connecting (yes/no)?” prompt which will break cron jobs.

Test non-interactive SSH authentication using the exact key and port

Copy to clipboard
ssh -p 2279 -i ~/.ssh/rsyncwikiisil_rsa \ -o BatchMode=yes \ -o IdentitiesOnly=yes \ happyhome@happyhome.bsfez.com 'echo "SSH OK on $(hostname)"; whoami; pwd'

Validate what exists (as the real user)

Copy to clipboard
sudo -u wikiisilorgil -H bash -lc 'echo "HOME=$HOME"; id; ls -la $HOME/.ssh || true; ls -la $HOME/.ssh/rsyncwikiisil_rsa || true'

Sample

Copy to clipboard
sudo -u wikiisilorgil -H mkdir -p /home/wikiisilorgil/.ssh nano /home/wikiisilorgil/.ssh/rsyncwikiisil_rsa sudo chown -R wikiisilorgil:wikiisilorgil /home/wikiisilorgil/.ssh sudo chmod 700 /home/wikiisilorgil/.ssh sudo chmod 600 /home/wikiisilorgil/.ssh/rsyncwikiisil_rsa