Let’s start learning Secure FTP, SFTP

We are very much familiar with FTP server and its client for uploading and downloading files from server. But most of us don’t know about SFTP.  SFTP is basically SSH File Transfer Protocol and also known as Secret File Transfer Protocol or secure FTP. It uses Secure Shell protocol (SSH) to transfer,  access and manage files. It encrypts both command and data so that data to be transmitted over net is secure. Name of this protocol is similar to FTP, but it can not work with FTP server and FTP client also can not work with SFTP server.

It has some nice graphical clients. We can use WinSCP for windows and Cyberduck for MAC. But command line is widely used for SFTP. From Unix, Linux and Mac OS X , we can use it at CLI (Command-line Interface). To use SFTP at CLI, we will have to start SFTP session. Open the terminal and type.

sftp username@hostaddress 

For example, if your want to connect your host: eftakhairul.com with username root. Then your command will be

sftp [email protected]

It will prompt for your password. Enter your password and SFTP session will start.  There are some standard commands for SFTP. Just take a look.

On remote Computer

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
ls -  List the files of  directory on the remote computer
pwd - Show path on the remote computer
ln (or symlink) Create a symbolic link for a file on the remote computer
mkdir -  Create a new 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
put - upload a file from  the local computer to the remote computer
Local computer from remote computer lcd  - Change the directory on the local computer lls  - List of the files of directory on the local computer lmkdir -  Create a directory on the local computer lpwd - Show the path on the local computer lumask - Change the local umask value. quit - Close the connection to the remote computer and close the sftp session.

Related Link: http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol

 

Eftakhairul Islam

Hi, I'm Eftakhairul Islam, a passionate Software Engineer, Hacker and Open Source Enthusiast. I enjoy writing about technical things, work in a couple of startup as a technical advisor and in my spare time, I contribute a lot of open source projects.

 

5 thoughts on “Let’s start learning Secure FTP, SFTP

  1. Indeed a very nice article. However, it will be better if you can describe a bit more what is the benefit of using SFTP and how anyone can use it. Most importantly what are things that needed to ensure to work with SFTP.

    1. Thanks Mr. Zaman for your nice question. If you don’t have FTP server installed in your host, but you have the ssh server installed. Then you can go for sftp for uploading and downloading files.

  2. Nice article 🙂

    SFTP should not really be referred to as Secure FTP, but as the SSH File Transfer Protocol as you mentioned first.

    FTP over SSH (not SFTP and not FTPS) is commonly referred to as Secure FTP.

Leave a Reply to eftakhairul Cancel reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Read previous post:
Random Password Generator: Generate random password by a open source PHP class

Last weekend,  I passed very boring time in my home. Didn't have that much work load. I am thinking to...

Close