|
-
Upload files with ssh / scp in Linux
Throughout the day, you'll probably find yourself needing to upload files to various sites/servers. A great secure way to quickly move files around from server to server is to use the scp command. Let's say you need to copy a picture of a donut into your document root on server3.
Code:
scp /home/rob/pictures/donuts/half-eaten.jpg rob@server3:/home/mywebsite.com/public_html/images/
Now, the picture "half-eaten.jpg" is on the mywebsite.com website in the images directory.. Let's work through the command:
scp = our Linux command
/home/rob/pictures/donuts/ = the directory where half-eaten.jpg resides
half-eaten.jpg = our file
rob@server3 = our username on server3
/home/mywebsite.com/public_html/images/ = the directory on server3 where we'd like to put the image
Let's try another one - say you need to grab the logo from that site so you can add a picture of a donut to it in gimp..
Code:
scp rob@server3:/home/mywebsite.com/public_html/images/mylogo.png /home/pictures/
This will grab the logo and put it in your /home/pictures/ directory.
This is a lot more fun if you have SSH keys set up, we also recommend using screen if you're going to be uploading things that may take a while.
-
-
I don't understand how this works...are you copying files from your local pc or from another server or what?
-
-
 Originally Posted by MustangV10
I don't understand how this works...are you copying files from your local pc or from another server or what?
I think it works for anything so long as you know what's the source server and the destination server. Just curious. What does scp stand for? I would think the'cp' means 'copy', right?
-
-
 Originally Posted by MustangV10
I don't understand how this works...are you copying files from your local pc or from another server or what?
Yes, from your local linux pc (or where ever your terminal is based.. 'server a')
Picture it like command line ftp.
-
-
 Originally Posted by Victor Leigh
I think it works for anything so long as you know what's the source server and the destination server. Just curious. What does scp stand for? I would think the'cp' means 'copy', right?
Yup.. you're right 
scp stands for 'secure cp' or 'secure copy'
-
-
 Originally Posted by Rob
Yup.. you're right
scp stands for 'secure cp' or 'secure copy'
Thank you. Just curious. How does it become secure? Does it use an SSL connection like when we log into a https address?
-
-
This is using ssh to copy the files vs. using FTP or a non-encrypted protocol.
-
-
This is a lot more fun if you have SSH keys set up, we also recommend using screen if you're going to be uploading things that may take a while.
Adding SSH keys to the mix also makes it far more secure due to the fact your password won't be transmitted via plain-text. But, screen is useful I find only if you do not have a tab-capable terminal (i.e.: using putty or a GUI-less box). Its still a very powerful and useful tool, but I think people often overlook the capabilities of terminal emulators (like Konsole) these days.
Information Server Management
Linux server management, PCI consultation and affordable web hosting.
Security For Us - Where security works for you
Providing server security and PCI compliance for individuals and businesses.
-
-
Even the questions are helping me to better understand applications. You have some very smart people on this forum. Thank you to all of you assisting me.
-
-
The option -r is also worth mentoning. It copies a dir recursively.
-
Similar Threads
-
By Fred in forum Linux News
Replies: 1
Last Post: 11-19-2011, 07:36 PM
-
By Fred in forum Linux News
Replies: 0
Last Post: 11-16-2011, 10:40 PM
-
By Fred in forum Linux News
Replies: 1
Last Post: 11-06-2011, 01:18 AM
-
By Rob in forum Command Line
Replies: 1
Last Post: 11-03-2011, 08:06 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Check out Linux Central for Linux software and other goodies!
» Recent Threads
» Stats
Members: 3,546
Threads: 3,914
Posts: 9,425
Top Poster: Fred (1,486)
Welcome to our newest member, Arnaud
» Links
|
Bookmarks