Samba File Server: Stop files from being set with executable bit

While doing a bit of code cleanup today, I found some files which were marked as executable even though they weren't meant to be.

image

As I looked around at the files affected, a colleague did some snooping on git and found out why it was being set.

"Err Twig, I think it's you".

After double checking the git logs, yep it was me. How embarassing!

dramatic_alpaca

Preventing the stupid setting

Fortunately it's an easy fix to stop it from happening.

Open up the Samba FS config file

  • sudo vi /etc/samba/smb.conf
  • Under "[global]", paste in:

map archive = no

  • Save and restart

Bonus: Fixing affected files

Unfortunately, this part isn't so easy

You can use this command to quickly search and list out files affected:

find -type f -perm /u+x | vim -

If you want to just find and turn off the executable bit automatically, then use:

find -type f -perm /u+x -exec chmod -x {} \;

find -type d -perm /u+x -exec chmod 0755 {} \;

It'll be up to you to set +x back onto any files which were supposed to have it.

Source

cPanel / WHM: How to redirect sub-addressed (plus addressing) emails to your inbox folder

For a few months now, my inbox has been pretty quiet. I thought that the war on spam is finally over, but then I noticed that my regular cron job emails weren't being received either.

I checked and disabled all my email filters, nothing strange there.

I disabled all my spam checks. Nope nothing there too.

Without many other options, I contacted my web host and they said it seemed fine. I sent various test emails and replied back saying it wasn't working for me on all email addresses on their servers.

Something seemed fishy, but I decided to bypass my usual IMAP method of use and went straight to webmail. Wasn't showing up there either.

The problem

Clicking around on all the options on Roundcube, by chance I stumbled upon an option to select folder subscriptions and noticed a bunch of folders which matched the names of my test emails!

It turns out somewhere along the line, in a "recent" update cPanel decided to redirect all plus-addressed emails to a subfolder matching the name of the sub-address. This was a ridiculously stupid decision as IMAP clients generally don't refresh the subfolder listings until you tell them to. With plus-addressing being a useful tool to determine where spam emails come from, it's a chore to keep refreshing the folders whenever I sign up to a new website.

 Untitledemail filters
Thunderbird and Roundcube both don't automatically subscribe to new folders when accessing your email via IMAP.

What makes it worse is there is no option to disable this default behaviour. They've just proudly written down in the docs as a note under "Email subaddresses" in case you happen to stumble upon it.

image

The solution

In the docs there are notes about tweaking EXIM (which sounds like it could cause more trouble), but thankfully I managed to find a help page by Ngage Hosting UK which provided a fix for this. I'd take a guess it was a response to customers frequently complaining about not receiving emails...

  • Go to your cPanel setup page
  • Click on Mail > "User-Level Filtering"
  • For each email address, click on "Manage Filters"
  • Click "Create a New Filter"
  • Give it a name (eg. "Sub-address to inbox")
  • Set rule to be "To" > "matches regex" > you\+[a-z0-9]@yourdomain.com (replace "you" and "yourdomain.com" parts)
  • Set action to be "Deliver to Folder"
  • Click the browse button and select "Inbox"
  • Save it and repeat for other email addresses

You'll also have to do this for every domain, so enjoy this tedious process!

Sources

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog