How-to

Setting Timezone In Ubuntu Command Line

Hourglass In Rocks

You may have just setup your new Ubuntu Server setup, or perhaps you have a Virtual Private Server on Digital Ocean that sets up with the default UTC time zone. Regardless of your reasoning you should always have your server(s) and user(s) system time set with the appropriate time zone, and preferably synced entirely for devices that exist on the same network, check out the Cybersecurity Breakout below for more info on that, or skip it for find out how to set the time zone in Ubuntu.

Please note, these instructions should apply to most, if not all, Debian-based operating systems.

Cybersecurity Breakout

Cyber attackers have found every way feasible to successfully infiltrate their targets. This has included the use of date/time based attacks that attackers can use to create behaviour, often undesirable, in software, such as the creation of a race condition. Your Windows and MacOS computer has settings that you can configure to either manually or automatically set your time zone. Depending on your network, you may even have a device (like a router) that actually has a built-in time server known as a Network Time Protocol (NTP) server

The timedatectl Command

The timedatectl software controls your system’s date and time. It has a variety of commands, but we’ll only be touching the few that are relevant to our query. Check out the man pages for more. Without further ado, let’s get started.

How-To Set Time Zone in Ubuntu via Command Line

The following instructions assume that you already have command line access to your Ubuntu device.

Total Time Needed :

15

Minutes

Steps to Setting The Time Zone In Ubuntu Via Command Line

timedatectl software

Step 1 – Check Current Time Zone

You probably already know that the time zone is incorrect, but you need proof. Using the status command, you can find out how your current time is configured. (Running the timedatectl software without any commands will produce the same output.

bastion@server:~# timedatectl status

set-timezone command

Step 2 – Set A New Time Zone

The timedatectl software has a command called set-timezone that can be used to modify the time zone of your Ubuntu server without having to modify any files. You’ll need the appropriate time zone format for the time zone that your device exists in. Make sure that if you’re device is in Toronto, then is gets the America/Toronto time zone even if you live in Phoenix, Arizona. You’re setting the time zone for the device, not yourself. You can find a list of time zones on the Ubuntu man pages.

bastion@server:~# timedatectl set-timezone America/Toronto

The set-timezone command will update the time zone as found in /etc/timezone. After running the set-timezone command you can review that file to ensure the proper changes were made.

bastion@server:~# cat /etc/timezone
America/Toronto

show-timesync command

Step 3 – Turn On Time Sync

Setting your time zone is now done, but you may also wish to have your time synced with an external service like we mentioned previously. Not a problem, timedatectl, can help us with that too.
the show-timesync, and set-ntp commands will help us here.

bastion@server:~# timedatectl show-timesync

show-timesync provides you with details in regards to your current time sync configuration. You’ll want to confirm that you have servers listed under SystemNTPServers.

bastion@server:~# timedatectl set-ntp true

The set-ntp command turns time syncing with your NTP server, on.

Congratulations, you’re done! You don’t need to reboot for these changes to take effect, however, I always recommend you do so when making system changes.

WordPress Stuck in Maintenance Mode

WordPress Stuck in Maintenance Mode

This one caught me a little off guard. I was working on updating a client WordPress site this morning; it had 2 themes that we hadn’t removed that needed an update. Instead of deleting them, I chose to update them. Without thinking I clicked away to another part of of the WordPress administrator area and ended up getting stuck with the following on every load and reload of the page. I even restarted NGINX in a desire to find a quick fix.

I’ve now learned that WordPress has a built-in maintenance mode that it kicks itself into during updating of plugins and themes. We would rarely ever see a reference to it as updates typically go very quickly, and without a problem. Except when they don’t. Luckily, the WordPress developers built a very simple mechanism for driving this maintenance mode that anyone with access to the WordPress website files can access.

How To fix wordpress stuck in built-in maintenance mode

In order to fix this error you must have access to the underlying WordPress website files. You may have access to these files via File Transfer Protocol (FTP) or through your Web Hosts Control Panel.
The solution to this problem is to delete the .maintenance file from the root folder of your WordPress install, in other words, the top most directory on your web host with WordPress files.

Total Time Needed :

5

Minutes

Steps to remove .maintenance file from wordpress

Step 1 – Navigate to your WordPress Directory

Login to your Web Hosting Control Panel, FTP Client, or SSH Client and navigate to the top-most WordPress directory that is hosting your website. On my web host, my files are located at /<server_directories>/roguesecurity.ca/public_html/.

Step 2 – Delete .maintenance file

Look for a file called .maintenance (The period before the word is required). Once found, simply delete this file from the directory.
Once you delete this file, return to your web browser and clear your browser cache, and reload your website.

Congratulations. That’s it! If your website is still displaying a maintenance mode message after deleting this file, double check that you’ve cleared your browsers cache. You can also try a different browser. If it works in a different browser then we know the fix worked, and the not working browser will correct itself over time.

mapping a network drive in Windows command line

Mapped Storage

My friend Randy was always on me about using the command line more, and I’m glad that I listened to him. A command line interface (CLI) are often times so much more powerful then its graphical user interface (GUI) cousin, with less errors. I’ve leaned more towards using the command line for technical work as oppose to the GUI and that includes administration within Windows. Sometimes I’ll use the built-in CMD, and other times I’ll use PowerShell.

Mapping a network drive in Windows through the command line interface is not hard and anyone willing to take one step at a time. Without further ado, let’s dig into it.

How to Map a Network drive in windows from the command line

You may wish to map a network drive in Windows via the command line if you are having issues mapping it via the GUI, or if you prefer to take control of your setup and learn a few things while you are at it. Perhaps you’re adding a new network storage device and testing out different configurations. You’ll very likely want to single-pane view of the command line interface.

Total Time Needed :

10

Minutes

Steps to Map a network drive in windows from the command line

Step 1

In Windows search, located in the Windows Taskbar, type ‘cmd’ (without the quotes). The Command Prompt app should pop-up in the start menu. You will want to then click, Run as administrator, in order to launch the command prompt window with the appropriate privileges.

Step 2

At the command prompt, which will display a flashing white cursor when the command prompt window is selected, type in the following command to view current mapped drives.

C:\Users\User> net use

Make a note of any drive letters that are already in use. This information will be located in the Local column. You can’t map a new drive to a drive letter that is already in use. If you’d like to delete a mapping to re-use the drive letter, you can use the following command:

C:\Users\User> net use <driveLetter>: /delete

for example, the following command would delete the mapping to drive letter S.

C:\Users\Justin> net use s: /delete

Step 3(a) – Drive Mapping (no credentials)

Now we can map our network drive. You only need to select one way of mapping your drives from the 4 that I’ve outlines here, (a) through (d) below.

C:\Users\User> net use <driveLetter>: \\<path>\<to>\<network>\<share>

The below command will map a network share that is located at \\Storage\Media\Movies to a new drive with the drive letter L.

C:\Users\Justin> net use L: \\Storage\Media\Movies

Step 3(b) – drive mapping with credentials

If you configured your shared drives to required a username and password, we can modify our command by adding the /user: switch.

C:\Users\User> net use <driveLetter>: \\<path>\<to>\<network>\<share> /user:<username> <password>

The below command will map a network share that is located at \\Storage\Media\Movies to a new drive with the drive letter L, using justin as the username, and supersecurepassword1 as the password.

C:\Users\Justin> net use L: \\Storage\Media\Movies /user:justin supersecurepassword1

Step 3(c) – drive mapping with persistence

You probably don’t want to have to keep mapping or logging in to your new drive every time that you boot up your computer. That’s where the /persistence flag comes in.

C:\Users\User> net use <driveLetter>: \\<path>\<to>\<network>\<share> /persistence: {yes|no}

Here is how the Microsoft Documentation describes the /persistence flag: (It) Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next logon. No does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use /delete to remove persistent connections.

The below command will map a network share that is located at \\Storage\Media\Movies to a new drive with the drive letter L, and maintain persistency across each reboot.

C:\Users\Justin> net use L: \\Storage\Media\Movies /persistent: yes

Step 3(d) – Complete drive mapping

In a perfect world you will want to have properly credentialed shares and any user that connects will do so with their own username and password, with persistency. Here is how we bring it all together.

C:\Users\User> net use <driveLetter>: \\<path>\<to>\<network>\<share> /user:<username> <password> /persistence: {yes|no}

The below command will map a network share that is located at \\Storage\Media\Movies to a new drive with the drive letter L. The connection will use justin as the username, and supersecurepassword1 as the password. Finally, the connection will be persistent so that user, justin, won’t have to login to the drive every time they log in and out of their Windows account.

C:\Users\Justin> net use L: \\Storage\Media\Movies /user:justin supersecurepassword1 /persistent: yes

That’s it! Once you’ve completed the steps you should be presented with a success message, and have your new drive mapped in Windows.

I hope you found this how-to helpful. If you did I’d love to hear about it. Leave a comment below!

Building an Outdoor Ice Rink No Liner, for Free (Part 1)

Family Chaos Ice Rink 2021

We only moved into our home in September, but I could already imagine the awesome ice rink that we were going to build around the fire pit in our backyard. I’ve never built an outdoor rink of any kind before, but I knew that I was going to have a significantly more time on my hands. I wanted to give myself something to do, and also an outlet for the kids to burn off some energy and get some exercise. We were not able to spend a dime on this thing so a $4,000 rink kit was out of the question, so I set out to build an outdoor ice rink without a liner, and it cost us absolutely nothing!

How to build an outdoor ice rink, no liner

Over the next several steps we’ll take you through building an outdoor ice rink without using a liner. This is done in two phases, 1) we use snow to create a slushy base that will freeze and become our “liner”, and 2) Flooding it and getting it smooth. Let’s get into it.

minimum requirements

Before you start building your outdoor ice rink, you should make sure that you can meet at least the following minimum needs.

– Cold weather (At least 0°C, but preferably colder)
– Snow (Around 20cm is good)
– A reliable water source
– A safe and appropriately sized location
– Shovels
– Garden hose and Nozzle
– Patience

Steps to building an outdoor ice rink without a liner

BEFORE YOU START

You only need a few basic tools to create an outdoor ice rink and can easily save yourself up to $4,000 on backyard ice rink kits. Once you know that you meet the minimum requirements above you can go ahead and get started on Step 1 below.

1. PREPARING THE AREA

Select an area in your yard that you wish to make your ice rink and then go a little bigger. The edges are always tough without a liner and boards so you’ll end up building up the snow “boards” quite a bit
You can begin preparing your ice rink before it gets cold enough, as long as you have some snow. You can begin by compacting the area of your ice rink in any way, shape or form. You really want to have a firm base of snow to start your rink. It doesn’t have to be completely level, but it should be relatively so. Water is self-level as it pools and freezes, but you don’t want a significant difference in grade or you won’t ever get it very flat.

This is a perfect time to elevate those low areas of your rink with snow and compact it down to make as level a surface as possible. Ideally 10 – 20 cm of snow will compact down to about 1 to 2cm of snow.

2. start spraying water… slowly

Patience is key, especially in the beginning. Start the first few sprays by just waving the nozzle around the entire area so that just the very top most millimeters of snow get wet. Each time you add a layer of light sprays, the water will sink through the top layer onto the next layer until the compacted snow is frozen. Mother nature is going to do most of the work during this stage.

You are not going to have a flat, shimmery surface for a while so don’t be dreaming of that. We’re attempting to use the snow to create the ice so that we’re not using as much water. Since we’re not using a rink liner, the water doesn’t have any place to go if we add too much.

If the weather is closer to 0°C then you’ll want to wait a few hours between each spray. If you find you are losing too much snow, then ease up. The water will freeze fast with colder temperatures and you should be okay to go out every hour or so.

go low and go slow

Too much water, too quickly will melt the snow as opposed to turning it to slush for mother nature to freeze it. Until you’ve created a solid bed a ice, with no holes, you simply won’t be able to do any significant flooding (where the water pools and moves around). It really and truly is important for you to go low and go slow with the water at this point. Don’t rush it or you’ll hate yourself later when you need to be adding more snow back on to the ice to patch holes.

3. Keep It Clean; Build up Your Walls and Patch Some Holes

You’ll appreciate keeping it clean as even the smallest droplet of snow could freeze and be something to trip over. Take the time to push the snow out towards the sides of your ice rink. This gives your rink some definition, but also creates a bowl-like structure whereby water will eventually be able to collect without running off of the sides.

It’s going to be worth patching any holes or building up low areas as you go. Your future self will appreciate you. You patch holes exactly the way that you created your rink; add some snow, make it slushy and let it freeze.

Water will self-level itself so you only need to worry about creating enough slush for mother nature to freeze into a solid (without holes) piece of ice.

Stay Tuned. In Part 2, we’ll talk more about patching and flooding…