It's all about those little file mode bits

a month ago by alecsargent to c/linuxmemes

W98BSoD 112 points a month ago

path: 0 25755807, hotness: undefined, score: 112, children: 2
Funkt4st1c 28 points a month ago

This is drake erasure and I'm LOVING EVERY MINUTE OF IT, JERRY

path: 0 25755807 25758065, hotness: undefined, score: 28, children: 0
trashman 13 points a month ago

Yo dawg, heard you like memes

path: 0 25755807 25757947, hotness: undefined, score: 13, children: 0
gigaqps 70 points a month ago

But those are different

path: 0 25752980, hotness: undefined, score: 70, children: 10
Ephera 60 points a month ago

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.

path: 0 25752980 25753104, hotness: undefined, score: 60, children: 8
MrChewy 25 points a month ago

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

path: 0 25752980 25753104 25754408, hotness: undefined, score: 25, children: 5
SaharaMaleikuhm 10 points a month ago

The cat command executes the cat program.

path: 0 25752980 25753104 25754408 25757962, hotness: undefined, score: 10, children: 2
quantumvoid0 5 points a month ago

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

path: 0 25752980 25753104 25754408 25757962 25761490, hotness: undefined, score: 5, children: 1
NominatedNemesis 5 points a month ago

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

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

path: 0 25752980 25753104 25754408 25763387, hotness: undefined, score: 5, children: 0
fartographer 1 point a month ago

Or am I???

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

path: 0 25752980 25753104 25754408 25786324, hotness: undefined, score: 1, children: 0
dimmuborgnine 5 points a month ago

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

path: 0 25752980 25753104 25785679, hotness: undefined, score: 5, children: 0
dimmuborgnine -1 points a month ago

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

path: 0 25752980 25753104 25785686, hotness: undefined, score: -1, children: 0
alecsargent 3 points a month ago

Had to be done for the joke. :)

path: 0 25752980 25757403, hotness: undefined, score: 3, children: 0
morto 64 points a month ago

chmod 666 so only the devil can execute it

path: 0 25751490, hotness: undefined, score: 64, children: 0
rumschlumpel 37 points a month ago

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

path: 0 25750756, hotness: undefined, score: 37, children: 5
renegadespork 56 points a month ago

May I interest you in a nice “chown”?

path: 0 25750756 25751180, hotness: undefined, score: 56, children: 0
rImITywR 38 points a month ago

chmod -R 777 /

Why the fuck am I still getting permission errors

path: 0 25750756 25751196, hotness: undefined, score: 38, children: 2
renegadespork 30 points a month ago

sudo

path: 0 25750756 25751196 25751427, hotness: undefined, score: 30, children: 0
voytrekk 7 points a month ago

Selinux

path: 0 25750756 25751196 25756090, hotness: undefined, score: 7, children: 0
quarrel4you 3 points a month ago

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

path: 0 25750756 25765871, hotness: undefined, score: 3, children: 0
Maxxie 31 points a month ago

this but in reverse 🤷‍♀️

path: 0 25752497, hotness: undefined, score: 31, children: 0
neopenguin 18 points a month ago

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

path: 0 25751418, hotness: undefined, score: 18, children: 0
renegadespork 16 points a month ago

700 cause I’m selfish.

path: 0 25751190, hotness: undefined, score: 16, children: 12
Dirk 8 points a month ago

700 is the only sane answer for directories inside $HOME.

path: 0 25751190 25751483, hotness: undefined, score: 8, children: 11
renegadespork 5 points a month ago

Nah, there’s a lot of config files in there that other programs need to read.

path: 0 25751190 25751483 25752492, hotness: undefined, score: 5, children: 7
wheezy 13 points a month ago

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.

path: 0 25751190 25751483 25752492 25752708, hotness: undefined, score: 13, children: 3
meekah 13 points a month ago

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.

path: 0 25751190 25751483 25752492 25752708 25754061, hotness: undefined, score: 13, children: 2
Dirk 2 points a month ago

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.

path: 0 25751190 25751483 25752492 25760810, hotness: undefined, score: 2, children: 2
renegadespork 1 point a month ago

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.

path: 0 25751190 25751483 25752492 25760810 25762397, hotness: undefined, score: 1, children: 1
libewa 2 points a month ago

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-

path: 0 25751190 25751483 25755763, hotness: undefined, score: 2, children: 2
DarkDarkHouse 2 points a month ago

I gotta ask why they put Public in home

path: 0 25751190 25751483 25755763 25776976, hotness: undefined, score: 2, children: 1
libewa 2 points a month ago

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

path: 0 25751190 25751483 25755763 25776976 25780261, hotness: undefined, score: 2, children: 0
Wfh 15 points a month ago

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

path: 0 25754674, hotness: undefined, score: 15, children: 6
palordrolap 12 points a month ago

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

path: 0 25754674 25757439, hotness: undefined, score: 12, children: 5
the_strange 12 points a month ago

sudo rm -rf / --no-preserve-root

Start from scratch

path: 0 25754674 25757439 25757877, hotness: undefined, score: 12, children: 0
clay_pidgin 2 points a month ago

Tilde is a shortcut to /home/palordrolap

path: 0 25754674 25757439 25762634, hotness: undefined, score: 2, children: 3
palordrolap 3 points a month ago

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.

path: 0 25754674 25757439 25762634 25772444, hotness: undefined, score: 3, children: 2
clay_pidgin 2 points a month ago

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

path: 0 25754674 25757439 25762634 25772444 25783912, hotness: undefined, score: 2, children: 1
SaharaMaleikuhm 15 points a month ago

Nope, +x for life

path: 0 25757977, hotness: undefined, score: 15, children: 1
nibbler 1 point a month ago
path: 0 25757977 25762786, hotness: undefined, score: 1, children: 0
cupcakezealot 13 points a month ago

chmod -R 777 / galaxy brain

path: 0 25757479, hotness: undefined, score: 13, children: 0
Nyadia 11 points a month ago

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)

path: 0 25759017, hotness: undefined, score: 11, children: 2
timbuck2themoon 8 points a month ago

4 read, 2 write, 1 execute.

That's it. Add them up for whatever you want.

path: 0 25759017 25772948, hotness: undefined, score: 8, children: 1
naevaTheRat 3 points a month ago

and digits are sticky, owner, group, all

path: 0 25759017 25772948 25784058, hotness: undefined, score: 3, children: 0
undefinedTruth 7 points a month ago

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

path: 0 25758261, hotness: undefined, score: 7, children: 0
BigBrownBeaver 7 points a month ago

chmod -R ug+rwX,o=r *

path: 0 25764223, hotness: undefined, score: 7, children: 1
anarchy79 2 points a month ago

Such a beautiful language.

path: 0 25764223 25774035, hotness: undefined, score: 2, children: 0
Unpigged 5 points a month ago

I like to chmod it chmod it

path: 0 25753499, hotness: undefined, score: 5, children: 0
red_bull_of_juarez 5 points a month ago

u=rwX,g=rX,o=rX because this won't make every file executable, only folders.

path: 0 25751930, hotness: undefined, score: 5, children: 3
quarrel4you 2 points a month ago

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
path: 0 25751930 25765667, hotness: undefined, score: 2, children: 1
red_bull_of_juarez 2 points a month ago

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.

path: 0 25751930 25765667 25770399, hotness: undefined, score: 2, children: 0
eyesaremosaics 1 point a month ago

Looks like a handy flag

path: 0 25751930 25754899, hotness: undefined, score: 1, children: 0
PerogiBoi 4 points a month ago

Chmod 777 I live erratically without consequence.

path: 0 25758026, hotness: undefined, score: 4, children: 0
DrunkAnRoot 4 points a month ago

real question is how do you pronounce chmod

path: 0 25767224, hotness: undefined, score: 4, children: 11
Bakkoda 10 points a month ago

c h mod

path: 0 25767224 25767515, hotness: undefined, score: 10, children: 0
recursivethinking 5 points a month ago

shmod. and then cho-wn (ch'own? cho-un?)

and of course, hweel (jk on this one)

path: 0 25767224 25768555, hotness: undefined, score: 5, children: 0
daniskarma 4 points a month ago

"chemod"

path: 0 25767224 25772145, hotness: undefined, score: 4, children: 0
flandish 4 points a month ago

“change mod”

path: 0 25767224 25776709, hotness: undefined, score: 4, children: 0
fleebleneeble 2 points a month ago

Shmaude

path: 0 25767224 25785731, hotness: undefined, score: 2, children: 0
Magnum 2 points a month ago

The CH from channel and then mod

path: 0 25767224 25771618, hotness: undefined, score: 2, children: 0
AstroLightz 2 points a month ago

"c h m o d"

Just like "l s" and "p a c m a n"

path: 0 25767224 25768584, hotness: undefined, score: 2, children: 0
Tiger_Man_ 1 point a month ago

hmod

path: 0 25767224 25792343, hotness: undefined, score: 1, children: 0
alecsargent 0 points a month ago

I pronounce it chmod, you?

path: 0 25767224 25768178, hotness: undefined, score: 0, children: 2
DrunkAnRoot 3 points a month ago

i say c h then mod

path: 0 25767224 25768178 25776550, hotness: undefined, score: 3, children: 0
anarchy79 3 points a month ago

I pronounce it the way it's written.

path: 0 25767224 25768178 25774030, hotness: undefined, score: 3, children: 0
Tiger_Man_ 3 points a month ago

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

path: 0 25792295, hotness: undefined, score: 3, children: 0
Matty_r 2 points a month ago

Dont forgot setfacl

path: 0 25753849, hotness: undefined, score: 2, children: 0
hazelnot 2 points 21 days ago

Right click -> Properties -> Permissions -> Allow executing file as program 😎

path: 0 25936079, hotness: undefined, score: 2, children: 0
a_non_monotonic_function 2 points a month ago

Why? I mean not Drake because Drake sucks

My specify every permission every time? That's just going to create arrows.

path: 0 25786349, hotness: undefined, score: 2, children: 0
vala 1 point a month ago

chmod -R -x *

path: 0 25763726, hotness: undefined, score: 1, children: 0
linuxmemes
linuxmemes

@lemmy.world

login for more options
33064
2389
6292

Hint: :q!


Sister communities:

Community rules (click to expand)

1. Follow the site-wide rules
2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry of any kind will not be tolerated. This is an LGBTQ+-friendly community -- if that is a problem for you, you should leave.
3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves / tolerates / hates> systemd, and wants to interject for a moment. You can stop now.
5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures

We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.

  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.

 

Please report posts and comments that break these rules!


Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

go to feed...