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.
I often go chmod -R go+rX . if I want to give read-only access to whatever I’m working on to everyone else. The capital X only sets the executable bit on directories.
For those that don’t know, you can use three numbers, zero through eight, with the chmod command. it takes the binary of each digit to set the permissions.
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.
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: execute
I 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.For those that don’t know, you can use three numbers, zero through eight, with the chmod command. it takes the binary of each digit to set the permissions.
$ chmod 644 6 | 4 | 4 110 | 100 | 100 rw- | r-- | r--
Execute just adds 1, so if you want the dir world viewable, it’s 755.