How to fix the crontab error `rename: Operation not permitted`

Today, something unexpected happened while I was working on one of our Linux machines. I issued the crontab -e command to add a cron job to my user’s crontab file, modified and saved it, only to the following error: crontab: installing new crontab crontab: crontabs/<user>: rename: Operation not permitted crontab: edits left in /tmp/crontab.hgmsOH/crontab Puzzled, I checked whether my user permissions were all right, if the disk was full, and several other things....

January 25, 2024

How to use bash to recursively search and replace a string in all directory files

Another achievement I unlocked with the recent website update is the newsletter switch from Substack to a fantastic and independent provider, Buttondown. That required updating all the “subscribe to my newsletter” links. We’re talking 5K posts, all saved as individual files in the same directory. The bash command that did that for me is: find content/post/*.md -type f -exec \ sed -i .bak 's|https://nicolaiarocci.substack.com|https://buttondown.email/nicolaiarocci|g' {} + It is pretty straightforward. find looks for all markdown files in the content/post/ directory....

January 6, 2024

rsync with a different user

Today I learned how to rsync with a user different than the one connected to the remote. Why would one want to do such a thing? The data I need to download from that server is owned by ‘backup,’ a different, service-only user. I wanted to avoid going the change-permissions slippery route and allow my user direct access to the data. Looking at the rsync documentation, I learned about the nifty --rsync-path=PROGRAM option:...

August 23, 2023