FinalCommander

服务器与存储桶

本页是仓库里的文档,内容为英文。

Servers

s3://
s3://

Alt+F1 and Alt+F2 list the stored connections beside the drives. n types a URL:

sftp://me@host/srv/www
ftp://me@host/pub
ftps://me@host/pub        the same server with TLS
webdavs://me@host/remote.php/dav/files/me/
webdav://me@host:8080/share

A connected panel is an ordinary panel: the keys are the same, a copy to or from it is an ordinary job with an ordinary progress bar, and F4 edits a remote file by bringing it here and writing it back on save. The port follows the protocol when the URL does not say — 22 for SFTP, 21 for both spellings of FTP — and one server offering ftp and ftps on port 21 is two connections, not one.

Enter on a stored session — in the NetBox panel or in the Connections list — keeps the list on the screen with a box saying what is being opened, and the panel goes to the server only once the connection is there. If it fails, the box says why and any key leaves you on the list, on the same row: you are never left on a panel that only looks connected. Esc stops waiting. A session you store from the NetBox panel puts you back on the panel, on its row, and on an empty list Enter (or Shift+F4) makes the first one.

A password typed for a server is kept, once the connection has worked, in fcmd-secrets.vault — fcmd's own encrypted file beside the settings — and the next connection takes it from there; the first time, you choose the file's password (empty: not kept). That password is asked for when a secret is first needed, stays in memory while you work and is forgotten after five minutes without a key. A stored password the server refuses is asked for again rather than tried twice.

A stored session can cap how fast a copy to or from it goes: Speed limit in its dialog (max_kbps in the [[site]] block), in kilobytes a second, so a big upload leaves the rest of the line usable. A copy between two capped servers goes at the slower of the two.

What FTP cannot do, and says so

SFTP is a filesystem; FTP is a file transfer protocol, and the difference shows:

A transfer opens a connection of its own and logs in again, which is what graphical FTP clients do and what keeps a listing from waiting behind a download. A password is therefore kept in memory while the connection is open — and in the encrypted secrets file once it has worked, never anywhere in clear — and a user called anonymous or ftp is not asked for one at all.

FTPS is explicit TLS: the connection starts in the clear and is secured with AUTH TLS before the password is sent, and the data connections are protected too. The certificate is checked against this machine's own authorities, which is what makes a server behind a company CA work without anything being turned off. Implicit FTPS on port 990 is deprecated and is not here.

WebDAV

webdav:// is HTTP and webdavs:// is HTTPS — the ports are 80 and 443 when the URL does not say — and the path is the one the server publishes, which on Nextcloud and ownCloud is /remote.php/dav/files/<user>/ and on an Apache mod_dav is whatever the Alias says.

A listing is one request, a file is a GET, writing one is a PUT of the whole file, a directory is a MKCOL, and deleting a directory takes its tree in a single request. What that costs:

What is not there yet: digest authentication (basic is what every server in practice accepts over TLS), locking, and the quota properties.

A host key the program has never seen stops and shows it before anything is sent, and records it only if you say so. A password is asked for when it is needed, never echoed and never written in clear: once it has worked, it goes into the encrypted secrets file.

A host key that is recorded and different is refused, and nothing here will accept it: a server somebody rebuilt and somebody sitting in the middle look exactly alike from this end. The dialog says which known_hosts file and which line the old key is written on, and its other button opens that file in the editor on that line — Cancel is the one under the cursor. Taking the line out is yours to do, with your eyes on it, which is what ssh makes you do for the same reason.

F7 in the connection manager stores a session, F4 edits one, and d disconnects. What is stored is the host, the user and the path — not the password.

Tunnels

F9 → Commands → Open a tunnel… (or net.tunnel from the command palette) forwards a port over the connection the panel is on — the same thing as ssh -L, without a second ssh and without a second authentication:

8080:db.internal:5432     this machine's 8080 reaches db.internal:5432 from the server
db.internal:5432          the same port on both sides
5432                      the server's own 5432

Anything that connects to the local port is carried over the session and comes out at the far end as if it had been opened there — a database client, a browser, or this program's own s3:// panel pointed at a MinIO nobody outside the server room can reach.

The local port is bound on 127.0.0.1, not on every interface: a tunnel is the server's network handed to this machine, and binding it everywhere would hand it to the rest of the office. Tunnels… in the same menu lists what is open with three counters — connections carried, open now, refused by the far end — and Enter on a row closes it, which frees the port at once.

Another FinalCommander on the network (Link)

A folder of another computer on the same local network, in a panel, with nothing to install but FinalCommander on both — and nothing reachable until the person at the other machine says yes.

On the machine that shares: put a panel on the folder and choose F9 → Commands → Link: accept calls on/off. The status line says the machine's ID — nine digits, 123 456 789 — and the corner shows LINK for as long as calls are accepted. The folder is offered read only. To share at every start instead, set link.accept = true and the folder in link.share.

On the machine that calls: in the netbox (Alt+N), Ins for a new session, protocol Link, the other machine's ID as the host, and the user left empty (or the name of the folder). Opening it finds the machine by a broadcast on the local network and calls it; the status line shows a six-digit code.

On another network — a second router, a Wi-Fi kept apart from the wired network — the search does not reach, because no broadcast crosses from one network to another. Put the other machine's IP address as the host instead of its ID: its status line shows it beside the ID when the Link is on (568 765 292 · 192.168.1.10). The call then goes straight to TCP port 47831, which is the one its firewall has to let in.

The call: the machine called shows who is calling, the folder asked for and the same six digits. Compare them — on the phone, or across the room — and accept only if they match: a different code means somebody in the middle. The lit button is Cancel, so an Enter typed by chance refuses. Once accepted, the caller's panel lists the folder; viewing, copying out, finding and comparing work as on any server.

While someone is reading, the corner says LINK 1; Ctrl+Alt+L on the panels hangs up every caller at once, and turning the Link off does too. Everything is encrypted (TLS 1.3), only private addresses are accepted, and a machine whose key changes is refused the next time with the name of the file to edit — link-known, beside the settings — if it was reinstalled.

Who is connected. The corner of the status line keeps LINK (ID · address) while the Link is on, with the number of callers (LINK 2 (…)), and the word blinks while something goes over it. Commands → Link: connections, or a click on that corner, opens the Link window: who is reading this machine, from which address and since when. F8 hangs up the one under the cursor, Ctrl+Alt+L all of them. Several machines can be connected at the same time.

A PIN, for your own machines. fcmd --link-pin on the machine that shares sets a PIN (at least six characters; an empty one removes it). A caller that knows it is let in without the question: in its netbox session choose ask as the authentication, and give the PIN when the password is asked for. The PIN is never sent — both sides prove they know it without saying it — and five wrong ones lock the caller out for ten minutes.

A machine nobody sits at — a router with a USB stick, a home server — shares a folder with fcmd --link-serve /mnt/usb, with no screen at all and until it is stopped. With nobody to answer, only callers with the PIN get in, so set one first. It prints the machine's ID and then a line for each call. link.port fixes the TCP port when a firewall must be opened (and UDP 47831, for being found). packaging/openwrt/fcmd-link runs it as an OpenWrt service, and packaging/systemd/fcmd-link.service as a systemd one.

Through a jump host

A server that cannot be reached from here, but can be reached from one machine that can, is a field in the session editor rather than a problem: Alt+N, F4 on the session, the SFTP page, Jump host.

bastion.example.net               the session's own user, port 22
gate@bastion.example.net          a different account on the way in
gate@bastion.example.net:2222     and a different port
[2001:db8::1]:2222                an address, in brackets as everywhere else

It is ssh -J, and it works the way ssh does it: a session on the bastion first, then a channel from the bastion to the destination, then the destination's own SSH session inside that channel. The bastion carries bytes it cannot read — the destination's key exchange, authentication and files are all end-to-end — and it never sees a key of yours, which is what makes this safer than forwarding the agent to it.

Each machine's host key is checked under its own name, so the first connection may ask twice: once for the bastion, once for the server behind it. Saying yes to one is not saying yes to the other, which is the point.

The bastion is authenticated with the agent, or with the same key file the session uses. A password typed for one machine is never sent to another, so a session set to ask for a password reaches its jump host with the agent, and says so when there is no agent to use. Only SFTP has a jump host: FTP and WebDAV have nothing to build a tunnel out of, and the page the field is on is grey for them.

One hop, not a chain: ssh -J a,b,c is a list, this is one host.

A server with SSH but no SFTP

Routers, NAS boxes and small boards often run an SSH server with no SFTP behind it. An sftp:// (or scp://) session to one still opens: when the server refuses SFTP, the panel works through its shell instead — ls to list, cat to read and write, mkdir, mv, rm, chmod for the rest — and everything is the same keys as before, only slower on a big folder.

Mail on a server (IMAP)

imap://me@host/ (port 143) and imaps://me@host/ (port 993, TLS — what mail providers offer) open a mailbox server as a panel, read only. The folders are the mailboxes; inside one, each message is a file named after its number and its subject, 41 Meeting moved.eml, with its size and the time it arrived. F3 reads one, F5 copies it here, and Enter on the copy opens it as the mail container does — headers, text and attachments. Reading a message does not mark it as read, and nothing on the server is ever changed: no message is deleted, moved or flagged. The password is asked for when you connect, as for FTP.

Buckets

An object storage service — S3 itself, or MinIO, Ceph, R2, Wasabi, anything that speaks the same protocol — is a panel too, once fcmd.toml has an [[s3]] block saying where it is:

s3://logs/2024/08/
s3://work@logs/2024/08/     the service named `work`
s3://work@/                 the buckets that service can see

A bucket has no directories in it. 2024/08/13/access.log is one key with slashes in it, and what the panel shows as a folder is every key that starts the same way up to the next slash — which the service works out, not this program. That is why a prefix opens as fast in a bucket with ten million objects as in one with ten.

Asking for everything under a prefix, however deep, is a different matter: that really is a listing of the whole bucket, a thousand requests for a million keys, and it stops at listing_cap rows. When it stops, the footer says (partial) for as long as that listing is on screen, because a count that is not the whole count should not look like one.

The keys are never kept in fcmd.toml. They come from AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or from ~/.aws/credentials — the file the AWS tools share, profiles and all. A bucket that anyone may read needs credentials = "anonymous" and no keys at all.

Which profile. credentials = "aws:work" in the block names one, and Commands → AWS profile of an object store (net.s3.profile) chooses one from a list instead: with the panel in a bucket of the service, or the cursor on its s3://name@ row in the sessions panel, it shows Environment — the AWS_* variables, else the default profile — then every profile found in ~/.aws/credentials and ~/.aws/config with its region beside it, then Anonymous. Enter signs the service's requests with that profile from then on, and re-reads a panel that is in one of its buckets. The choice is for the session; Options → Save setup keeps it.

The region is the block's own region when it has one; otherwise AWS_REGION, then the region the profile has in ~/.aws/config, then us-east-1. AWS_SHARED_CREDENTIALS_FILE and AWS_CONFIG_FILE are honoured when the two files live somewhere else. A profile marked no keys signs in a way of its own — single sign-on, a role — which only the AWS tools speak: aws configure export-credentials --format env turns it into variables this program reads.

F3 on an object brings it down to a temporary copy and shows you that, the way it does for a file on a server, and net.fetch_limit_mb is the ceiling on what it will fetch. F4 edits that copy and saving sends it back as one write.

F5, F6, F7 and F8 work on a bucket as they do anywhere else, with the same dialog, the same progress bar, the same overwrite question and the same Esc. A copy into a bucket is an upload streamed off the disk; a copy out of one is a download written straight to the file; a copy from one key to another inside the same service is done by the service, so the bytes never come through here, which is what makes copying a large object affordable.

A link to hand to somebody. Ctrl+Alt+O on an object — Commands → Shared link to an object — asks how long, 1 hour, 24 hours or 7 days, and puts on the clipboard a URL that reads that object with no keys and no account, in a browser or with curl, until the time is up. Seven days is the longest the service allows. The link is signed on this machine with the service's own key, and nothing is sent anywhere to make it. That is also what it is worth knowing before sending one:

A service without keys cannot sign one, and a folder has none: a link is to one object.

A few things are the nature of object storage rather than gaps:

Sessions from FAR, WinSCP or NetBox

Export the sessions from the other program — regedit → Export on FAR's Software\Far\Plugins\FTP\Hosts key, or on WinSCP's Software\Martin Prikryl\WinSCP 2\Sessions (NetBox keeps its sessions in the same shape, under FAR's plugin key), or WinSCP's own WinSCP.ini — put the cursor on the file in a local panel, and choose Commands → Import sessions…. The sessions join the stored ones; one already there is left alone, and the list opens on what was added.

FAR folders and LABEL: prefixes become groups. A password FAR saved is kept in the secrets file if that file is open, and only there; otherwise, and for WinSCP, the password is asked for the first time the session is opened.

A session's address

Ctrl+Ins on a stored session in the NetBox list copies its address — sftp://user@host:22/folder — to the clipboard, for a terminal, a script or a colleague: NetBox's Generate URL. The password is never in it. Ctrl+L with that address connects to it again.