SSH, files and SFTP

A terminal in your app or database with npx @cubli/cli ssh, copying files with cubli files, and SFTP if you switch it on.

For developers: a terminal in your running app, as you are used to on a server. Use it to run bin/magento, wp or php artisan, for example, or to look in your database. You copy files with the same CLI, and if you prefer a program like FileZilla, you can switch on SFTP.

What you need

  • You are an owner or admin of the workspace, with two-factor authentication on. Members with another role cannot open a terminal.
  • The Cubli CLI with Node.js 22 or newer. See CLI commands for logging in and linking a folder.

How cubli ssh works

No SSH port is open and you need no SSH key. With your login, the CLI asks Cubli for one-time access, and the terminal then runs through Cubli to your running app.

From a folder linked to your app (cubli link):

npx @cubli/cli ssh

For another app: npx @cubli/cli ssh --service <the app's id>. If you installed the CLI, it is cubli ssh or cubli ssh --service <id>. Leave with exit.

In the dashboard you find it in your app under Settings, Terminal (SSH). It shows the command with the right id to copy, and who opened a terminal.

In your database or Redis

npx @cubli/cli db shell

This opens the database’s own client (mariadb or psql) as your app’s user, never as an administrator. If your app has more than one database, name one: --database <id>. For Redis, valkey-cli opens. The command with the right id is with the database under Terminal.

For Postgres, psql starts in its own temporary environment next to your database. That takes a few seconds. The environment is gone as soon as you exit, and so is anything you write there as a file with \o or \copy. Up to 5 of these terminals can be open at once per environment.

Copying files

You need no SFTP for this: the files go packed through Cubli.

Fetching to your computer:

npx @cubli/cli files pull

This fetches your app’s kept files to the folder you are in (wp-content for WordPress, the media for Magento). Name another folder in the app, and another place on your computer with --to:

npx @cubli/cli files pull /var/www/html/wp-content/themes --to ./themes

Putting files in your app:

npx @cubli/cli files push ./wp-content

This puts the files from a folder on your computer in your app’s kept folder. Name another folder in the app as the second argument. Files with the same name are replaced, others stay. Cubli asks first (--yes skips the question), and the files get your app’s user. An upload is at most 2 GB.

For an app other than the linked one, add --service <id> to either command.

What not to do on a running site

You are working in your live site: your visitors notice what you do right away.

  • No lasting changes outside the kept files. Anything outside the kept folder (wp-content for WordPress, the media for a webshop) is gone at the next deploy. What has to stay goes in your code.
  • Don’t change WordPress itself. WordPress’s files outside wp-content come from the image again at every start, so a change there does not last.
  • A database is live at once. What you change with db shell applies to your site straight away, and there is no button to undo one query. In doubt, try it on staging first. If it went wrong anyway, put an earlier moment back through Backups and restoring.
  • Don’t replace everything in one go. files push overwrites files with the same name. Rather put up only the folder you really change, such as one theme or one plugin.

Downloading a full copy

A dump of your database, or all of your app’s kept files as one download, you make in the dashboard, not with the CLI or an AI tool:

  • with the database: Download the database;
  • in your app under Settings, Backups: Download the files. For WordPress and for a Magento or Shopware webshop, choose Download a backup: files and database from the same moment.

The link works for 15 minutes. After 24 hours the download is gone.

SFTP, for programs like FileZilla

cubli files is the default and needs no SFTP. If you prefer an SFTP program, the owner can switch SFTP on per app. It is off by default. You find it with apps that have kept files, such as WordPress.

Switching it on:

  1. Open your app, go to Settings, Terminal (SSH), SFTP, and click Change.
  2. Click Switch on for 7 days. After 7 days SFTP switches itself off. Still need it? Click Another 7 days. Done with the job? Click Switch off right away.
  3. Add a public key per person, with a name: the line from the .pub file, for example ssh-ed25519 AAAA…. Never a private key.

Connecting:

sftp -P 4422 <the app's id>@api.cubli.io

The right command is with SFTP in the settings. The first time, your program asks whether you trust the server. Cubli’s fingerprint is SHA256:xGBpv/+CITyp36B9KuTH5lENIArJgV/UK3/jFmQk/1Y (ED25519).

Good to know:

  • Only the owner can switch it on and add keys, in the dashboard.
  • Logging in only works with a key (ed25519, ECDSA or RSA of at least 3072 bits), never with a password. An app can have 10 keys. Removing a key or switching SFTP off closes open connections at once.
  • You only reach your app’s kept files (wp-content for WordPress), as your app’s user. A shell or running commands is not possible over SFTP; that is what cubli ssh is for.
  • Every login is listed with the app’s sessions, with the name of the key.
  • If the project moves to another workspace, the keys are removed and SFTP is off again.

Note: anyone with one of these keys can change and delete all of your site’s files, without two-factor authentication. Give each person their own key and never share a private key.

Good to know

  • A terminal or SFTP login closes after 30 minutes without activity, and always after 4 hours. Run the command again to carry on.
  • With the app and the database you see who opened a terminal, or fetched or put files, and when. Cubli does not keep what is typed.
  • AI tools that work with Cubli through the MCP connection cannot open a terminal.
Was this helpful?

Stuck? Click Help in your dashboard, or mail info@cubli.io.