Transferring Files Using SFTP and SCP
Written by jebug29
Created: 24 May 2020
Modified: 24 May 2020
SFTP (secure file transfer protocol) and SCP (secure copy protocol) are file transfer protocols intended to allow users to send and receive files over SSH. Knowing how to use them is an invaluable skill for any user who regularly connects to remote shell accounts over the internet.
Instead of being split up by operating system like the Connection Guide, this guide will be split up by GUI and commandline.
READ Notes on Quotas and Banned Content BEFORE PROCEEDING.
Methods
Notes on Quotas and Banned Content
User quotas are in place for a reason, but they don't stop users from attempting to upload files past their quota. If you are abusing Sector Disk's bandwidth by attempting to upload or download extremely large or large amounts of files, you will be given one warning before you are banned.
NSFW materials are NOT allowed on Sector Disk and neither is pirated content. If you are caught placing illegal or inappropriate content on Sector Disk, you will be banned immediately and all of your content permanently removed.
Banned users will not be refunded for any reason.
GUI Method
- You will need an SFTP or SCP Client. I am using Filezilla for this guide.
Open Filezilla and type in the following information to the top bar:
Server: sftp://sectordisk.pw
Username: [your Sector Disk username]
Password: [your password]
Port: 22
Press [ Enter ]
or the 'Connect' button and Filezilla will connect you to your HOME directory on Sector Disk (likely /home/yourusername
). From there, you should be able to drag files into/out of the file listing of your home directory.
If you would like to add these settings to Filezilla permanently, you can do so using the built-in Site Manager, accessible at File -> Site Manager
or via the keyboard shortcut ([ Ctrl-S ]
on Windows). Note that I do NOT recommend storing your Sector Disk password in Filezilla, as Filezilla DOES NOT ENCRYPT STORED PASSWORDS BY DEFAULT. There other are guides available on how to enable stored password encryption out there on the web, but I offer no guarantees. (Filezilla really isn't even the best client, but it is user-friendly and multiplatform, which is why I'm using it for this guide).
Command Line Methods
This assumes that you have OpenSSH installed. Windows users may have this installed if they're on Windows 10, but they may not. Continue with that in mind.
There are two options here: SCP and SFTP. SFTP is a bit more user-friendly of a tool and allows you to sift through directories and such, where SCP is for more advanced users who know exactly where their files are and exactly what they want to get from or put onto a server. Although technically for more advanced users, SCP is actually easier and lighter to use for small file transfers.
Both, when used correctly, should achieve the same desired effect.
SCP (Secure Copy Protocol)
To upload a file to your home directory using SCP, simply use the scp
command as follows: (Note that if your filename has spaces, you should enclose it in "quotes").
scp source_filename user@sectordisk.pw
If you want to upload a file using a different filename from the source filename, simply add a colon and the destination filename to the server.
scp source_filename user@sectordisk.pw:dest_filename
If you want to retrieve a file from the server, simply switch around your parameters so that the server is first.
scp user@sectordisk.pw:filetoget output_filename
SFTP (Secure File Transfer Protocol)
Quick SFTP Command Reference:
put Put file from local machine onto the server
get Get file from server onto the local machine
cd Change directory on the server
ls List files in directory on the server
lcd Change directory on the local machine
lls List files in directory on the local machine
quit Close the connection
Connecting to a server via SFTP is almost exactly the same as connecting to a server via SSH. Simply use the command sftp user@sectordisk.pw
and enter your password and you will be connected.
At the prompt you are able to put in various commands to allow you to browse through files and upload/download files. For example, if I want to see what files are in the directory I am in, I can use the ls
command, just like at the shell. If I want to download one of those files to my local machine, I can use the get
command. I can change directories using the cd
command.
If I want to get a list of the files on my local machine, I can run the command lls
. If I want to change directories, I can do lcd
.
If I want to place a file onto the server, I can use the put
command.
Note that if you're
put
ting orget
ting to make sure you don't overwrite files that already exist! SFTP won't warn you!
To quit sftp, simply enter the quit
command. If something goes wrong and you can't enter the quit
command, use [ Control-C ]
to force the program to close.