Pi Zero W Project: Travel Storage Device Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
User avatar
dwr
Posts: 72
Joined: Thu Feb 18, 2021 3:46 am

Re: Pi Zero W Project: Travel Storage Device

Post by dwr »

Pardon my lack of knowledge, but can you explain why you did the following steps?
WarHawk wrote: Sat Aug 14, 2021 6:25 pm Change the address from 127.0.0.1 to 0.0.0.0: filebrowser config init -> filebrowser config set -a 0.0.0.0
WarHawk wrote: Sat Aug 14, 2021 6:25 pm Export it into the home user directory in '.yaml' format: filebrowser config export -c /home/user/filebrowser.yaml
WarHawk wrote: Sat Aug 14, 2021 6:25 pm Started it: filebrowser -c /path/to/config.yaml
The Unix Installation Instruction states the following:
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
then...
filebrowser -r /path/to/your/files

Would the reason for the difference be due to the way Diet Pi OS is configured?
User avatar
WarHawk
Posts: 773
Joined: Thu Jul 20, 2017 8:55 am

Re: Pi Zero W Project: Travel Storage Device

Post by WarHawk »

I manually installed it, didn't know they had a filebrowser build

I ran it inside fubuhub /db directory

Stock it only listens on 127.0.0.1 so it will only answer the webpage ON the device...I was using my computer so I needed it to listen on all devices for the requests for the webpage

I then told it to create a config file rather than using everything stock, so I could modify the config as needed (and it would be a persistent change.

Stock config:

Code: Select all

root@DietPi:/home/warhawk# filebrowser config cat
Sign up:          false
Create User Dir:  false
Auth method:      json
Shell:

Branding:
  Name:
  Files override:
  Disable external links:  false

Server:
  Log:           stdout
  Port:          8080
  Base URL:
  Root:          .
  Socket:
  Address:       127.0.0.1
  TLS Cert:
  TLS Key:
  Exec Enabled:  false

Defaults:
  Scope:         .
  Locale:        en
  View mode:     mosaic
  Single Click:  false
  Commands:
  Sorting:
    By:
    Asc:  false
  Permissions:
    Admin:     false
    Execute:   true
    Create:    true
    Rename:    true
    Modify:    true
    Delete:    true
    Share:     true
    Download:  true

Auther configuration (raw):

{
  "recaptcha": null
}
My config...rather large

Code: Select all

root@DietPi:/home/warhawk# cat /home/bd/filebrowser.yaml
settings:
  key:
  - 110
  - 120
  - 104
  - 154
  - 38
  - 55
  - 162
  - 187
  - 126
  - 143
  - 57
  - 243
  - 210
  - 196
  - 56
  - 76
  - 59
  - 156
  - 193
  - 151
  - 0
  - 200
  - 77
  - 39
  - 184
  - 121
  - 234
  - 138
  - 216
  - 105
  - 207
  - 13
  - 184
  - 88
  - 237
  - 18
  - 43
  - 164
  - 140
  - 250
  - 138
  - 121
  - 173
  - 226
  - 11
  - 105
  - 5
  - 208
  - 215
  - 145
  - 98
  - 135
  - 89
  - 15
  - 39
  - 105
  - 232
  - 239
  - 143
  - 151
  - 105
  - 21
  - 41
  - 214
  signup: false
  createuserdir: false
  defaults:
    scope: .
    locale: en
    viewmode: mosaic
    singleclick: false
    sorting:
      by: ""
      asc: false
    perm:
      admin: false
      execute: true
      create: true
      rename: true
      modify: true
      delete: true
      share: true
      download: true
    commands: []
    hidedotfiles: false
  authmethod: json
  branding:
    name: ""
    disableexternal: false
    files: ""
    theme: ""
  commands:
    after_copy: []
    after_delete: []
    after_rename: []
    after_save: []
    after_upload: []
    before_copy: []
    before_delete: []
    before_rename: []
    before_save: []
    before_upload: []
  shell: []
  rules: []
server:
  root: .
  baseurl: ""
  socket: ""
  tlskey: ""
  tlscert: ""
  port: "8080"
  address: 0.0.0.0
  log: stdout
  enablethumbnails: false
  resizepreview: false
  enableexec: false
  typedetectionbyheader: false
auther:
  recaptcha: null
User avatar
dwr
Posts: 72
Joined: Thu Feb 18, 2021 3:46 am

Re: Pi Zero W Project: Travel Storage Device

Post by dwr »

Image

OoOoOoOoOoOhHhHh - ok, got it. Makes sense - I was following your steps and couldn't get anything to work properly, haha and now I know why. I understand now.

I am going to try the normal install steps on a fresh copy of Diet Pi OS and see how it reacts.

Stay tuned...
User avatar
dwr
Posts: 72
Joined: Thu Feb 18, 2021 3:46 am

Re: Pi Zero W Project: Travel Storage Device

Post by dwr »

WarHawk wrote: Sun Aug 15, 2021 12:11 am I manually installed it, didn't know they had a filebrowser build

I ran it inside fubuhub /db directory

Stock it only listens on 127.0.0.1 so it will only answer the webpage ON the device...I was using my computer so I needed it to listen on all devices for the requests for the webpage

I then told it to create a config file rather than using everything stock, so I could modify the config as needed (and it would be a persistent change.
Hmm, I just tried installing it on a fresh copy of Diet Pi OS and Raspberry Pi OS using the standard install instructions, but I have not been able to get it to function at all.

Code: Select all

root@DietPi~: curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
...
root@DietPi~: filebrowser -r /
But when I run the second command filebrowser -r / it tells me that there is no 'config' file found but starts the server anyway... Listening on 127.0.0.1:8080.

What I am doing wrong here?

Edit: I just noticed that the fresh copy of Diet Pi OS is running the new Debian Bullseye image - could this be a possible issue? I have the previous image available, if needed.
User avatar
dwr
Posts: 72
Joined: Thu Feb 18, 2021 3:46 am

Re: Pi Zero W Project: Travel Storage Device

Post by dwr »

Update on FileBrowser:

I was able to get it working on a fresh install of DietPi OS. I Added a USB Flash Drive prior to installing the script (formatted in Ext4), and ran dietpi-backup so I could revert back without having to reflash the SD Card. I then ran the following commands while in the USB Flash Drive's directory:

Code: Select all

root@TravelFilePi: /mnt/FileUSB# curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
root@TravelFilePi: /mnt/FileUSB# filebrowser config init
root@TravelFilePi: /mnt/FileUSB# filebrowser config set -a 0.0.0.0
root@TravelFilePi: /mnt/FileUSB# filebrowser users add <username redacted> <password redacted>
root@TravelFilePi: /mnt/FileUSB# filebrowser config export /mnt/FileUSB/filebrowser.yaml
root@TravelFilePi: /mnt/FileUSB# filebrowser -c /mnt/FileUSB/filebrowser.yaml
After running that last command, I was greeted by the server starting successfully:

Code: Select all

2021/08/15 15:03:11 Using config file: /mnt/FileUSB/filebrowser.yaml
2021/08/15 15:03:11 Listening on [::]:8080
I navigated to the Pi's IP address on my LAN followed by the port number ':8080" (http://192.168.xxx.xxx:8080) and was able to log in and upload/download files!

Now, the real question is: How do I get this script to start once the Raspberry Pi boots?
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Pi Zero W Project: Travel Storage Device

Post by Joulinar »

I guess you just need the last command to start the app again after reboot?

Code: Select all

filebrowser -c /mnt/FileUSB/filebrowser.yaml
If yes, you could create your own systemd service.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
WarHawk
Posts: 773
Joined: Thu Jul 20, 2017 8:55 am

Re: Pi Zero W Project: Travel Storage Device

Post by WarHawk »

Did some digging
https://www.dexterindustries.com/howto/ ... t-startup/

Under method 4, would the ExecStart= just be the last command
such as

Code: Select all

ExecStart=filebrowser -c /mnt/FileUSB/filebrowser.yaml
Or do you need to provide the explicit location of the filebrowser binary?

Worse comes to worse...a rc.local file I suppose...
Ah...here it is
https://github.com/filebrowser/filebrow ... -319559695
This file might be useful for running filebrowser under Ubuntu and systemd:

Code: Select all

[Unit]
Description=File browser: %I
After=network.target

[Service]
User=www-data
Group=www-data
ExecStart=/usr/local/sbin/filebrowser -c /etc/filebrowser/%I

[Install]
WantedBy=multi-user.target
Put configuration files under /etc/filebrowser directory, for example default.yaml, and execute:

Code: Select all

sudo systemctl enable filebrowser@default.yaml.service
to start filebrowser on boot as a service.
Specific tweaks for user dietpi might be needed to ensure read/write ability in directories not associated with dietpi

Also putting it in the /etc/filebrowser directory prevents non authorized users from being able to see/tweak the config, but allows the program to have a static/persistent config file it can initiate from.
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Pi Zero W Project: Travel Storage Device

Post by Joulinar »

you would need to specify the full path to filebrowser executable.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3216
Joined: Sat Nov 18, 2017 6:21 pm

Re: Pi Zero W Project: Travel Storage Device

Post by MichaIng »

I linked the discussion from the GitHub request: https://github.com/MichaIng/DietPi/issues/2560
Something for v7.6!
User avatar
WarHawk
Posts: 773
Joined: Thu Jul 20, 2017 8:55 am

Re: Pi Zero W Project: Travel Storage Device

Post by WarHawk »

There are a BUCKETLOAT of options for the config that can be set in the config.yml file

Code: Select all

root@DietPi:/home/warhawk# filebrowser config set --help
Updates the configuration. Set the flags for the options
you want to change. Other options will remain unchanged.

Usage:
  filebrowser config set [flags]

Flags:
  -a, --address string                     address to listen on (default "127.0.0.1")
      --auth.header string                 HTTP header for auth.method=proxy
      --auth.method string                 authentication type (default "json")
  -b, --baseurl string                     base url
      --branding.disableExternal           disable external links such as GitHub links
      --branding.files string              path to directory with images and custom styles
      --branding.name string               replace 'File Browser' by this name
      --cache-dir string                   file cache directory (disabled if empty)
  -t, --cert string                        tls certificate
      --commands strings                   a list of the commands a user can execute
      --disable-exec                       disables Command Runner feature
      --disable-preview-resize             disable resize of image previews
      --disable-thumbnails                 disable image thumbnails
      --disable-type-detection-by-header   disables type detection by reading file headers
  -h, --help                               help for set
      --img-processors int                 image processors count (default 4)
  -k, --key string                         tls key
      --locale string                      locale for users (default "en")
      --lockPassword                       lock password
  -l, --log string                         log output (default "stdout")
      --perm.admin                         admin perm for users
      --perm.create                        create perm for users (default true)
      --perm.delete                        delete perm for users (default true)
      --perm.download                      download perm for users (default true)
      --perm.execute                       execute perm for users (default true)
      --perm.modify                        modify perm for users (default true)
      --perm.rename                        rename perm for users (default true)
      --perm.share                         share perm for users (default true)
  -p, --port string                        port to listen on (default "8080")
      --recaptcha.host string              use another host for ReCAPTCHA. recaptcha.net might be useful in China (default "https://www.google.com")
      --recaptcha.key string               ReCaptcha site key
      --recaptcha.secret string            ReCaptcha secret
  -r, --root string                        root to prepend to relative paths (default ".")
      --scope string                       scope for users (default ".")
      --shell string                       shell command to which other commands should be appended
  -s, --signup                             allow users to signup
      --singleClick                        use single clicks only
      --socket string                      socket to listen to (cannot be used with address, port, cert nor key flags)
      --socket-perm uint32                 unix socket file permissions (default 438)
      --sorting.asc                        sorting by ascending order
      --sorting.by string                  sorting mode (name, size or modified) (default "name")
      --viewMode string                    view mode for users (default "list")

Global Flags:
  -c, --config string     config file path
  -d, --database string   database path (default "./filebrowser.db")
I guess the main thing to do is do the filebrowser config init to pre-generate a "stock" config, then exporting it to /etc/filebrowser/config.yaml, might even be a good place to put the filebrowser.db in /etc as well...but it could grow rather large I would bet

ah heck...here is the cli from the main website
https://filebrowser.org/cli
Post Reply