7

Linux VPS使用命令行通过Firefox Send轻松安全地共享文件

 3 years ago
source link: https://zhuanlan.zhihu.com/p/337112568
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux VPS使用命令行通过Firefox Send轻松安全地共享文件

Firefox Send可能很多人知道,一个很不错的临时文件分享系统,不过都只能通过网页端共享,使用VPS共享就有点不行了,这里就说个工具ffsend,基于官方Firefox Send,使用一个简单的命令,通过安全,专用和加密的链接,从命令行轻松安全地共享文件和目录,可以指定可选密码,最高可达2GB,共享的文件始终在客户端上加密,并且永远不会与远程主机共享密钥。其他人可以使用此工具或通过其Web浏览器下载这些文件。

功能

  • 功能齐全,友好的命令行工具
  • 安全地上传和下载文件和目录
  • 始终在客户端加密
  • 额外的密码保护,生成和可配置的下载限制
  • 文件和目录存档和提取
  • 内置共享URL缩短器和QR代码生成器
  • 支持新旧Firefox Send服务器版本
  • 跟踪文件的历史记录,便于管理
  • 能够使用自定义发送主机
  • 检查或删除共享文件
  • 准确的错误报告
  • 流加密和上传/下载,内存占用非常低
  • 即将推出:Firefox帐户集成(下载次数越多,到期时间越长)

安装

Github地址:https://github.com/timvisee/ffsend

系统要求:LinuxmacOSWindows,这里就只说Linux系统,Windows/macOS直接通过网页上传吧。

提示:编译安装和直接安装随便选一种就行,32位系统只能编译安装。

1、编译安装

安装依赖:

#Debian/Ubuntu系统
apt update
apt install build-essential cmake pkg-config libssl-dev xclip git -y

#CentOS系统
yum install gcc gcc-c++ make cmake openssl-devel xclip git -y

安装Rust和Cargo:

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

拉取最新源码并编译:

git clone https://github.com/timvisee/ffsend.git
cd ffsend
cargo install --path . -f
#查看版本
ffsend --version

2、直接安装

除了自己编译外,作者也直接提供了编译好的文件给你使用,文件下载地址:点击进去,然后再根据自己的系统架构下载对应的最新版二进制文件。目前最新版为v0.2.46。

安装依赖:

#Debian/Ubuntu系统
apt update
apt install xclip -y


#CentOS系统
yum install xclip -y

安装ffsend:

下载二进制文件
wget https://github.com/timvisee/ffsend/releases/download/v0.2.46/ffsend-v0.2.46-linux-x64-static
mv ffsend-* ffsend 
chmod a+x ffsend
mv ffsend /usr/local/bin
#查看版本
ffsend --version

使用

#使用命令
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]
    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]

1、上传

#直接上传
ffsend upload ufile.mp4

#设置密码为upass
ffsend upload ufile.mp4 --password upass

2、下载

ffsend download https://send.firefox.com/share-url

3、其它命令

#查看文件信息
ffsend info https://send.firefox.com/share-url
大致输出:
ID:         b23be28f61e720dc  
Name:       ufile.mp4  
Size:       10.70 MiB (11221278 B)  
MIME:       video/mp4  
Downloads:  0 of 1  
Expiry:     23h42m (85357s)

#查看上传历史
ffsend history

#修改上传文件密码
ffsend password https://send.firefox.com/share-url

#删除上传文件
ffsend delete https://send.firefox.com/share-url

这里只说了常用命令,更多的自行研究下,至于下载次数设置和超长保留时长的话,貌似需要登录账号才行,该功能作者以后会更新,目前都是默认1次下载和24小时有效期。


本文来自UCloud用户社区,原文链接:Linux VPS使用命令行通过Firefox Send轻松安全地共享文件-UCloud优刻得中立云计算用户问答社区


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK