I may be dumb, been on linux too long or a combination of both. But what other way is there, does windows work differently? (regarding that)
post
wait til you gentoo and find out even folders themselves are files(as far as the machine interprets it anyway)
it's all fun and games until you want to use your mouse and keyboard inputs on another machine and also view the other machines screen contents. then all of a sudden stuff stops being a file. quaint.
if only there was a way to share resources over a network...
Why aren't the Linux devs just using SMB to forward the mouse and keyboard files? Are they stupid?
What do you mean? This
remoteuser@server$ nc -l -p 4444 > /dev/input/event0
localuser@laptop$ cat /dev/input/event0 | nc server 4444
doesn't work?
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeew scoots faaaar away from you actually when writing the prior comment, i was thinking about the ease that is doing what i described on plan9, there everything is in fact a file, which you can simply mount via the 9p protocol
what mumblerfish suggests looks interesting and i would have to read some the man page of "nc", i suppose...
I've figured out how to control computers remotely and I'll share the script:
Client:
#!/bin/bash
PASSWORD="your_password_here"
sshpass -p "$PASSWORD" scp /dev/stdin user@server:/path/to/cmd.txt <<< "$1"
Server:
#!/bin/bash
while true; do
while IFS= read -r line; do
eval "$line"
done < "cmd.txt"
> "cmd.txt"
done
Just chmod 777 both files and run as root, ez.
What's the difference between this and the classic "ssh user@server" ?
we're fans of internet horror memes and being loud in libraries. so we love scp and hate ssh
In case you were genuinely curious: the above humorous example bypasses very many very good safety precautions and conveniences.
When you boil everything down, one element stands out: the s in scp stands for ssh, so you are in fact still using ssh, just with several hoops bolted on.
the above humorous example bypasses very many very good safety precautions and conveniences.
I was taught in school that security and convenience are diametrically opposed, so if you can find any way of making this less secure/more convenient I'd be happy to deploy it to the entire credit union.
I am curious what you mean by everything is a file... What else would it be?
It's more a philosophy for Unix systems. When we say that "everything is a file", we're saying that even devices should show up on the filesystem (/dev), even network ports should show up on the filesystem, even processes should show up on the filesystem(/proc), etc... and that is as opposed to having a different system abstraction handle those functions instead.
Of course when you look deeper into it, linux does not explicitly follow that rule, it more just adheres to it. It's more a guideline than an explicit statement of fact
It could be a process, which you can talk to only via an IPC call. For example, dbus
can't you somehow do IPC via filesystem-based sockets in linux too?
Yea, but socket is not a file. Maybe if you stretch the definition.
Well in any case, when people say that linux is great because everything is a file, they either mean that:
- they can edit configuration of most things with a text editor, or that
- in bash (and other shells) it is easy to work with byte streams, piping them from one process to another and compose complex behaviour from simple commands.
Yeah I'm interested in how that works too.
I've recently been looking at the Nextcloud "all in one" Docker image. It works by mounting the docker.sock file into the master container, which allows that container to stand up a whole bunch of other containers on your machine.
How would that work on Windows, if the Docker socket isn't a file handle?
Docker Desktop handles the abstraction in Windows and MacOS. The container thinks it mounted a file.
and MacOS
Oh that's interesting. I wonder why they do it that way, considering macOS is a Unix OS.
I dunno, but it's a pain. Hiding low-level components from the user to make it more user-friendly.
I have an old 2014 macbook with a busted GPU temp sensor. The Mac firmware assumes the worst - that the computer is dangerously overheated - and therefore throttles back the CPU by 80% and runs the fans at full blast.
Fixing it on Mac required a number of third-party tools and flashing a custom firmware. I then installed Linux on the device - about ten lines of script that read from the working temp sensor on the CPU die and write a scaled value to /sys/ in response.
So much flippin easier on Linux.
I just said that Docker Desktop handles it. I've never used a Mac so I don't know for sure what's going on under the hood there but I imagine that everything they can do the same between Mac and Linux, they do. It's easier that way.
AIO is a fun one to setup. I found it much easier with portainer. The thing that always catches me with Docker is the permissions after it's setup. I had nextcloud up for a week I could access my external hdd over Webdav and nothing else haha.
Just in case, I have to share this great explanation of the term "everything is a file": https://unix.stackexchange.com/questions/141016/a-laymans-explanation-for-everything-is-a-file-what-differs-from-windows#141020
This really helped clear things up for me, the main idea is that everything is represented by the filesystem, so you can use the same file-manipulation tools on a ton of systems.
all 38 comments