Home Command line utilities How To Securely Share Files From Commandline With ffsend In Linux
How To Securely Share Files From Commandline With ffsend In Linux

How To Securely Share Files From Commandline With ffsend In Linux

By sk
180 Views

Thanks to Mozilla foundation, we have a free, online file-sharing service named Firefox Send which allows us to share file easily and securely over Internet with end-to-end encryption. Even though it's very easy to share files with the Firefox Send service via web browser, there is also an unofficial command line client available for those who prefer CLI over GUI. Meet ffsend, a fully featured CLI client for Firefox Send to securely share files from command line on Linux.

Using ffsend client, you can upload/download files and directories to/from Firefox Send right from your Terminal. In addition, it is possible to inspect or delete shared files, view shared files information, view file history, archive files before uploading, change the password of a shared file and a lot more features are coming! Ffsend has built-in share URL shortener and QR code generator and currently supports Firefox Send v3 and v2. ffsend is a free and open source and is written in Rust programming language.

Install ffsend on Linux

Before installing ffsend on your Linux box, make sure you have the following prerequisites installed:

  • OpenSSL and CA certificates,
  • xclip or xsel for clipboard copying.

They are available in the default repositories of most Linux distributions. For example, you can install them on Debian, Ubuntu and other DEB-based systems using command:

$ sudo apt install openssl ca-certificates xclip xsel

After installing the necessary dependencies, download the latest ffsend version from releases page. As of writing this guide, the latest version was 0.2.58.

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

Move it to your $PATH:

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

Finally, make it executable:

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

This is the officially recommended way to install latest ffsend version.

If you're on Arch Linux, install ffsend from AUR using any AUR helpers, for example Yay.

$ yay -S ffsend-bin

There are also another methods to install ffsend. However, you might get slightly outdated version.

Using snap:

$ snap install ffsend

Using NIX package manager:

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

Fedora:

$ sudo dnf install ffsend

For other installation methods, check the official GitHub page linked at the end.

Securely share files from commandline with ffsend

When running ffsend without any arguments, you would see a basic help section.

$ 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]

Let me show you some practical examples.

Basic usage

To quickly upload files to Firefox Send service without any security, just do:

$ ffsend upload video.mp4

Sample output:

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

Securely share files from commandline with ffsend in Linux

Now you can share this URL to anyone via any medium (mail or sms). The recipient can download the shared file either from their web browser or using ffsend client.

The file can be downloaded using ffsend with command:

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

As you can see, we didn't include any security controls while uploading the file. So anyone, who has this URL, can download the data. Let us see a few advanced commands with security options.

Advanced usage

The following command will upload the given file with password-protected:

As you see, the I have set password as 123456 for file video.mp4. This is just for learning purpose. Use any strong password instead of just 123456.

Now the recipient has to enter the password while downloading the file.

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

set password while uploading files using ffsend

Similarly, you can set other security controls such as,

  • Choose when your file link should expires (i.e. after the number of downloads or days).
  • archive files while uploading.

Take a look at the following example:

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

The above command will;

  • archive the input file before uploading,
  • specify a download limit of 1,
  • specify upload expiry time of 5 minutes,
  • and set password as 123456.

When downloading, the recipients will be asked whether they want to extract the archive file or not.

$ 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...

If they choose not to extract, you will get the tar file. You can then manually extract it using any other suitable utilities.

Copy shareable links to clipboard

To copy the file links to your clipboard after uploading, run:

$ ffsend upload --copy video.mp4

Please note that you must have installed xclip or xsel to enable this feature.

Open shareable links to browser

If you want to open the shareable links to your default web browser automatically after uploading, run:

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

Check details of your remote files

To inspect your remote file's details, run:

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

Sample output would be:

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

Check whether remote files exists

To verify whether a remote file exists, run:

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

Check your upload history

This can be helpful when you wanted to know how many files you have uploaded and when they are going to expire.

$ ffsend history

Sample output:

#  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

Delete remote files

The remote files can be deleted as shown below.

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

ffsend aliases

ffsend offers aliases for all sub-commands. For example, you can use just 'u' or 'up' for 'upload' sub-command.

For example, a file can be uploaded using any one of the following commands:

$ ffsend upload video.mp4

Or,

$ ffsend u video.mp4

Or,

$ ffsend up video.mp4

Here are some aliases.

  • u or up - upload files
  • d or down - download files
  • del or rm - delete files
  • p - set password
  • e - check if remote file exists
  • i - fetch information about remote file

Getting help

To view list of available flags, options and sub-commands along with the description, refer the help section:

$ 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.

Hope this helps.

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Mat March 6, 2020 - 7:14 am

Good post, very informative. Thanks a lot!

Reply
Bruce C. March 6, 2020 - 10:32 pm

This article does not mention that installing ffsend requires 64 bit. In order to get ffsend to run on 32 bit, git clone and compile source code is required. I compiled ffsend source code on Ubuntu 18.04 32 bit and verified that ffsend does work on 32 bit.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More