Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Back up a VPS Web Host using SSH and SCP on Mac OSX 10.6

July 19, 2011 Leave a Comment

Using SSH and SCP you can copy your remote web VPS backups to your local machine in a secure manner and then by creating a back up script you can either run the script adhoc or schedule the process with a user launch agent.

The first step is to create a SSH passwordless connection between the vps webserver and the local machine, this is done by adding the public SSH key of the local computer to the ‘authorised_keys’ file of the remote VPS host.

Once this is done you can SSH into your remote VPS host without a password prompt.

Test that the connection works with no password

local:~ user$ ssh [email protected]

Last login: Mon Jul 18 12:58:53 2011 from 12.34.567.890
root@hosting [~]# exit 

Once the connectionless communication is established you can use ‘scp’ to securely copy your backup to your local machine, ‘scp’ runs in the ‘ssh’ protocol so the connection is encrypted. Find out the path from your web host where the backups are filed. In this example they are at the root level ‘/backups’.

So to copy over the archived backups the command below will recursively copy the ‘/backups’ directory on the remote host to the local users desktop directory.

local:~ user$ scp -R [email protected]:/backups ~/Desktop

The first part of this command is the ‘from’ directory and since it is the remote host, the ssh connection string is used separated by a ‘:’ then the remote path and the second part of the command is the ‘to’ directory which is our desktop folder on our local host.

Once you have tested and verified that the copy is made sucessfully , it’s worthwhile make a simple script that you can run adhoc.

Create a script using your from and to destinations and and save it as ‘backup.sh’:

#!/bin/bash
scp -R [email protected]:/backups ~/Desktop

Save it in /usr/sbin and give it the ownership and permissions of the below
-rwxr-xr-x 1 root wheel 269B Jul 14 10:15 backup.sh
Reload the shell to apply the new command:

source ~/.bash_profile

Then run the command from the command line

local:~ user$ backup.sh

One final thing to do is to schedule the script to run at a frequency – you can create a launch agent in your home library and set that to run weekly or monthly.

Cats: macOS Tags: backup, OSX, scp, script, ssh, vps

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • Trump threatens Apple with 25% tariff to force iPhone manufacturing into US
  • I helped a lost dog’s AirTag ping its owner: An ode to replaceable batteries
  • Apple legend Jony Ive takes control of OpenAI’s design future
  • Epic goes to court to force Fortnite back on US iOS
  • Google hits back after Apple exec says AI is hurting search

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

Copyright © 2025· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2025 · gee on Genesis Framework · WordPress · Log in