top | item 40905719

Bashbro – Make Any Comp a Web-Based File Server

97 points| ReversedChaos | 1 year ago |github.com | reply

47 comments

order
[+] password4321|1 year ago|reply
In a slightly more heavyweight category I've settled on dufs for my single binary file serving / uploading / password-protecting needs.

https://github.com/sigoden/dufs

[+] sitkack|1 year ago|reply
Does this support starting a webdav server over an ssh tunnel to remote server? It looks like it from the readme, will attempt asap.

Ok, checked it out, dufs is a cool tool. Definitely replaces python -m http.server. This is a new standard rightalong side ripgrep.

Cargo is the package manager that pip wanted to be. We should just use cargo anyway. Why have distros when you have Cargo? Why have homebrew when you have Cargo?

Dufs support of webdav is nascent.

I kid, but only a little bit.

[+] nray|1 year ago|reply
Thanks for this, really handy
[+] herewulf|1 year ago|reply
Single Rust binary: YES.

I looked at the Bashbro source and said NOPE. And I've written a lot of increasingly complex Bash. At some point you just have to realize that you're using the wrong tool for the job. Dufs even has tests!

[+] yayr|1 year ago|reply
rare to see such a useful and popular project with NO open issues.

Congrats!

[+] sigmonsays|1 year ago|reply
go's version is this which is my favorite because a single http server serving static files is cool but it's better to program it to do what you want.

    package main

    import (
        "net/http"
        "os"
    )

    func main() {
        if err := http.ListenAndServe(os.Args[1], http.FileServer(http.Dir(os.Args[2]))); err != nil {
            panic(err)
        }
    }
[+] gouggoug|1 year ago|reply
I re-read "Make Any Comp a Web-Based File Server" 10 times and I don't understand what it means. Specifically the word "Comp".

What does this mean?

[+] i_use_arch_btw|1 year ago|reply
I think it's just what 12 year olds call a computer. A comp-u-ter.
[+] apitman|1 year ago|reply
In case you're wondering the same thing I was, it uses socat to listen on the port
[+] jdefr89|1 year ago|reply
What is wrong with "python -m http.server"?
[+] bheadmaster|1 year ago|reply
It requires Python.

Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...

[+] amelius|1 year ago|reply
It doesn't use https, and doesn't use the system's PAM authentication methods.
[+] amelius|1 year ago|reply
This is cool, but there's currently an overload of ports assigned on my system.

Is there a way to manage all these port numbers? And why can't we use strings, even if just locally?

And what do people use to allocate port numbers in a way that you'll never get clashes?

[+] striking|1 year ago|reply
You can consider the use of Unix sockets (sockets as named files). There are lots of limitations but the most pervasive and frustrating of those is the general lack of support for them across apps.

You could set up Nginx and some local subdomains to reverse proxy to the intended applications, regardless of whether they're hosted on Unix sockets or plain ports, if that makes accessing them easier. It definitely makes them easier to make accessible outside of the local machine.

[+] thwarted|1 year ago|reply
You can add things to /etc/services and software that properly uses getservbyname(3) when binding to a port can use those names.
[+] oefrha|1 year ago|reply
No way to allocate port numbers without clashes ever. What I do is having a Ports.md in my personal knowledge base with all port assignments in my personal projects and networks: port, description, project link and/or service host:port. This works very well, I don’t have tens of thousands of projects so I’m not going to exhaust port numbers. I used to try to use Unix domain sockets as much as possible for anything fronted by nginx, but stopped bothering with that since I started centrally maintaining port assignment.
[+] singron|1 year ago|reply
You can listen on an anonymous port. It's similar to how the kernel allocates a port for outgoing connections. It's very useful if you want to listen ephemerally, especially in tests. The downside is that you need your server to report which port it's actually listening on, and if it restarts, it will get a different port.
[+] sesm|1 year ago|reply
I've seen scripts that probe ports with nc until they find a free one. They usually log to stdout which port they found.
[+] pama|1 year ago|reply
If you can ssh to the remote, you can simply use Emacs (dired and trump). I suppose the advantage here is that once you turn a machine into a file server you can access it from other devices.
[+] johnbellone|1 year ago|reply
Still doesn’t beat ksh cgi server. Ugh.