如何在 Linux 中使用 ffsend 从命令行安全地共享文件

谢谢 Mozilla 基金会,我们有一个免费的在线文件共享服务,名为 Firefox 发送 这使我们能够通过端到端加密在 Internet 上轻松安全地共享文件。 尽管与 Firefox 通过网络浏览器发送服务,还有一个 非官方命令行客户端 适用于那些喜欢 CLI 而不是 GUI 的人。 见面 发送,一个功能齐全的 CLI 客户端,用于 Firefox 从 Linux 上的命令行发送以安全地共享文件。

使用 ffsend 客户端,您可以上传/下载文件和目录到/从 Firefox 直接从您的终端发送。 此外,还可以检查或删除共享文件、查看共享文件信息、查看文件历史记录、上传前存档文件、更改共享文件密码等更多功能! Ffsend 内置分享 URL 缩短器和二维码生成器,目前支持 Firefox 发送 v3 和 v2。 ffsend 是一个免费的开源软件,用 编程语言。

在 Linux 上安装 ffsend

在您的 Linux 机器上安装 ffsend 之前,请确保您已安装以下先决条件:

  • OpenSSLCA 证书,
  • 剪辑 或者 xsel 用于剪贴板复制。

它们在大多数 Linux 发行版的默认存储库中都可用。 为了 example,您可以使用以下命令将它们安装在 Debian、Ubuntu 和其他基于 DEB 的系统上:

$ sudo apt install openssl ca-certificates xclip xsel

安装必要的依赖项后,从下载最新的 ffsend 版本 发布页面. 在编写本指南时,最新版本是 0.2.58。

$ wget https://github.com/timvisee/ffsend/releases/download/v0.2.58/ffsend-v0.2.58-linux-x64-static

将其移至您的 $PATH:

$ sudo mv ffsend-* /usr/local/bin/ffsend

最后,使其可执行:

$ sudo chmod +x /usr/local/bin/ffsend

这是官方推荐的安装最新 ffsend 版本的方法。

如果您在 Arch Linux 上,请从以下位置安装 ffsend AUR 使用任何 AUR 助手,对于 example .

$ yay -S ffsend-bin

还有另一种安装 ffsend 的方法。 但是,您可能会得到稍微过时的版本。

使用 折断

$ snap install ffsend

使用 NIX 包管理器

$ nix-channel --update
$ nix-env --install ffsend

Fedora:

$ sudo dnf install ffsend

其他安装方式请查看文末链接的官方 GitHub 页面。

使用 ffsend 从命令行安全地共享文件

在不带任何参数运行 ffsend 时,您会看到一个基本帮助部分。

$ ffsend 
ffsend 0.2.58
Usage: ffsend [FLAGS] <SUBCOMMAND> ...

Easily and securely share files from the command line.
A fully featured Firefox Send client.

Missing subcommand. Here are the most used:
    ffsend upload <FILE> ...
    ffsend download <URL> ...

To show all subcommands, features and other help:
    ffsend help [SUBCOMMAND]

让我给你看一些实际的例子。

基本用法

快速上传文件到 Firefox 在没有任何安全性的情况下发送服务,只需执行以下操作:

$ ffsend upload video.mp4

样本输出:

Upload complete 
https://send.firefox.com/download/c1be7dd726089352/#BHZUSp2LY-Aaamv3k0UOmw

现在,您可以通过任何媒介(邮件或短信)将此 URL 分享给任何人。 收件人可以从他们的 Web 浏览器或使用 ffsend 客户端下载共享文件。

该文件可以使用 ffsend 命令下载:

$ ffsend download https://send.firefox.com/download/c1be7dd726089352/#BHZUSp2LY-Aaamv3k0UOmw

如您所见,我们在上传文件时没有包含任何安全控制。 因此,任何拥有此 URL 的人都可以下载数据。 让我们看看一些带有安全选项的高级命令。

高级用法

以下命令将上传受密码保护的给定文件:

如您所见,我已将密码设置为 123456 对于文件 video.mp4。 这只是为了学习目的。 使用任何强密码,而不仅仅是 123456。

现在收件人在下载文件时必须输入密码。

$ ffsend download https://send.firefox.com/download/ea100bcc75145f9d/#JZMkNn4ypj7HesEnayUo7A
Password: 
Download complete

同样,您可以设置其他安全控制,例如,

  • 选择您的文件链接何时到期(即在下载次数或天数之后)。
  • 上传时存档文件。

看看以下 example:

$ ffsend upload video.mp4 --archive --downloads 1 --expiry-time 5m --password 123456

上述命令将;

  • 在上传之前存档输入文件,
  • 指定下载限制为 1,
  • 指定上传到期时间为 5 分钟,
  • 并将密码设置为 123456。

下载时,将询问收件人是否要提取存档文件。

$ ffsend download https://send.firefox.com/download/6306f2fe3cfe7e09/#E2tuLr2aZGCg3avQkFj3Ew
Password: 
You're downloading an archive, extract it into the selected directory? [Y/n]: y
Download complete Extracting...

如果他们选择不提取,您将获得 tar 文件。 然后,您可以使用任何其他合适的实用程序手动提取它。

要在上传后将文件链接复制到剪贴板,请运行:

$ ffsend upload --copy video.mp4

请注意,您必须安装 xclip 或 xsel 才能启用此功能。

如果您想在上传后自动打开默认 Web 浏览器的可共享链接,请运行:

$ ffsend upload --open video.mp4 
Upload complete https://send.firefox.com/download/dd2127439ef80320/#GdBgW8DZy9jwvqsp0dCnVA

检查远程文件的详细信息

要检查远程文件的详细信息,请运行:

$ ffsend info https://send.firefox.com/download/dd2127439ef80320/#GdBgW8DZy9jwvqsp0dCnVA

示例输出为:

ID: dd2127439ef80320 
Downloads: 0 of 1 
Expiry: 23h56m (86188s)

检查远程文件是否存在

要验证远程文件是否存在,请运行:

$ ffsend exists https://send.firefox.com/download/dd2127439ef80320/#GdBgW8DZy9jwvqsp0dCnVA

检查您的上传历史

当您想知道上传了多少文件以及它们何时到期时,这会很有帮助。

$ ffsend history

样本输出:

#  LINK                                                                        EXPIRE  
1  https://send.firefox.com/download/96a12b3d8884819d/#Vn5LRU_PgRKIAsHFoud0-g  ~23h51m  
2  https://send.firefox.com/download/ea100bcc75145f9d/#JZMkNn4ypj7HesEnayUo7A  ~23h21m  
3  https://send.firefox.com/download/75027ad5870be002/#JvfR57OHaJ1I6LHPM2tFgQ  ~23h19m  
4  https://send.firefox.com/download/c1be7dd726089352/#BHZUSp2LY-Aaamv3k0UOmw  ~22h11m

删除远程文件

可以删除远程文件,如下所示。

$ ffsend delete https://send.firefox.com/download/dd2127439ef80320/#GdBgW8DZy9jwvqsp0dCnVA

ff 发送别名

ffsend 为所有子命令提供别名。 为了 example,您可以只使用 ‘u’ 或 ‘up’ 作为 ‘upload’ 子命令。

为了 example,可以使用以下任一命令上传文件:

$ ffsend upload video.mp4

或者,

$ ffsend u video.mp4

或者,

$ ffsend up video.mp4

这里有一些别名。

  • u 或 up – 上传文件
  • d 或向下 – 下载文件
  • del 或 rm – 删除文件
  • p – 设置密码
  • e – 检查远程文件是否存在
  • i – 获取有关远程文件的信息

获得帮助

要查看可用标志、选项和子命令的列表以及说明,请参阅帮助部分:

$ ffsend --help
ffsend 0.2.58
Tim Visee <[email protected]>
Easily and securely share files from the command line.
A fully featured Firefox Send client.

USAGE:
    ffsend [FLAGS] [OPTIONS] [SUBCOMMAND]

FLAGS:
    -f, --force          
            Force the action, ignore warnings

    -h, --help           
            Prints help information

    -i, --incognito      
            Don't update local history for actions

    -I, --no-interact    
            Not interactive, do not prompt

    -q, --quiet          
            Produce output suitable for logging and automation

    -V, --version        
            Prints version information

    -v, --verbose        
            Enable verbose information and logging

    -y, --yes            
            Assume yes for prompts


OPTIONS:
    -A, --api <VERSION>                 
            Server API version to use, one of:
            2, 3: Firefox Send API versions
            auto, -: probe server to determine [env: FFSEND_API]
        --basic-auth <USER:PASSWORD>    
            HTTP basic authentication credentials [env: FFSEND_BASIC_AUTH]

    -H, --history <FILE>                
            Use the specified history file [env: FFSEND_HISTORY]

    -t, --timeout <SECONDS>             
            Request timeout (0 to disable) [env: FFSEND_TIMEOUT]

    -T, --transfer-timeout <SECONDS>    
            Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT]


SUBCOMMANDS:
    upload        Upload files [aliases: u, up]
    download      Download files [aliases: d, down]
    debug         View debug information [aliases: dbg]
    delete        Delete a shared file [aliases: del, rm]
    exists        Check whether a remote file exists [aliases: e]
    generate      Generate assets [aliases: gen]
    help          Prints this message or the help of the given subcommand(s)
    history       View file history [aliases: h]
    info          Fetch info about a shared file [aliases: i]
    parameters    Change parameters of a shared file [aliases: params]
    password      Change the password of a shared file [aliases: pass, p]
    version       Determine the Send server version [aliases: v]

The public Send service that is used as default host is provided by Mozilla.
This application is not affiliated with Mozilla, Firefox or Firefox Send.

希望这可以帮助。

资源:

感谢您的光临!

帮助我们帮助您:

祝你有美好的一天!!