Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.zip

73 replies

not giving a fuck about proper file perms is fine as long as its not a server

3
Epherareply
lemmy.ml

Yeah, not only does +x leave read/write permissions untouched, it also only makes it executable for the user, not for everyone and their cat.

60

If your cat isn’t the first entry in /etc/sudoers I’m not sure I want to know you

5
Mr.Chewyreply
lemmy.world

Cat doesn't execute anything tho, it just reads and gives output

25

Or am I???

x='dumb.txt' && echo "ls | grep $x && cat $x && rm -v $x" > $x && cat $x | bash

1
programming.dev

What happens when u try to cat the cat program, is that considered reading or executing

5

Except if you use kitty terminal emulator with unsecure remote access. Issue

Then with cat, you could execute arbitrary commands...

5

If your cat isn’t the first entry in /etc/sudoers I’m not sure I want to know you

-1
feddit.org

When I start fucking with chmod, it happens way too often that what I want to do only works after I executed chmod 777...

37
rImITywRreply
lemmy.world

chmod -R 777 /

Why the fuck am I still getting permission errors

38

You can actually do chmod +777,u+rwx,go-w foo to make the logic easier if you want to force a starting assumption.

3
lemmy.blahaj.zone

I don't use chmod nearly often enough to remember these numbers. I know there's a mathematical way to figure it out, but I cba to do that when u+wrx more or less tells me exactly what it does (grant the User Write, Read, and eXecute permissions)

11
WFH
lemmy.zip

chmod -R 600 ~/, because I dont trust anyone, not even myself.

14
fedia.io

I forgor the tilde and its taking a long time. wat do

12
fedia.io

False. It's a shell synonym for /home/ah-ha-ha-nice-try-you-are-not-getting-my-real-homedir-name

... it's a PITA to type out longhand, let me tell you.

3
sh.itjust.works

Ah, I see. I thought that you had forgotten what the tilde does, not that you ran the command without it!

2

I was being a silly goose and pretending I was more clueless than I actually am.

(Probably not by as much as I'd like to think.)

2

If you don't add the leading digit (out of respect) for the sticky/setgid/setuid bits, do you even Linux?

18
wheezyreply
lemmy.ml

Unfortunately. I really wish $HOME was reserved for files I create myself. I know. I can create my own shit for that. But, I really wish every single random project I download to fuck around with didn't drop a config directory or file in there. ITS MY HOME.

13
meekahreply
discuss.tchncs.de

I mean, having config files in there makes a lot of sense. It allows you to move your home to some other machine/install and immediately feel at home, because everything is configured to your liking.

Now, the fact that many apps create their own directory instead of putting their stuff in ~/.config is pretty annoying.

13

Yeah. That's more my frustration. That it's implented poorly by most people. I don't think that trying to change the standard by "adding another standard" would be helpful. Just minor frustration. Which usually leads me to putting all my organized directories and shit in a dedicated location. And I just let /home be the clutter that it is.

5

Also for multi user systems it's handy that each user gets their own configs

5
lemmy.ml

The programs usually run in user context and have access to the files.

Even if thinking very hard I cannot come up with a scenario where a program that does not run in user context needs access to user files.

2

Usually, but there might be services running as other users that reference those configs. It really just depends on what’s on your system. Obviously you can make 700 work, but it might require tweaking some stuff.

1

It really just depends on what’s on your system.

Yes, this is what I wonder.

I use Linux since ca. 2005 and never ever had a program not working because it could not read a user’s $HOME contents.

2
libewareply
feddit.org

macOS by default makes /Users/* only readable by the owner, except for $HOME/Public, which is drwxr-xr-x, and $HOME/Public/Postbox, which is drwx-w--w-

2
ddhreply
lemmy.sdf.org

I gotta ask why they put Public in home

2

Because it's a user-specific folder that says "This is mine, but you can see it."

2

chmod 755 for when setting permissions to directories. chmod +x for making something executable right when I am about to run it.

6
piefed.social

Careful: chmod -X also looks for any existing exec bits:

$ umask 0
$ >foo >bar
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 foo
$ chmod o+x foo
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rwx 1 user group 0 Sep 10 00:00 foo
$ chmod u=rwX,g=rX,o=rX foo bar
$ ls -al foo bar
-rw-r--r-- 1 user group 0 Sep 10 00:00 bar
-rwxr-xr-x 1 user group 0 Sep 10 00:00 foo
2

This is exactly what I expect, so I never got tripped up by this. But yes, it's worth pointing out that this will expand the executable flag on files that are already executable and set it on folders too. But not set it on files that aren't executable at all.

2