Transfer files to a Linux server using Workbench

Updated at:

After you connect to a Simple Application Server through Workbench, you can use the file management panel to upload local files to the server and download server files to your local host. The files that you can access depend on the login method that you use and the identity of the login user.

Applicable scope

  • The server is created and in the Running state.

  • The Remote Connection button appears in the lower-left corner of the server card (Basic-type or Agent-dedicated servers).

    Note

    Application-type servers (such as those that use the WordPress or aaPanel image, which display Log On to Server in the lower-left corner of the card) do not apply to the procedure in this topic. For more information, see the documentation of application-type servers.

  • To upload files to or download files from system directories (such as /etc, /root, or /var/www), you must first set a root password for the server by using the Set Password feature in the console.

  • Note: Simple Application Server instances running Windows do not support uploading or downloading files through the File Management feature of Workbench. To transfer files between your local Windows system and a Windows server, use a Remote Desktop connection instead. For instructions, see Use MSTSC to transfer files between a local Windows system and a Windows server.

Choose a login method

Before you upload or download files, choose a login method that suits your needs. Different login methods correspond to different login users, and each user can access a different range of files:

Login method

Login user

Accessible file range

Typical use case

Workbench Quick Connection (default)

admin (a standard user)

Directories that the admin user has permissions on, such as /home/admin and /tmp.

Quickly transfer business or project files to the user directory.

Workbench Password Logon

root (the superuser)

All directories on the server, including system directories such as /etc, /root, and /var/www.

Deploy a website, modify system configurations, manage log files, and so on.

Note

If you need to transfer files only to or from /home/admin (the home directory of the admin user) or /tmp, use Quick Connection. To transfer files to or from system directories, use Password Logon. Otherwise, you may encounter permission errors.

Upload a file

  1. In the Simple Application Server console, click Connect in the lower-left corner of the server card. In the dialog box that opens, choose a login method based on the target destination:

    • If the target is in the admin user's home directory (/home/admin) or /tmp: in the Workbench Quick Connection section, click Log on Now (log on as admin).

    • If the target is in a system directory (such as /etc, /root, or /var/www): expand Use Other Method to Log On, enter the root password in the Workbench Password Logon section, and click Log On Now (log on as root).

  2. In the left-side navigation pane of Workbench, click the File Management icon to open the file tree.

  3. In the file tree, double-click to enter the target directory, and then upload files by using either of the following methods:

    • Method 1 (recommended): Click the Upload Files button at the top of the file list, and then select the local file to upload.

    • Method 2: In the file tree, right-click the target directory, click Upload on the context menu, and then select the local file to upload.

    Note

    A single file to upload cannot exceed 1,200 MB in size.

    Only single files are supported. To upload a folder or multiple files, first compress them into a single archive, upload the archive, and then extract it on the server.

    The upload feature requires the curl tool to be installed on the server, and uses OSS provided by Workbench as temporary transit storage.

  4. On the Upload Tasks tab in the File Task Center dialog box, view the upload progress and result. A green check mark and 100% progress indicate that the upload is complete.

    Note

    After the upload is complete, you can edit, download, rename, or delete the uploaded files in the file list.

    Important

    If a file fails to upload:

    • Single failure: Click Retry (re-upload) or Delete (remove only the task record without affecting the local file) next to the task.

    • Multiple failures: Click Re-upload all failed items to re-upload all failed items at once.

    Common causes of failure:

    • Insufficient directory permissions (the error message reads "Insufficient directory permissions. Cannot upload the file."): The current login user does not have write permissions on the directory. Solution: Log on again as the root user by using Workbench Password Logon, or choose a directory that the current user has write permissions on, such as /home/admin or /tmp.

Download a file

  1. In the Simple Application Server console, click Remote Connection in the lower-left corner of the server card. In the dialog box that opens, choose a login method based on the location of the file to download:

    • If the file is in a location readable by the admin user (such as /home/admin, /tmp, or globally readable files like /etc/hosts): in the Workbench Quick Connection section, click Log on Now (log on as admin).

    • If the file is in a permission-restricted location (such as files under /root/ or /etc/shadow that only root can read): expand Use Other Method to Log On, enter the root password in the Workbench Password Logon section, and click Log On Now (log on as root).

  2. In the left-side navigation pane of Workbench, click the File Management icon to open the file tree.

  3. In the file tree, double-click to enter the directory where the file is located. In the file list on the right, click the Actions menu (⋮) at the end of the row of the target file, and then click Download.

    Note

    File management supports downloading only a single file. To download an entire folder, first use the tar command in the terminal to archive the directory (for example, tar -czf archive.tar.gz folder/), refresh the file tree, and then download the generated archive.

  4. On the Download Tasks tab in the File Task Center dialog box, view the download progress and result. A green check mark and 100% progress indicate that the download is complete. Downloaded files are saved to the default download directory of your browser. You can check your browser's download history to view and locate the downloaded files.

    Important

    If a file fails to download:

    • Single failure: Click Retry or Delete (remove only the task record) next to the task.

    • Multiple failures: Click Re-download all failed items to re-download all failed items at once.

    Common causes of failure:

    • Insufficient file permissions: If you use Workbench Quick Connection (the admin user) to download a permission-restricted file, an error message that resembles a network error may appear (for example, please check whether the network to https://oss-cn-xxx-internal.aliyuncs.com is reachable), but the actual cause is usually that the current user does not have read permissions on the file. Solution: Log on again by using Workbench Password Logon (the root user) to download the file.