What is SFTP, and how do I use it?
SFTP, or secure FTP, is a program that uses SSH to transfer files. Unlike standard FTP, it encrypts both commands and data, preventing passwords and sensitive information from being transmitted in the clear over the network. It is functionally similar to FTP, but because it uses a different protocol, you can't use a standard FTP client to talk to an SFTP server, nor can you connect to an FTP server with a client that supports only SFTP.
There are two ways you can use SFTP: graphical SFTP clients and command line SFTP.
Graphical SFTP clients
Using graphical SFTP clients simplifies file transfers by allowing you
to transmit files simply by dragging and dropping icons between
windows. When you open the program, you will have to enter the name of
the host (e.g., quarry.uits.indiana.edu) and your
username and password. Two common SFTP programs are MacSFTP (for
Mac OS and Mac OS X, available from IUware
Online) and SSH Secure Shell (for Windows).
Note: SSH Secure Shell Client for Windows is no longer available for download from IUware or the SSH Communications Security web site. For alternative SSH and SFTP clients, see At IU, what SSH clients are supported and where can I get them?
Command line SFTP
You can use command line SFTP from your Unix account, or from your Mac OS X or Unix workstation. To start an SFTP session, at the command prompt, enter:
sftp username@hostFor example, to connect to your dvader account on the
host sithlord.org, you would enter:
Enter your password when prompted.
Some standard commands for command line SFTP include:
cd |
Change the directory on the remote computer |
chmod |
Change the permissions of files on the remote computer |
chown |
Change the owner of files on the remote computer |
dir (or ls) |
List the files in the current directory on the remote computer |
exit (or quit) |
Close the connection to the remote computer and exit SFTP |
get |
Copy a file from the remote computer to the local computer |
help (or ?) |
Get help on the use of SFTP commands |
lcd |
Change the directory on the local computer |
lls |
See a list of the files in the current directory on the local computer |
lmkdir |
Create a directory on the local computer |
ln (or symlink) |
Create a symbolic link for a file on the remote computer |
lpwd |
Show the current directory (present working directory) on the local computer |
lumask |
Change the local umask value |
mkdir |
Create a directory on the remote computer |
put |
Copy a file from the local computer to the remote computer |
pwd |
Show the current directory (present working directory) on the remote computer |
rename |
Rename a file on the remote host |
rm |
Delete files from the remote computer |
rmdir |
Remove a directory on the remote host (the directory usually has to be empty) |
version |
Display the SFTP version |
! |
In Unix, exit to the shell
prompt, where you can enter commands. Enter exit to get
back to SFTP. If you follow ! with a command
(e.g., !pwd), SFTP will execute the command without
dropping you to the Unix prompt.
|
Also see:
- In Unix, how do I use the scp command to securely transfer files between two computers?
- At IU, what SSH clients are supported and where can I get them?
- In SSH Secure Shell for Windows, how do I transfer files?
- In Mac OS and Mac OS X, what secure FTP clients are available?
- In Mac OS or Mac OS X, how do I use MacSFTP to transfer files?
- At IU, using FrontPage, Dreamweaver, or Netscape Composer, how do I publish my web pages on Mypage or Webserve?
Last modified on May 12, 2008.






