snap –

Package any app for every Linux desktop, server, cloud or device, and deliver updates directly. Snap packages are a great way of running apps in an isolated state without using VMs or Containerisation. The website has more details and examples such as this to get going:

A snap is a fancy zip file containing an application together with its dependencies, and a description of how it should safely be run on your system, especially the different ways it should talk to other software. Most importantly snaps are designed to be secure, sandboxed, containerised applications isolated from the underlying system and from other applications. Snaps allow the safe installation of apps from any vendor on mission critical devices and desktops.

Try this (you may need to install snapd)

 $ sudo snap install hello-world 

Now you have installed a snap. You can take a look inside the snap very easily, it shows up as a new directory on your system:

$ cd /snap/hello-world/current/

$ tree
├── bin ← this directory structure is just for convenience
│ ├── echo there is no hardcoded structure requirement other
│ ├── env than meta/snap.yaml
│ ├── evil
│ ├── sh
│ ├── showdev
│ └── usehw
└── meta ← your snap must have this directory
├── icon.png ← no prizes for guessing what this is
└── snap.yaml ← this is the required metadata


How do I stop and start EC2 instances at regular intervals using AWS Lambda?

I want to reduce my Amazon EC2 usage by stopping and starting instances at predefined times or utilization thresholds. Can I configure AWS Lambda and AWS CloudWatch to help me do that automatically?

Short Description:
You can use a CloudWatch Event to trigger a Lambda function to start and stop your EC2 instances at scheduled intervals.

See AWS Web Page for more: 


LXD Update Script

Simple shell script wrapper to update all lxd container hypervisor images running Debian or Ubuntu Linux. Run the below script on the host of your lxd server to update all the lxd containers running Ubuntu or Debian. Could be modified to suit CentOS/RedHat OS and/or you container OS of choice.


# A simple shell script to update all lxd container hypervisor
# URL:
# Tested on : Ubuntu 16.04 LTS lxd server
# Tested on : Ubuntu/Debian lxd container hypervisor only
# ----------------------------------------------------------------------------
# Author: nixCraft
# Copyright: 2016 nixCraft under GNU GPL v2.0+
# ----------------------------------------------------------------------------
# Last updated 14 Aug 2016
# ----------------------------------------------------------------------------
# Set full path to bins
# Get containers list
clist="$(${_lxc} list -c ns | ${_awk} '!/NAME/{ if ( $4 == "RUNNING" ) print $2}')"
# Use bash for loop and update all container hypervisor powered by Debian or Ubuntu
# NOTE: for CentOS use yum command instead of apt-get
for c in $clist
echo "Updating Debian/Ubuntu container hypervisor \"$c\"..."
${_lxc} exec $c ${_apt} -- -qq update
${_lxc} exec $c ${_apt} -- -qq -y upgrade
${_lxc} exec $c ${_apt} -- -qq -y clean
${_lxc} exec $c ${_apt} -- -qq -y autoclean



Attic – De-Duplicating Backup Application

Attic is a deduplicating backup program written in Python. The main goal of Attic is to provide an efficient and secure way to backup data. The data deduplication technique used makes Attic suitable for daily backups since only the changes are stored.


  • Space efficient storage
    Variable block size deduplication is used to reduce the number of bytes stored by detecting redundant data. Each file is split into a number of variable length chunks and only chunks that have never been seen before are compressed and added to the repository.
  • Optional data encryption
    All data can be protected using 256-bit AES encryption and data integrity and authenticity is verified using HMAC-SHA256.
  • Off-site backups
    Attic can store data on any remote host accessible over SSH as long as Attic is installed.
  • Backups mountable as filesystems
    Backup archives are mountable as userspace filesystems for easy backup verification and restores.

More information and Download Install instructions are available from the site:

Check RAM Speed and type in Linux

To see what RAM speed and type you have run this command:

 sudo dmidecode --type 17 

The output will look something like this:

# dmidecode 2.11
SMBIOS 2.8 present.
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.

Handle 0x003F, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x003E
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: SODIMM
Set: None
Locator: DIMM 1
Bank Locator: Channel A Slot 0
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MHz
Manufacturer: Kingston
Serial Number: 097054251107
Asset Tag: 9876543210
Part Number: 9905428-087.A00G
Rank: 2
Configured Clock Speed: 1600 MHz

Obviously you should or would be only running this on a physical box.

The detox utility

The detox utility renames files to make them easier to work with. It removes spaces and other such annoyances. It’ll also translate or cleanup Latin-1 (ISO 8859-1) characters encoded in 8-bit ASCII, Unicode characters encoded in UTF-8, and CGI escaped characters.

detox is driven by a configurable series of filters, called a sequence. Sequences are covered in more detail in detoxrc(5) and are discoverable with the -L option. Some examples of default sequences are iso8859_1 and utf_8.


The main options:

-f configfile
Use configfile instead of the default configuration files for loading translation sequences. No other config file will be parsed.
-h –help
Display helpful information.

-L’ List the currently available sequences. When paired with -v this option shows what filters are used in each sequence and any properties applied to the filters.

-n –dry-run
Doesn’t actually change anything. This implies the -v option.

-r’ Recurse into subdirectories.

-s sequence
Use sequence instead of default.

Works on special files (including links). Normally detox ignores these files.

-v’ Be verbose about which files are being renamed.

-V’ Show the current version of detox.



Find any E-Mail Address or Proxy Address In Active Directory

Who has this e-mail address? The address could be one of many different types of objects. A user mailbox, shared mailbox, distribution list, public folder, contact or resource could all contain that specific e-mail address. The problem with the Exchange Management Console in Exchange 2010 does not allow you to find any e-mail address only the primary.

Exchange Commandlets:

1: The following Exchange commandlet is the easiest method to find a specific e-mail address
or portion of an e-mail address. This will find any object within Exchange that has an exact
match to the e-mail address you place in the filter with -eq or email portion when using -like.

Get-Recipient [email protected]

Get-Recipient -Filter {EmailAddresses -like "*emailportion*"}

2: The following examples highlight the individual commandlets that target and return the
specific Exchange object types. You can substitute -eq with -like to include wild cards.

Get-Mailbox -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-MailboxContact -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-DistributionGroup -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-MailUser -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}



Reset Juniper SSG firewall password

If you are faced with not knowing the admin password for a Juniper SSG based firewall, you can reset to factory defaults. Ideally you should have been backing up the configuration and keeping your password safe with a password manager – if not and/or you have been provided with  an SSG or purchased from Ebay etc read on….

Console Cable Option:

  1. Connect via Console cable.
  2. Login with the serial number of the SSG as the username and password.
  3. You can reset the firewall to factory defaults.

Connect a network cable to Ethernet 0/0 and login via your browser to:
Username: netscreen
Password: netscreen

Reset the unit with reset pin:

Push and hold the pinhole on the Juniper. The status LED will turn to a blinking amber so KEEP holding, and when it turns to blinking green, release the pinhole. After 1 second, push and HOLD the pinhole again. The LED will turn to blinking red so KEEP holding until the status LED turns to solid amber or solid green, release right away and wait for the device to reset and come back – give it five minutes.
Then connect to it as described above

LSOF Utility and Commands

The lsof command is very handy and all Linux/Unix sysadmins should know abouyt it and make more use of it, here are some further details and examples.

(From Wikipedia) – lsof is a command meaning “list open files”, which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Victor A. Abell, the retired Associate Director of the Purdue University Computing Center. It works in and supports several Unix flavors.

Useful Commands:

List all network connections:

 sudo lsof -i 


sudo lsof -i:22
sudo lsof -c ssh

List all network files in use by a specific process:

 sudo lsof -i -a -p 1278 

List processes which are listening on a particular port:

 sudo lsof -i :25 

List all TCP or UDP connections:

 sudo lsof -i tcp; lsof -i udp; 

List processes which opened a specific file:

 lsof /var/log/syslog 

List opened files under a directory:

 lsof +D /var/log/ 

List opened files based on process names starting with:

 lsof -c ssh -c init 

List processes using a mount point:

 sudo lsof /home 

List files opened by a specific user:

 lsof -u keith 

What commands is user Keith using:

 sudo lsof -i -u keith 

List all open files by a specific process:

 lsof -p 1278 

Kill all process that belongs to a particular user:

 kill -9 `lsof -t -u keith` 


SSL Server Test

Qualys SSL Server Test is free online service that performs a deep analysis of the configuration of any SSL web server on the public Internet.

To configure Apache and Nginx with acceptable protocols TLS settings follow these guides, they will provide a better score on the above Qualys rating and make your SSL site more secure.