{"id":687,"date":"2014-12-19T11:44:02","date_gmt":"2014-12-19T18:44:02","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=687"},"modified":"2014-12-19T11:44:02","modified_gmt":"2014-12-19T18:44:02","slug":"example-syntax-for-secure-copy-scp","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2014\/12\/19\/example-syntax-for-secure-copy-scp\/","title":{"rendered":"Example syntax for Secure Copy (scp)"},"content":{"rendered":"<h3>What is Secure Copy?<\/h3>\n<p><b>scp<\/b> allows files to be copied to, from, or between different hosts. It uses <b>ssh<\/b> for data transfer and provides the same authentication and same level of security as <b>ssh<\/b>.<\/p>\n<h3>Examples<\/h3>\n<h4>Copy the file &#8220;foobar.txt&#8221; from a remote host to the local host<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp your_username@remotehost.edu:foobar.txt \/some\/local\/directory<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copy the file &#8220;foobar.txt&#8221; from the local host to a remote host<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp foobar.txt your_username@remotehost.edu:\/some\/remote\/directory<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copy the directory &#8220;foo&#8221; from the local host to a remote host&#8217;s directory &#8220;bar&#8221;<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp -r foo your_username@remotehost.edu:\/some\/remote\/directory\/bar<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copy the file &#8220;foobar.txt&#8221; from remote host &#8220;rh1.edu&#8221; to remote host &#8220;rh2.edu&#8221;<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp your_username@rh1.edu:\/some\/remote\/directory\/foobar.txt \\<br \/>\nyour_username@rh2.edu:\/some\/remote\/directory\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copying the files &#8220;foo.txt&#8221; and &#8220;bar.txt&#8221; from the local host to your home directory on the remote host<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp foo.txt bar.txt your_username@remotehost.edu:~<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copy the file &#8220;foobar.txt&#8221; from the local host to a remote host using port 2264<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp -P 2264 foobar.txt your_username@remotehost.edu:\/some\/remote\/directory<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Copy multiple files from the remote host to your current directory on the local host<\/h4>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp your_username@remotehost.edu:\/some\/remote\/directory\/\\{a,b,c\\} .<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp your_username@remotehost.edu:~\/\\{foo.txt,bar.txt\\} .<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>scp<\/b> Performance<\/h3>\n<p>By default <b>scp<\/b> uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option <i>-c blowfish<\/i> in the command line.<\/p>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp -c blowfish some_file your_username@remotehost.edu:~<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>It is often suggested that the <i>-C<\/i> option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:<\/p>\n<table class=\"examples\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>$ scp -c blowfish -C local_file your_username@remotehost.edu:~<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>What is Secure Copy? scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-ssh"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=687"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/687\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}