{"id":13437655,"url":"https://github.com/sigoden/dufs","last_synced_at":"2025-05-13T18:04:38.860Z","repository":{"id":36979677,"uuid":"496605552","full_name":"sigoden/dufs","owner":"sigoden","description":"A file server that supports static serving, uploading, searching, accessing control, webdav...","archived":false,"fork":false,"pushed_at":"2025-04-25T00:14:21.000Z","size":771,"stargazers_count":7890,"open_issues_count":4,"forks_count":405,"subscribers_count":50,"default_branch":"main","last_synced_at":"2025-05-06T17:13:27.877Z","etag":null,"topics":["cloud-disk","command-line","file-sharing","file-upload-server","rust","static-server","webdav","webdav-server"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigoden.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-26T12:09:04.000Z","updated_at":"2025-05-06T13:14:53.000Z","dependencies_parsed_at":"2023-07-14T07:12:32.017Z","dependency_job_id":"fc5f8f3b-4f47-4cbe-936e-be64e4571f87","html_url":"https://github.com/sigoden/dufs","commit_stats":{"total_commits":246,"total_committers":11,"mean_commits":"22.363636363636363","dds":0.06504065040650409,"last_synced_commit":"e43554b7952453463d894097f443b3387f5ebb9d"},"previous_names":["sigoden/duf"],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fdufs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fdufs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fdufs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fdufs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigoden","download_url":"https://codeload.github.com/sigoden/dufs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000825,"owners_count":21997441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-disk","command-line","file-sharing","file-upload-server","rust","static-server","webdav","webdav-server"],"created_at":"2024-07-31T03:00:59.034Z","updated_at":"2025-05-13T18:04:38.839Z","avatar_url":"https://github.com/sigoden.png","language":"Rust","readme":"# Dufs\n\n[![CI](https://github.com/sigoden/dufs/actions/workflows/ci.yaml/badge.svg)](https://github.com/sigoden/dufs/actions/workflows/ci.yaml)\n[![Crates](https://img.shields.io/crates/v/dufs.svg)](https://crates.io/crates/dufs)\n[![Docker Pulls](https://img.shields.io/docker/pulls/sigoden/dufs)](https://hub.docker.com/r/sigoden/dufs)\n\nDufs is a distinctive utility file server that supports static serving, uploading, searching, accessing control, webdav...\n\n![demo](https://user-images.githubusercontent.com/4012553/220513063-ff0f186b-ac54-4682-9af4-47a9781dee0d.png)\n\n## Features\n\n- Serve static files\n- Download folder as zip file\n- Upload files and folders (Drag \u0026 Drop)\n- Create/Edit/Search files\n- Resumable/partial uploads/downloads\n- Access control\n- Support https\n- Support webdav\n- Easy to use with curl\n\n## Install\n\n### With cargo\n\n```\ncargo install dufs\n```\n\n### With docker\n\n```\ndocker run -v `pwd`:/data -p 5000:5000 --rm sigoden/dufs /data -A\n```\n\n### With [Homebrew](https://brew.sh)\n\n```\nbrew install dufs\n```\n\n### Binaries on macOS, Linux, Windows\n\nDownload from [Github Releases](https://github.com/sigoden/dufs/releases), unzip and add dufs to your $PATH.\n\n## CLI\n\n```\nDufs is a distinctive utility file server - https://github.com/sigoden/dufs\n\nUsage: dufs [OPTIONS] [serve-path]\n\nArguments:\n  [serve-path]  Specific path to serve [default: .]\n\nOptions:\n  -c, --config \u003cfile\u003e        Specify configuration file\n  -b, --bind \u003caddrs\u003e         Specify bind address or unix socket\n  -p, --port \u003cport\u003e          Specify port to listen on [default: 5000]\n      --path-prefix \u003cpath\u003e   Specify a path prefix\n      --hidden \u003cvalue\u003e       Hide paths from directory listings, e.g. tmp,*.log,*.lock\n  -a, --auth \u003crules\u003e         Add auth roles, e.g. user:pass@/dir1:rw,/dir2\n  -A, --allow-all            Allow all operations\n      --allow-upload         Allow upload files/folders\n      --allow-delete         Allow delete files/folders\n      --allow-search         Allow search files/folders\n      --allow-symlink        Allow symlink to files/folders outside root directory\n      --allow-archive        Allow download folders as archive file\n      --enable-cors          Enable CORS, sets `Access-Control-Allow-Origin: *`\n      --render-index         Serve index.html when requesting a directory, returns 404 if not found index.html\n      --render-try-index     Serve index.html when requesting a directory, returns directory listing if not found index.html\n      --render-spa           Serve SPA(Single Page Application)\n      --assets \u003cpath\u003e        Set the path to the assets directory for overriding the built-in assets\n      --log-format \u003cformat\u003e  Customize http log format\n      --log-file \u003cfile\u003e      Specify the file to save logs to, other than stdout/stderr\n      --compress \u003clevel\u003e     Set zip compress level [default: low] [possible values: none, low, medium, high]\n      --completions \u003cshell\u003e  Print shell completion script for \u003cshell\u003e [possible values: bash, elvish, fish, powershell, zsh]\n      --tls-cert \u003cpath\u003e      Path to an SSL/TLS certificate to serve with HTTPS\n      --tls-key \u003cpath\u003e       Path to the SSL/TLS certificate's private key\n  -h, --help                 Print help\n  -V, --version              Print version\n```\n\n## Examples\n\nServe current working directory in read-only mode\n\n```\ndufs\n```\n\nAllow all operations like upload/delete/search/create/edit...\n\n```\ndufs -A\n```\n\nOnly allow upload operation\n\n```\ndufs --allow-upload\n```\n\nServe a specific directory\n\n```\ndufs Downloads\n```\n\nServe a single file\n\n```\ndufs linux-distro.iso\n```\n\nServe a single-page application like react/vue\n\n```\ndufs --render-spa\n```\n\nServe a static website with index.html\n\n```\ndufs --render-index\n```\n\nRequire username/password\n\n```\ndufs -a admin:123@/:rw\n```\n\nListen on specific host:ip \n\n```\ndufs -b 127.0.0.1 -p 80\n```\n\nListen on unix socket\n```\ndufs -b /tmp/dufs.socket\n```\n\nUse https\n\n```\ndufs --tls-cert my.crt --tls-key my.key\n```\n\n## API\n\nUpload a file\n\n```sh\ncurl -T path-to-file http://127.0.0.1:5000/new-path/path-to-file\n```\n\nDownload a file\n```sh\ncurl http://127.0.0.1:5000/path-to-file           # download the file\ncurl http://127.0.0.1:5000/path-to-file?hash      # retrieve the sha256 hash of the file\n```\n\nDownload a folder as zip file\n\n```sh\ncurl -o path-to-folder.zip http://127.0.0.1:5000/path-to-folder?zip\n```\n\nDelete a file/folder\n\n```sh\ncurl -X DELETE http://127.0.0.1:5000/path-to-file-or-folder\n```\n\nCreate a directory\n\n```sh\ncurl -X MKCOL http://127.0.0.1:5000/path-to-folder\n```\n\nMove the file/folder to the new path\n\n```sh\ncurl -X MOVE http://127.0.0.1:5000/path -H \"Destination: http://127.0.0.1:5000/new-path\"\n```\n\nList/search directory contents\n\n```sh\ncurl http://127.0.0.1:5000?q=Dockerfile           # search for files, similar to `find -name Dockerfile`\ncurl http://127.0.0.1:5000?simple                 # output names only, similar to `ls -1`\ncurl http://127.0.0.1:5000?json                   # output paths in json format\n```\n\nWith authorization (Both basic or digest auth works)\n\n```sh\ncurl http://127.0.0.1:5000/file --user user:pass                 # basic auth\ncurl http://127.0.0.1:5000/file --user user:pass --digest        # digest auth\n```\n\nResumable downloads\n\n```sh\ncurl -C- -o file http://127.0.0.1:5000/file\n```\n\nResumable uploads\n\n```sh\nupload_offset=$(curl -I -s http://127.0.0.1:5000/file | tr -d '\\r' | sed -n 's/content-length: //p')\ndd skip=$upload_offset if=file status=none ibs=1 | \\\n  curl -X PATCH -H \"X-Update-Range: append\" --data-binary @- http://127.0.0.1:5000/file\n```\n\nHealth checks\n\n```sh\ncurl http://127.0.0.1:5000/__dufs__/health\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch2\u003eAdvanced Topics\u003c/h2\u003e\u003c/summary\u003e\n\n### Access Control\n\nDufs supports account based access control. You can control who can do what on which path with `--auth`/`-a`.\n\n```\ndufs -a admin:admin@/:rw -a guest:guest@/\ndufs -a user:pass@/:rw,/dir1 -a @/\n```\n\n1. Use `@` to separate the account and paths. No account means anonymous user.\n2. Use `:` to separate the username and password of the account.\n3. Use `,` to separate paths.\n4. Use path suffix `:rw`/`:ro` set permissions: `read-write`/`read-only`. `:ro` can be omitted.\n\n- `-a admin:admin@/:rw`: `admin` has complete permissions for all paths.\n- `-a guest:guest@/`: `guest` has read-only permissions for all paths.\n- `-a user:pass@/:rw,/dir1`: `user` has read-write permissions for `/*`, has read-only permissions for `/dir1/*`.\n- `-a @/`: All paths is publicly accessible, everyone can view/download it.\n\n**Auth permissions are restricted by dufs global permissions.** If dufs does not enable upload permissions via `--allow-upload`, then the account will not have upload permissions even if it is granted `read-write`(`:rw`) permissions.\n\n#### Hashed Password\n\nDUFS supports the use of sha-512 hashed password.\n\nCreate hashed password:\n\n```sh\n$ openssl passwd -6 123456 # or `mkpasswd -m sha-512 123456`\n$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/\n```\n\nUse hashed password:\n\n```sh\ndufs -a 'admin:$6$tWMB51u6Kb2ui3wd$5gVHP92V9kZcMwQeKTjyTRgySsYJu471Jb1I6iHQ8iZ6s07GgCIO69KcPBRuwPE5tDq05xMAzye0NxVKuJdYs/@/:rw'\n```\n\u003e The hashed password contains `$6`, which can expand to a variable in some shells, so you have to use **single quotes** to wrap it.\n\nTwo important things for hashed passwords:\n\n1. Dufs only supports sha-512 hashed passwords, so ensure that the password string always starts with `$6$`.\n2. Digest authentication does not function properly with hashed passwords.\n\n\n### Hide Paths\n\nDufs supports hiding paths from directory listings via option `--hidden \u003cglob\u003e,...`.\n\n```\ndufs --hidden .git,.DS_Store,tmp\n```\n\n\u003e The glob used in --hidden only matches file and directory names, not paths. So `--hidden dir1/file` is invalid.\n\n```sh\ndufs --hidden '.*'                          # hidden dotfiles\ndufs --hidden '*/'                          # hidden all folders\ndufs --hidden '*.log,*.lock'                # hidden by exts\ndufs --hidden '*.log' --hidden '*.lock'\n```\n\n### Log Format\n\nDufs supports customize http log format with option `--log-format`.\n\nThe log format can use following variables.\n\n| variable     | description                                                               |\n| ------------ | ------------------------------------------------------------------------- |\n| $remote_addr | client address                                                            |\n| $remote_user | user name supplied with authentication                                    |\n| $request     | full original request line                                                |\n| $status      | response status                                                           |\n| $http_       | arbitrary request header field. examples: $http_user_agent, $http_referer |\n\n\nThe default log format is `'$remote_addr \"$request\" $status'`.\n```\n2022-08-06T06:59:31+08:00 INFO - 127.0.0.1 \"GET /\" 200\n```\n\nDisable http log\n```\ndufs --log-format=''\n```\n\nLog user-agent\n```\ndufs --log-format '$remote_addr \"$request\" $status $http_user_agent'\n```\n```\n2022-08-06T06:53:55+08:00 INFO - 127.0.0.1 \"GET /\" 200 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36\n```\n\nLog remote-user\n```\ndufs --log-format '$remote_addr $remote_user \"$request\" $status' -a /@admin:admin -a /folder1@user1:pass1\n```\n```\n2022-08-06T07:04:37+08:00 INFO - 127.0.0.1 admin \"GET /\" 200\n```\n\n## Environment variables\n\nAll options can be set using environment variables prefixed with `DUFS_`.\n\n```\n[serve-path]                DUFS_SERVE_PATH=\".\"\n    --config \u003cfile\u003e         DUFS_CONFIG=config.yaml\n-b, --bind \u003caddrs\u003e          DUFS_BIND=0.0.0.0\n-p, --port \u003cport\u003e           DUFS_PORT=5000\n    --path-prefix \u003cpath\u003e    DUFS_PATH_PREFIX=/dufs\n    --hidden \u003cvalue\u003e        DUFS_HIDDEN=tmp,*.log,*.lock\n-a, --auth \u003crules\u003e          DUFS_AUTH=\"admin:admin@/:rw|@/\" \n-A, --allow-all             DUFS_ALLOW_ALL=true\n    --allow-upload          DUFS_ALLOW_UPLOAD=true\n    --allow-delete          DUFS_ALLOW_DELETE=true\n    --allow-search          DUFS_ALLOW_SEARCH=true\n    --allow-symlink         DUFS_ALLOW_SYMLINK=true\n    --allow-archive         DUFS_ALLOW_ARCHIVE=true\n    --enable-cors           DUFS_ENABLE_CORS=true\n    --render-index          DUFS_RENDER_INDEX=true\n    --render-try-index      DUFS_RENDER_TRY_INDEX=true\n    --render-spa            DUFS_RENDER_SPA=true\n    --assets \u003cpath\u003e         DUFS_ASSETS=./assets\n    --log-format \u003cformat\u003e   DUFS_LOG_FORMAT=\"\"\n    --log-file \u003cfile\u003e       DUFS_LOG_FILE=./dufs.log\n    --compress \u003ccompress\u003e   DUFS_COMPRESS=low\n    --tls-cert \u003cpath\u003e       DUFS_TLS_CERT=cert.pem\n    --tls-key \u003cpath\u003e        DUFS_TLS_KEY=key.pem\n```\n\n## Configuration File\n\nYou can specify and use the configuration file by selecting the option `--config \u003cpath-to-config.yaml\u003e`.\n\nThe following are the configuration items:\n\n```yaml\nserve-path: '.'\nbind: 0.0.0.0\nport: 5000\npath-prefix: /dufs\nhidden:\n  - tmp\n  - '*.log'\n  - '*.lock'\nauth:\n  - admin:admin@/:rw\n  - user:pass@/src:rw,/share\n  - '@/'  # According to the YAML spec, quoting is required.\nallow-all: false\nallow-upload: true\nallow-delete: true\nallow-search: true\nallow-symlink: true\nallow-archive: true\nenable-cors: true\nrender-index: true\nrender-try-index: true\nrender-spa: true\nassets: ./assets/\nlog-format: '$remote_addr \"$request\" $status $http_user_agent'\nlog-file: ./dufs.log\ncompress: low\ntls-cert: tests/data/cert.pem\ntls-key: tests/data/key_pkcs1.pem\n```\n\n### Customize UI\n\nDufs allows users to customize the UI with your own assets.\n\n```\ndufs --assets my-assets-dir/\n```\n\n\u003e If you only need to make slight adjustments to the current UI, you copy dufs's [assets](https://github.com/sigoden/dufs/tree/main/assets) directory and modify it accordingly. The current UI doesn't use any frameworks, just plain HTML/JS/CSS. As long as you have some basic knowledge of web development, it shouldn't be difficult to modify.\n\nYour assets folder must contains a `index.html` file.\n\n`index.html` can use the following placeholder variables to retrieve internal data.\n\n- `__INDEX_DATA__`: directory listing data\n- `__ASSETS_PREFIX__`: assets url prefix\n\n\u003c/details\u003e\n\n## License\n\nCopyright (c) 2022-2024 dufs-developers.\n\ndufs is made available under the terms of either the MIT License or the Apache License 2.0, at your option.\n\nSee the LICENSE-APACHE and LICENSE-MIT files for license details.\n","funding_links":[],"categories":["Servers","Rust","HarmonyOS","rust","Apps","File Management","Linux","10、基础服务架构","文件管理系统"],"sub_categories":["Standalone","Windows Manager","FileSharing","9、效率工具集合"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigoden%2Fdufs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigoden%2Fdufs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigoden%2Fdufs/lists"}