Yup. Took me weeks to figure out why I explicitly need to use sudo nvim for my nginx config on my Pi, while on my server my little helper script could automatically use sudo for me. Turns out, I chmoded the sites-available and sites-enabled on my pi to 644 but left them untouched on my server.
I still don’t know what numbers would be 644 but with execute permissions, but in the end, idc.
with the chmid command
Nah, that command just makes the file below average quality. It’s a new command added by Gen Z.
644 and 755 are the two most useful octal codes to remember because they make up the majority of files on your system. 644 is user read/write but read-only for everyone else. 755 adds execute to that, useful for scripts and directories.
Other than that, the most common other things are setting access for group and others to zero, so your ~/.ssh directory is 700 (rwx for you, no access for anyone else) and the private keys in it are 600, rw for you, no access for anyone else).
You can also do
chmod +x
to add the executable bit to whatever the existing perms are.0: no permissions
+4: read
+2: write
+1: executeI often go
chmod -R go+rX .
if I want to give read-only access to whatever I’m working on to everyone else. The capitalX
only sets the executable bit on directories.