In situations where you need to transfer files directly between two servers that support SSH access, Midnight Commander (MC) provides a convenient way to establish an SFTP connection without first downloading files to your local computer.
This method is particularly useful for:
- Website migrations
- Backup transfers
- Copying files between hosting accounts
- Moving large amounts of data between servers
Table of Contents
Prerequisites
Before you begin, make sure you have:
- SSH access to your mybox account
- The remote server’s hostname or IP address
- A valid username on the remote server
- The corresponding password or SSH key
Step 1: Launch Midnight Commander
After connecting to your hosting account via SSH, start Midnight Commander by running:
mc The Midnight Commander interface will open with two file panels.
Step 2: Open the Connection Menu
Choose the panel where you want the remote server to appear.
From the top menu, select:
Left or
Right depending on which panel you want to use.
Then select:
SFTP Link... or
FTP Link... For secure SSH communication, use:
SFTP Link... Step 3: Enter the Connection Details
In the connection window, enter the remote server information using the following format:
sh://username@server-address Example:
sh://[email protected] or
sh://[email protected] Press:
Enter or click:
OK to continue.
Step 4: Enter Your Password
Midnight Commander will prompt you to enter the password for the remote account.
The password prompt typically appears in the lower status bar of the application.
Enter the password and press:
Enter Step 5: Browse the Remote Server
If the credentials are correct, Midnight Commander will establish the SFTP connection and display the remote server’s directory structure in the selected panel.
You can now:
- Browse files and directories
- Create folders
- Rename files
- Delete files (if permissions allow)
Step 6: Copy Files Between Servers
To transfer files:
- Navigate to the desired file or folder.
- Highlight the item.
- Press:
F5 or select:
Copy from the bottom menu.
- Confirm the destination path.
Midnight Commander will transfer the files directly between the servers without storing them on your local computer.
Useful Keyboard Shortcuts
| Key | Function |
|---|---|
| F5 | Copy |
| F6 | Move / Rename |
| F7 | Create Directory |
| F8 | Delete |
| TAB | Switch between panels |
| F10 | Exit Midnight Commander |
Troubleshooting
Connection Failed
Verify:
- The hostname is correct.
- SSH access is enabled on the remote server.
- Port 22 is accessible.
- The username is valid.
Authentication Error
Check:
- Username spelling
- Password accuracy
- Whether the account supports SSH/SFTP access
Permission Denied
You may not have sufficient permissions to access the requested directory or file.
Contact the server administrator if necessary.
Summary
To connect to an external server via SFTP using Midnight Commander:
- Connect to your hosting account using SSH.
- Run:
mc - Open Left or Right → SFTP Link.
- Enter:
sh://username@server-address - Enter your password.
- Browse the remote server.
- Use F5 to copy files directly between servers.
This method provides a fast and convenient way to transfer files between SSH-enabled servers without using an FTP client on your local machine.