Skip to content

Instantly share code, notes, and snippets.

@tobocop2
Created June 18, 2017 21:47
Show Gist options
  • Save tobocop2/bfb50bd7a5cb45f98f1fb1442bf77397 to your computer and use it in GitHub Desktop.
Save tobocop2/bfb50bd7a5cb45f98f1fb1442bf77397 to your computer and use it in GitHub Desktop.
server_cp
# works best if you configure passwordless ssh by copying your ssh-key to the authorized_keys file on the remote machine
function server_cp()
{
scp $1 user@host
web_home=/path/to/web/home/
filename=`basename $1`
ssh -t user@host "chmod 777 $filename; sudo cp -f $filename $web_home"
printf "File can be found at:\nhttp://some.url/$filename\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment