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:

Domain: example.com

Server host name: ser123.truehost.cloud

Server IP: 10.10.10.10

cPanel username: example

Open your CLI eg Terminal for Linux and Mac OSX or cmd for Windows

To start the ftp session, you will need to log in using an FTP host as follows:

[user@localhostname ~]$ 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 [user@localhostname ~]$ ftp 10.10.10.10

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

eg [user@localhostname ~]$ ftp ser123.truehost.cloud

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

From there, you will be asked for your FTP username as below. Enter your cPanel username

Next, you will be prompted for the password. Enter the cpanel password

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.

[user@localhostname ~]$ ftp ftp.example.com.

Connected to ftp.example.com.

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 (ftp.example.com:WM):

Password:

230 OK. Current restricted directory is /

Remote system type is UNIX.

Using binary mode to transfer files.

ftp>

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

Open terminal

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.

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.

[user@localhostname ~]$ sftp -oPort=1624 example@10.10.10.10

Connecting to 10.10.10.10…

example@10.10.10.10’s password:

sftp>

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.

ftp>binary

ftp>ascii

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 putcommand to move 1 file at a time and mputcommand to move multiple files at at time.