Establish SFTP Connection using Cyberduck

How to Establish SFTP connection to a server using Cyberduck

You can establish SFTP connection to your server using Cyberduck for uploading and downloading files in mainly two ways. One of the methods is to use a password to establish a connection and the other is to use a SSH provate key.

In many cases, you will need to use a SFTP client like Cyberduck to make changes to your website files. For example, if you are running a wordpress blog, you might need to upload a physical robots.txt or ads.txt to your root folder. With the help of Cyberduck, you can connect with your server, upload and download files and edit files.

SFTP to your server with Cyberduck using SSH private key

Open Cyberduck on your computer from programs. Search for Cyberduck and then open.

Click on file at top left and then on open new connection. You will also find an open connection button under the file button, which you can use to open a connection to your server.

It will open a form as in the image above. Select SFTP (SSH file transfer protocol) in the topmost box. For server, enter the ip of your server. Enter the username and leave the password box blank when you are using the ssh private key for connection. Next to the SSH private key, click on choose and select the .pem file that contains the ssh private key. You must have downloaded it when you created the server. (Otherwise, you can login using the password.) Once you have selected the .pem file, click on connect. When you receive a fingerprint warning, click on allow. Make sure that port 22 is selected. However, when you select SFTP, the port 22 is selected automatically.

The connection to the server will be established. Now, you can go to the root folder (generally var/www/html on Apache servers) and start editing files.

SFTP to your server with Cyberduck using id and password

Apart from using ssh private key to establish a server connection over SFTP, you can use a password to login to your server via SFTP. For example, in the previous section, you used a SSH private key file (in .pem format) for login. Now, if you have created a user and password for SFTP connection on your server, you can use these credentials to login via SFTP.

If you have not created a username and password, you can do it easily. Instead of using the root user, you can create a newuser and grant it appropriate permissions to write to folders.

To create a user, ssh to your server and then run the following command:

$ sudo adduser <username>

For example, if you want your username to be Johnny, you can run the following command:

$sudo adduser johnny

The system will prompt you to create a new password for the user and then re-enter it. Do as instructed and you have created a new user. If you want to create a password for an existng user, run the following command:

$ sudo passwd <username>

To be able to login using the new user and password, you will need to make some more changes to ssh configuration.

Run the following command:

$ sudo nano /etc/ssh/sshd_config

Open the ssh configuration file and then scroll down till you find the following and comment it out:

#PasswordAuthentication no

Add the following right above it or just uncomment it if the line already exists:

PasswordAuthentication yes

Close the file and exit and then reboot your server (instance). Now, you can use the new user and password for SFTP connections or for SSH login.

Open cyberduck and open a new connection. Select SFTP for type of connection. Make sure the selected port is 22. Enter the server ip for server and then use new the user id and password you just created to connect. Fill in the username and password boxes and then click connect.

You can save the password for connecting again. Just tick the save password box and then connect.

Later, if you need to establish the connection again, you can go to bookmark and then check history. From here, you can select the ip that you want to connect with. 

To upload a file to a folder using Cyberduck, first open the folder and then click upload button at the top. Then select the files you want to upload and hit upload. The files will be uploaded to the particular folder. To download any file using Cyberduck, first go to the folder in which the file is located. Now, right click on the file and then hit download or download to.