On this page

USE THE TERMINAL

Copy files to and from devices

Browse a server over SFTP, upload files, download files or whole folders, copy one file with SCP, and serve files to network devices from the built-in TFTP server.

Verified against AI NetShell 0.4.20

AI NetShell moves files three ways. The SFTP browser opens a server's file system in a tab, where you browse, upload, download a file or a whole folder, rename, delete, and edit text files in place. SCP copies one file to or from a device that accepts SCP but has no SFTP service, which is common on network devices. The built-in TFTP server lets a network device pull a file from this PC, or send one to it, with the device's own copy command. None of this needs an account, and none of it is Lina's: a transfer starts only when you start it, like a command you type in the terminal.

For SFTP and SCP you need the device saved in Inventory with its credential. Both open their own SSH connection with that credential and check the device's host key the same way the terminal does, so a key you trusted in that saved device's terminal is already trusted here. A key trusted through Quick connect is not: it belongs to the address, not to the saved device. For TFTP you need a folder on this PC and a path from the device to this PC over UDP. Saving devices is covered in Add devices and credentials; the first connection and the host key check in Terminal basics.

1. Open the SFTP browser#

  1. In Inventory, right-click the server and select Open SFTP…. The action is offered on every device that opens over SSH. From the terminal of a device saved as a server you can instead right-click and select Open SFTP here, which starts in the shell's current folder when the shell reports it (many do not by default). A tab opens, labeled SFTP: WEB-01. The app opens a second SSH connection to the device with its saved credential; a terminal session to the same device is not touched.
  2. On the first connection to a device the app stops at Unknown host key, shows the device, its address, the key type and the fingerprint, and asks Trust this key and connect? Only if you recognize the device. Compare the fingerprint with the value you trust, then select Trust. If you select Cancel, the pane reads Host key not trusted yet. and offers Review host key, which connects again and asks again. The browser lists its starting folder: the folder you came from, or the folder the server starts the account in, normally its home folder.

A device that later offers a different key is refused with Host key changed; see Check an SSH host key. A device that offers only older SSH algorithms is refused with This device only offers older SSH algorithms. Open a session to it once and choose Connect anyway. Do that in the terminal; the choice is saved on the device and the browser connects next time. The app keeps one SFTP connection per device. If you open a second browser tab for the same device, both tabs work over the new connection: a folder download running in the first tab stops where it is, and closing the second tab leaves the first one disconnected until you select Reconnect. A device with no SFTP service refuses the browser; use SCP for it (section 5).

2. Browse#

The toolbar holds Up, a refresh button, the current path, Filter…, Hidden files and Upload. In a narrow pane the last three move under More. Files whose names start with a dot are hidden until you turn Hidden files on, and the filter matches any part of a name. The list has the columns Name, Owner, Size, Modified and Permissions; select Name, Size or Modified to sort by it, and again to reverse the order. Folders always come first. A link shows an arrow and where it points, and a link to a folder opens as a folder. An empty folder reads (empty directory), and a filter that hides everything reads (no matches).

Double-click a folder to open it and Up to go back. Double-click a file to open it in the editor, which is described in Terminal basics, with saving, the conflict check and the 5 MiB limit. Right-click for the other actions:

Where you right-clickActions
A fileOpen, Download…, Rename…, Delete…
A folderOpen, Download folder…, Upload here…, Rename…, Delete…
Empty spaceNew file…, New folder…, Upload…, Refresh

Each row also ends in a download button for that file or folder.

  • Rename… asks for a new name in the same folder. A name with a slash in it is refused with Invalid name. It can't contain “/” or be “.”/“..”., so a rename never moves the entry somewhere else.
  • Delete… asks first: Delete "nginx.conf" from WEB-01? followed by This cannot be undone. For a folder the question reads Delete the folder "conf.d" from WEB-01? and adds Only empty folders can be deleted. A link is deleted as a link, never what it points to.
  • New folder… creates the folder on the server at once. New file… opens a blank editor; the file is created when you save.

Every action in this list runs on the device the moment you confirm it, under the account the credential signs in with. Nothing here goes through an approval: like typing in the terminal, these are your own actions.

3. Upload and download#

Upload, and Upload… on empty space, put one file from this PC into the current folder; Upload here… on a folder puts it into that folder. The file keeps its name and replaces a remote file of the same name without asking. The app has no size limit on an upload, but it holds the whole file in memory while it sends it.

Download…, and the download button on a file's row, save one file where you choose; the save dialog proposes the file's own name. A single-file download is limited to 512 MiB. For a larger file, download its folder (up to 1 GiB per file) or use SCP (up to 2 GiB).

Download folder…, and the download button on a folder's row, copy a folder and everything under it. You pick a folder on this PC, and the remote folder's contents are written straight into it, not into a new subfolder named after it, so pick or create an empty folder first. While it runs a line counts up, for example Downloading: 120 files, 48.5 MB. When it ends the line reads, for example, Downloaded 240 files (96.1 MB) to C:\Users\you\Downloads\web-01-etc. followed by 3 skipped. when entries were skipped, each listed under it with its reason. Nothing already in the chosen folder is overwritten: a file or subfolder with the same name is skipped, and so are links, device and special files, entries whose type the server does not report or that change while the download runs, and names Windows cannot store, such as names ending in a dot or a space or containing : < > " | ? *. The download stops at 32 folder levels, 10,000 files, 4 GiB in total, or a file over 1 GiB. The files already saved are kept and the line ends with the reason, for example Stopped: The folder has too many files. Closing the tab stops a download; what was saved stays.

4. When the connection drops#

The browser learns that the connection is gone when an action fails, not before. A strip then reads Connection to WEB-01 closed. (or closed after being idle. when the last successful action was ten minutes or more ago) and This list may be out of date. Reconnect to pick up where you left off. The last listing stays on screen and you can still sort and filter it, but nothing that touches the device works until you reconnect: the refresh button does that, as does Reconnect in the strip. While it reconnects the strip reads Reconnecting to WEB-01… and Reopening the same folder.; if that folder can no longer be listed, the browser opens the starting folder instead. If the reconnect fails it reads Could not reconnect to WEB-01. with one of three reasons: It did not accept the saved sign-in. Check this device's sign-in details, then try again., It did not answer. Check that it is on and reachable, then try again., or Something went wrong. Try again in a moment., and offers Try again. Edits open in the editor are kept across a reconnect; see Terminal basics.

5. Copy one file with SCP#

SCP is for a device that accepts SCP but has no SFTP service. The app runs the device's own scp program (scp -f to download, scp -t to upload), so the device must have one.

  1. Select SCP, under Quick connect at the top of the device list. The SCP file transfer dialog opens.
  2. Choose the Device. The list holds every saved device, in name order.
  3. Under Direction, choose Download (device → this PC) or Upload (this PC → device).
  4. Enter the Remote path on the device, the full path to the file.
  5. Set the Local file. Browse… opens a save dialog for a download, proposing the remote file's name, and a file picker for an upload.
  6. Select Transfer. It stays disabled until all three are filled, and reads Transferring… while it works. The dialog reports, for example, Transferred 4096 bytes. A failure is shown in red with the reason, including the device's own message when it refused the file.

Each transfer opens a fresh SSH connection with the device's saved credential and closes it when the file is through. The whole file passes through memory, and a download is limited to 2 GiB. An upload is sent with mode 0644. SCP has no host key prompt: for a device whose key is not saved yet, the dialog reads Host key not trusted yet. and nothing is copied. Open that saved device's terminal or SFTP browser once, trust the key there, then transfer again. The older-SSH rule from section 1 applies here too.

The SCP file transfer dialog filled for a download: C9K-CORE1, a Cisco IOS XE switch, as the Device, Download (device → this PC), Remote path flash:/running-config.bak, a Local file typed in, and the Close and Transfer buttons
The SCP file transfer dialog filled for a download: C9K-CORE1, a Cisco IOS XE switch, as the Device, Download (device → this PC), Remote path flash:/running-config.bak, a Local file typed in, and the Close and Transfer buttons

6. Serve files with the built-in TFTP server#

Use the TFTP server when a network device has to pull a file from this PC, such as a software image, or send one to it, such as a copy of its configuration, with its own copy command. The server is off until you start it and runs inside the app, so quitting the app stops it.

  1. Select TFTP, under Quick connect at the top of the device list. The Built-in TFTP server dialog opens.
  2. Set the Served folder, with Browse… or by typing its path. It must exist.
  3. Check the Bind address and Port. The default, 0.0.0.0 and 69, listens on every interface, and the dialog says so: Listens on all interfaces. Any host that can reach UDP/69 can read the served folder. Bind to one interface to limit exposure. Enter the address of the interface that faces the device to listen there only.
  4. Under Allowed peers (IPv4 CIDR, comma-separated), list the device addresses or subnets that may connect, for example 10.0.0.0/24, 192.168.1.10/32. Left empty, the field warns Empty. Every host that can reach the server may pull files. With a list, every request from another address is dropped and logged. The list is IPv4 only; with a list set, a device that arrives over IPv6 is refused. An entry that is not valid IPv4 CIDR keeps Start server disabled.
  5. Leave Allow devices to write files (uploads) into the served folder off unless a device must send a file to this PC. With it on, a device can create or replace any file in the folder by name, and the dialog warns Devices can write files into the served folder. Only enable on a trusted network.
  6. Select Start server. The settings lock, and a line reads, for example, Serving C:\tftp on 0.0.0.0:69. On a device: copy running-config tftp://<your-ip>/name. Each request the server answers or refuses is added to a log under the buttons, newest first: the operation (read or write), the file name, the device's address and port, and the result, ok with the byte count, not found, timeout, send error, write failed: with the reason, rejected: illegal path or rejected: writes disabled. A request from an address outside the peer list is logged as rejected: peer not in allowlist, always as a read and without a file name.
  7. On the device, run its own copy command against this PC's address, in the form the dialog shows. The file name is relative to the served folder.
  8. When the device is done, select Stop server. It stops taking new requests; a transfer already running finishes.

Close closes the dialog and leaves the server running; open TFTP again to stop it. The log shows the requests since you opened the dialog, up to the last 100, and closing the dialog clears it. If the server cannot start, the dialog says why in red: served folder does not exist: followed by the path, or could not bind 0.0.0.0:69: followed by the system's reason and (port 69 needs admin; try an alternate port). Another program may already hold the port; pick another Port and point the device at it, for example tftp://10.0.0.5:6969/name. Windows Firewall may also have to allow the app's UDP traffic: the request arrives on the port you set, and each transfer then runs on another port the app picks.

TFTP has no sign-in. With the peer list empty, whoever can reach the port can read any file in the served folder or its subfolders by asking for it by name. A name with .. in it is refused and a leading slash is ignored, but a link or junction inside the served folder is followed to wherever it points, so keep the folder free of them. Keep the server to the one interface and the one device address it is for, and stop it when the transfer is done. Transfers run in 512-byte blocks in octet mode, so a large image takes a while; a device that stops answering ends its transfer with timeout.

Next#

Checked on AI NetShell 0.4.20