how to use sftp on linux



Simply, SFTP is something like Secured FTP. With other words FTP runned over a Secure Shell (SSH). Its used with the SSH.. this way it provides security. It uses too many functions of SSH, like public key auth or compression.

But the security is not such secure as you think. Logging into FTP, changing\making directories, dir listing etc, all this is transmited through the original control channel on port 21 (default). So when you involve SSH in this mess, your commands are encrypted, that means they are safe from others. But yet, the file transfer is happening outside of SSH, over the second data channel on some other port.. so its easy to be observed by ill-wishers.

However, SFTP can have an other meaning -> SSH File Transfer Protocol.
It alows secure file transfering and manipulating. Its used with the SSH-2 Protocol to secure the file transfer. It conencts and logs into the specified host.

Let transfer now. First, you need some server (aeshells.org), and you have a username: icetrax (again), and password: ohmygod. We will transfer files to alex.

You start SFTP and you define the reciver

Quote
sftp alex@aeshells.org

The machine will add aeshells.org to trusted host/servers.

Quote
Warning: Permanently added 'aeshells.org' (RSA) to the list of known hosts.
alex@aeshells.org's password: something


It it's all correct you will get something like:


Quote
sftp>

If you want to put something there, you will need 'put' command.

Quote
sftp> put something.txt

Lets copy now. You will need the 'get' command, and the name of the file you want to copy.

Quote
sftp> get someotherthing.txt

Changing directory is like in everywhere with "cd".

Quote
sftp> cd somedir

Viewing the content of directory is again with "ls".

Quote
sftp> ls

To exit, type 'quit'.

Quote
sftp> quit

Basic Commands


cd mydir - Changes remote directory to mydir.
rmdir mydir - Removes mydir directory.
rm file - Removes file.
rename filename newfilename - Renames file to newfilename
mkdir mydir - Creates a new directory mydir
ls path, or just ls - List of content of the directory
lpwd - Shows local diretory
lmkdir dir - Creates local directory
get some-path mydirGet a file from
some-path to mydir
[li]version - Shows SFTP ver.[/li]
[li]!somecommand - Executes somecommand in the localshell[/li]
[li]ln olddir newdir[/li] Creates a symbolic link from olddir to newdir
[li]quit - Quits[/li]
[li]exit - Same like quit[/li]
[/list]

SFTP/SCP Clients and Programs


WinSCP ver.3.7.6 - Open source SFTP/SCP client for Windows.
Core FTP Lite - Windows FTP Client, supprots down/upload, browsing, SFTP, transfer bandwitch control.
FileZilla Open Source FTP/SFTP Client - Like the others. Also supports SSL Conenction, handle queues of files need to be downloaded/uploaded.
ProZilla Linux DownloadAcc - Linux downloadacc, supports downloading files via ftp/sftp/http and resuming.
Putty: Win32 SSH / Secure FTP (SFTP) Client - Free, open source set of programs, including SSH, SCP, a commandline Secure FTP client, Telnet client etc. This is my and allworld favorite