PHP, Ubuntu Desktop, and WordPress… and I’m perfectly happy with that.
Fight me.
PHP, Ubuntu Desktop, and WordPress… and I’m perfectly happy with that.
Fight me.
Trying out running Ubuntu on my mid-2015 MacBook Pro. Except for some quirks (and some lag, due to…well, the os being mounted from a thumb drive), it’s remarkably enjoyable.
sudo dpkg -r google-chrome-stable
.sudo rpm -e google-chrome-stable
.Here’s a comprehensive sudo ufw
(Uncomplicated Firewall) cheatsheet for managing firewall rules on an Ubuntu server:
sudo ufw enable
sudo ufw disable
sudo ufw status
sudo ufw status verbose
for detailed output.sudo ufw reset
sudo ufw allow <port>
sudo ufw allow 22
(allows SSH)sudo ufw allow <port>/<protocol>
sudo ufw allow 80/tcp
(allows HTTP)sudo ufw allow <start port>:<end port>/protocol
sudo ufw allow 1000:2000/tcp
sudo ufw allow from <IP>
sudo ufw allow from 192.168.1.100
sudo ufw allow from <IP> to any port <port>
sudo ufw allow from 192.168.1.100 to any port 22
sudo ufw allow from <subnet>
sudo ufw allow from 192.168.1.0/24
sudo ufw deny <port>
sudo ufw deny 23
(denies Telnet)sudo ufw deny <port>/<protocol>
sudo ufw deny 80/tcp
sudo ufw deny from <IP>
sudo ufw deny from 192.168.1.100
sudo ufw status numbered
sudo ufw delete <rule number>
sudo ufw delete allow <port>
sudo ufw delete allow 22
sudo ufw delete deny <port>
sudo ufw delete deny 23
sudo ufw logging on
off
to disable logging.sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw default allow incoming
sudo ufw default deny outgoing
sudo ufw limit <port>
sudo ufw limit ssh
(limits SSH connections to prevent brute force attacks)sudo ufw allow <service>
sudo ufw allow OpenSSH
sudo ufw app list
sudo ufw allow <app profile>
sudo ufw allow 'Apache Full'
sudo ufw status
sudo ufw status verbose
sudo ufw status numbered
sudo ufw reload
sudo ufw show raw
This cheatsheet covers common UFW commands and options, providing a solid reference for managing firewall settings on Ubuntu.
I’d like to relay all my Ubuntu 22.04 email through Amazon SES.
Use at your own risk. Like seriously, do some research prior to implementing any of this into your own environment. Consider factors like costs, scalability, etc.
To relay all your email through Amazon SES (Simple Email Service) on an Ubuntu 22.04 server, you will need to:
Postfix
to relay email through SES.Here are the detailed steps:
Open a terminal on your Ubuntu server and install Postfix
:
sudo apt update
sudo apt install postfix
During installation, choose “Internet Site” and set the system mail name to your domain name (e.g., example.com
).
Edit the Postfix configuration file:
sudo nano /etc/postfix/main.cf
Add or modify the following lines to configure Postfix to use Amazon SES as a relay host:
relayhost = [email-smtp.us-east-1.amazonaws.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
Replace email-smtp.us-east-1.amazonaws.com
with the correct SES SMTP endpoint for your region. You can find the list of SMTP endpoints in the Amazon SES documentation.
Create and edit the SASL password file:
sudo nano /etc/postfix/sasl_passwd
Add the following line, replacing the SMTP endpoint, username, and password with your SES SMTP details:
[email-smtp.us-east-1.amazonaws.com]:587 YOUR_SES_SMTP_USERNAME:YOUR_SES_SMTP_PASSWORD
Secure the file permissions:
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
Restart the Postfix service to apply the changes:
sudo systemctl restart postfix
v=spf1 include:amazonses.com ~all
Send a test email to ensure everything is configured correctly:
echo "Test email body" | mail -s "Test email subject" your-email@example.com
Check the recipient’s inbox and the /var/log/mail.log
file on your server for any errors.
This setup ensures your emails are securely relayed through Amazon SES, leveraging its robust infrastructure.
The information provided in this blog post is for educational and informational purposes only. The steps and instructions are based on personal experience and research, and are intended to help users configure email relaying through Amazon SES on Ubuntu 22.04.
No Warranty: The author and publisher make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to the information, products, services, or related graphics contained in this blog post for any purpose. Any reliance you place on such information is therefore strictly at your own risk.
Limitation of Liability: In no event will the author or publisher be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this blog post.
External Links: Through this blog post, you are able to link to other websites which are not under the control of the author. We have no control over the nature, content, and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.
By using the information in this blog post, you agree to the terms of this disclaimer. If you do not agree to these terms, please do not use the information provided.
While instance properties can be determined at launch, some of them can be updated after the instance has been created. Specifically, an instance’s memory, disk space, and the number of its CPUs are exposed via daemon settings: local..(cpus|disk|memory).
Documentation
Issue:
How to setup cron jobs in Ubuntu (and Linux)?
Solution:
Setting up cron jobs on a Linux system like Ubuntu is a straightforward process. Cron jobs are scheduled tasks that your system runs at specified times or intervals. Here’s how you can set them up:
crontab -e
This command opens your user’s cron file in the default text editor. If it’s your first time using crontab
, it may ask you to select an editor (like nano
, vi
, etc.).* * * * * command-to-execute
This is broken down as:Minute (0 - 59)
Hour (0 - 23)
Day of the month (1 - 31)
Month (1 - 12)
Day of the week (0 - 6) (Sunday = 0)
0 5 * * * /path/to/script.sh
Make sure your script (script.sh
in this example) is executable. You can make it executable with chmod +x /path/to/script.sh
.crontab -l
Instead of the asterisks, you can use special strings for common intervals:
@reboot
: Run once, at startup.@yearly
or @annually
: Run once a year, “0 0 1 1 *”.@monthly
: Run once a month, “0 0 1 * *”.@weekly
: Run once a week, “0 0 * * 0”.@daily
: Run once a day, “0 0 * * *”.@hourly
: Run once an hour, “0 * * * *”. 0 0 * * * /path/to/backup/script.sh
0 * * * * /usr/bin/php /path/to/your/script.php
/dev/null
if you don’t need it. * * * * * command-to-execute >> /path/to/logfile 2>&1
Cron jobs are particularly useful for automating routine tasks like backups, system updates, or periodic cleanup of temporary files.
WSL, Ubuntu 20.05, command line, for “PDF to HTML.” Step by step.
Here are the short instructions to convert a PDF to HTML using WSL with Ubuntu 20.04:
sudo apt update && sudo apt upgrade -y
.sudo apt install -y poppler-utils
.pdftohtml -s <input_file>.pdf <output_file>.html
That’s it!