How to access your cPanel account via FTP using Command Line Interface(CLI)

FTP is a communcation protocol that can be used to move files to and from your hosting account. Other than using an FTP client such as FileZilla, you may choose to use a CLI to access your account. This is particulatly useful if you are not able to use an FTP client for some reason and your hosting package doesnt allow you ssh access. We’ll consider both FTP and SFTP. For the purpose of this example, we shall use the following details:


Server host name:

Server IP:

cPanel username: example

  1. Open your CLI eg Terminal for Linux and Mac OSX or cmd for Windows
  2. To start the ftp session, you will need to log in using an FTP host as follows:

    [[email protected] ~]$ ftp host

In this case, the host can be any of the following three values:

      • IP address of the server. To get the IP address of your hosting account, please check the email that has your cPanel credentials or contact Support

eg [[email protected] ~]$ ftp

      • Host name of the server. This can also be obtained from the email with your cPanel Credentials

eg [[email protected] ~]$ ftp

      • Use ftp URL, which in our case is Replace with your domain name.

eg [[email protected] ~]$ ftp

  1. From there, you will be asked for your FTP username as below. Enter your cPanel username
  2. Next, you will be prompted for the password. Enter the cpanel password
  3. Then if the details are correct, you will be logged into your account. You can then use ftp commands to make changes to your files.

    [[email protected] ~]$ ftp

    Connected to

    220———- Welcome to Pure-FTPd [privsep] [TLS] ———-

    220-You are user number 4 of 50 allowed.

    220-Local time is now 04:13. Server port: 21.

    220-This is a private system – No anonymous login

    220-IPv6 connections are also welcome on this server.

    220 You will be disconnected after 15 minutes of inactivity.

    500 This security scheme is not implemented

    Name (


    230 OK. Current restricted directory is /

    Remote system type is UNIX.

    Using binary mode to transfer files.


If you would wish to use SFTP instead, use the procedure below:

  1. Open terminal
  2. Use sftp command to start a secure FTP connection as follows. You will need to change the port number and specify the username. The default port is 22 but we have changed this to 1624 for security reasons.

[[email protected] ~]$ sftp -oPort=1624 [email protected]

Use the either of the following as the host

      • IP address of the server

[[email protected] ~]$ sftp -oPort=1624 [email protected]

      • The server hostname:

[[email protected] ~]$ sftp -oPort=1624 [email protected]

  1. Next, enter the password as prompted. Use your cPanel password.
  2. If the details are correct, you will be logged into your account under sftp interface, as shown below, where you can use FTP commands to manage the files.

    [[email protected] ~]$ sftp -oPort=1624 [email protected]

    Connecting to…

    [email protected]’s password:


File Transfer

You will use commands to move files between the hosting server and local machine. Before you use the commands it is important to know the ftp mode you are operating in. There are two modes: binary and ascii. To change between the modes, simply type the words ascii or binary on the ftp interface.



In ascii mode, you will be able to move text files. In binary mode,, you will be able to move all other types of files.

To download files, use the get and mget commands. The first command downloads 1 file while the second downloads multiple files that match.

ftp>get filename

To upload files to your cPanel account, use put command to move 1 file at a time and mput command to move multiple files at at time.

ftp> put filename

Was this article helpful?

Related Articles

Leave A Comment?