Transfer files to and from your mini with SFTP
Upload one file to your rented Mac or Ubuntu mini, download a copy and check it on your computer. Follow the same SFTP session in PowerShell or Terminal.
Before you start You’ll need the SFTP command from Workspace details and a small text file on your computer. Start with an empty practice folder so you can recognize the copy you bring back.
View full-size screenshot ↗
Start in a practice folder you can find again. This terminal creates hello.txt with a short line inside.
View full-size screenshot ↗
Use the SFTP address from Workspace details and enter your machine password. At the sftp> prompt, lpwd shows the laptop folder and pwd shows your home on the Mac.
View full-size screenshot ↗
Inside SFTP, make a practice folder on the Mac, enter it and run put hello.txt. The ls line shows the uploaded file on the remote disk.
View full-size screenshot ↗
Run get hello.txt hello-from-mini.txt to save a separate copy. After bye, read that local file to check the round trip.
View full-size screenshot ↗
In GNOME Files, press Ctrl+L and enter your SFTP address. Other file managers ask for the same host and username in a connection dialog.
These screenshots follow one file from an Ubuntu laptop to the Mac mini and back. The example hostname stands in for the address in your workspace.
Which computer gets the file?
Picture two open folders, one on your own computer and the other on the mini. SFTP copies files between them over an encrypted SSH connection. In this exercise you’ll upload hello.txt to the mini, then download a second copy with a different name. You can open both on your computer to see what made the round trip.
As you work, “local” refers to the computer in front of you and “remote” refers to the mini. A path such as ~/Downloads starts in your home folder, abbreviated ~. After the connection opens, type each command at the sftp> prompt and press Enter.
-
Start in a local folder you can find again
Make a folder called
mini-transferin Downloads on your computer. Open a text editor and save a file namedhello.txtinside it. One line of text you’ll recognize later is enough. Open PowerShell or Terminal to change to the folder where you saved it.In Windows Notepad, use File → Save As. On a Mac, TextEdit can save the file after you choose Format → Make Plain Text. Check the filename in the folder so you don’t end up looking for
hello.txtwhen the editor savedhello.txt.txt.cd ~/Downloads/mini-transferIf you chose another location, use its actual path. Quote a path that contains spaces.
See screenshots for this step
View full-size screenshot ↗
Make a file on your computer Start in a practice folder you can find again. This terminal creates hello.txt with a short line inside.
-
Open the SFTP session
Open My minis, choose the rental, then open Workspace details. Under SFTP files, copy its command into the terminal where you opened the practice folder. It already includes your account and hostname. SFTP uses the same SSH host key and machine password as a terminal login. On a first connection, check the fingerprint before accepting the key.
sftp you@animal.loginmini.comWhen you see
sftp>, try the two commands below. The extralinlpwdmeans local, so its output should end in your ownmini-transferfolder. The next line,pwd, shows where you landed on the mini.lpwd pwdSee screenshots for this step
View full-size screenshot ↗
Check the local and remote paths Use the SFTP address from Workspace details and enter your machine password. At the sftp> prompt, lpwd shows the laptop folder and pwd shows your home on the Mac.
-
Upload the file into a folder on the mini
From the mini’s home directory, make a practice folder there as well. The first two lines below make and enter the remote folder. If you’ve already used that name on the mini, pick a fresh folder name for both lines to keep your earlier practice files.
mkdir mini-transfer cd mini-transfer put hello.txt ls -l hello.txtputcopieshello.txtfrom your current local folder. The finallsline asks the mini to show you the copy. Look forhello.txtwith a size larger than zero.See screenshots for this step
View full-size screenshot ↗
Upload hello.txt Inside SFTP, make a practice folder on the Mac, enter it and run put hello.txt. The ls line shows the uploaded file on the remote disk.
-
Download a copy and check the contents
get hello.txt hello-from-mini.txt byeIn the
getcommand,hello-from-mini.txtnames the copy to save on your computer. Afterbyebrings you back to the local prompt, open that file in your practice folder. Can you see the line you wrote at the start?See screenshots for this step
View full-size screenshot ↗
Read the downloaded copy Run get hello.txt hello-from-mini.txt to save a separate copy. After bye, read that local file to check the round trip.
-
Use the same connection in a graphical client
If you prefer to drag files, choose SFTP when adding a connection in your file-transfer app. Copy the host and machine username from Workspace details. Use the port shown there, usually 22. Check the host key before entering your current machine password.
Find
mini-transferon the remote side of the window. Try dragging your test file, following the WinSCP upload example on Windows or Cyberduck’s SFTP instructions. Before your rental ends, download the project files you want to keep.See screenshots for this step
View full-size screenshot ↗
Try a file manager In GNOME Files, press Ctrl+L and enter your SFTP address. Other file managers ask for the same host and username in a connection dialog.