• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

add

Adding Domains in Certbot

January 25, 2021

You can register multiple domains to a single SSL certificate. This is particularly useful if you are hosting multiple domains on one server. This command adds more domains to your existing certificate.

certbot --expand -d existing.com -d newdomain1.com -d newdomain2.com

certbot --expand -d existing.com -d newdomain1.com -d newdomain2.com

Check if the domains were added.

certbot certificates

certbot certificates

Certbot certificates are valid for 90 days, but they automatically renew themselves if expiration is less than 30 days. If you need to renew manually for some odd reason, you can run this command. You can also perform a dry-run before renewing.

certbot renew
certbot renew --dry-run

certbot renew certbot renew --dry-run

Filed Under: Linux Tagged With: add, certbot, certificate, domains

AWS EFS Tags

January 4, 2021

This script add new tags if they are missing.

#!/bin/bash
log="log.txt"
id=$(aws efs describe-file-systems --query "FileSystems[*].[FileSystemId]" --output text --region us-east-1)
tag=$(aws efs describe-file-systems --query "FileSystems[*].Tags[?Key=='aws-backup'].Value" --output text --region us-east-1 )
 
arr[0]="efs-0000"
arr[1]="efs-0400"
arr[2]="efs-0800"
arr[3]="efs-1200"
arr[4]="efs-1600"
arr[5]="efs-2000"
 
rand=$[ $RANDOM %6 ]
backup=${arr[$rand]}
 
if [[ $tag == "" ]]; then
  aws efs tag-resource --resource-id $id --tags Key="aws-backup",Value=${arr[$rand]} --profile default --region us-east-1
  echo "Added backup tag $backup to $id" 
elif [[ $tag == "no-backup" ]]; then
  echo "No backup on $id."
else
  echo "No changes done to $id."
fi

#!/bin/bash log="log.txt" id=$(aws efs describe-file-systems --query "FileSystems[*].[FileSystemId]" --output text --region us-east-1) tag=$(aws efs describe-file-systems --query "FileSystems[*].Tags[?Key=='aws-backup'].Value" --output text --region us-east-1 ) arr[0]="efs-0000" arr[1]="efs-0400" arr[2]="efs-0800" arr[3]="efs-1200" arr[4]="efs-1600" arr[5]="efs-2000" rand=$[ $RANDOM %6 ] backup=${arr[$rand]} if [[ $tag == "" ]]; then aws efs tag-resource --resource-id $id --tags Key="aws-backup",Value=${arr[$rand]} --profile default --region us-east-1 echo "Added backup tag $backup to $id" elif [[ $tag == "no-backup" ]]; then echo "No backup on $id." else echo "No changes done to $id." fi

Filed Under: Cloud Tagged With: add, aws, efs, tags

Add Existing User To A Group

December 3, 2020

Here’s how to add an existing user to a user group in Linux.

usermod -a -G groupname username
usermod -a -G www-data john

usermod -a -G groupname username usermod -a -G www-data john

List all users belonging to a group.

lid -g www-data

lid -g www-data

List all the groups the user belongs to.

groups john

groups john

Filed Under: Linux Tagged With: add, existing, group, user

Git Bash Path

August 19, 2020

Here’s how to add or edit the PATH in Git Bash. Edit your bash_profile.

vi ~/.bash_profile

vi ~/.bash_profile

Set your path by adding the new path at the end.

PATH="/c/WINDOWS/system32:/c/Users/firstname.lastname/google-cloud-sdk/bin"

PATH="/c/WINDOWS/system32:/c/Users/firstname.lastname/google-cloud-sdk/bin"

The example path listed above is truncated for brevity.

Filed Under: Cloud, Linux Tagged With: add, bash_profile, gcloud, git bash, path

Wheel Group

February 25, 2020

Here’s an alternate way to give Linux users sudo access by adding them to the wheel group. Most Linux systems come with the wheel group already predefined. By adding users to the wheel group, they now have the ability to sudo and run root commands. The wheel group is in the sudoers file for Redhat, Centos, Debian and Ubuntu.

usermod -aG wheel username

usermod -aG wheel username

Filed Under: Linux Tagged With: add, group, sudo, sudoers, usermod, wheel

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Go to page 6
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023