Sunday, 28 August 2016

Linux Tips & Tricks:

Linux Tips & Tricks:
Surviving systemd - "Where the hell are my logs?!"

At some point even casual Linux users are going to want to have a look at their system logs for one reason or another. It's an important part of many diagnostic processes. However, most of the how to's out there on the Internet are geared towards using the UNIX style system logs that Linux used for decades until it was struck with the plague that is systemd. If your system uses systemd, and these days nearly all do, then all of your nice, easily readable and grep'able text logs are gone! What to do. Well, those logs have nearly all been replaced by a binary journal that systemd keeps in a database. To access them you'll need to learn to use journalctl which is systemd's front end to the log database. Here's a nice tutorial to get you started on the basics of using it.
For the impatient, you can type the following to see what's been logged since yesterday. Be prepared for a deluge.
From a root shell:
journalctl --since yesterday
(Note the ^ double dash)


#Linux   #systemd   #Logs   #sysadmin  
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs

Monday, 22 August 2016

Linux Tips & Tricks - Bash shell pitfalls

Linux Tips & Tricks - Bash shell pitfalls

In my ongoing quest to get people to either start using the command line, or use it more effectively, here's a great little resource for using the most common Linux command shell.

#sysadmin #Linux #CommandLine #bash

Via Carlos F. Lange​
http://mywiki.wooledge.org/BashPitfalls

Monday, 25 July 2016

Split terminal windows with Terminator for Linux

Split terminal windows with Terminator for Linux

While I personally prefer a tabbed style terminal emulator, I can see the appeal of this setup, especially if you live in the CLI.

NOTE to OpenSUSE users
If you are using Leap 42.1 or higher, ignore the instructions at the link and just type "zypper in terminator" from a root shell, or find the terminator package in YaST2's software manager.

#Linux   #CommandLine  
http://www.linuxandubuntu.com/home/terminator-a-linux-terminal-emulator-with-multiple-terminals-in-one-window

Wednesday, 29 June 2016

Permanently mounting a Windows share from Linux

Permanently mounting a Windows share from Linux

If you're like most Linux users, you work in a mixed platform environment that likely includes Windows systems. Linux is quite capable of interacting with Windows systems and mounting Windows network shares on the fly. However, if you want to setup a particular Windows share to be always mounted at boot, here's a basic, generic tutorial. Keep in mind that this is a simple tutorial based on command line file editing that should work on most Linux systems. Please note that many Linux distributions have their own, often simpler, methods of performing this task so be sure to RTFM before using this method.

#Linux   #Windows   #SAMBA   #CIFS   #Networking  
http://www.techrepublic.com/article/how-to-permanently-mount-a-windows-share-on-linux/

Sunday, 26 June 2016

Linux Terminal access via web browser

Linux Terminal access via web browser

This is a program that could really be handy for some folks, especially sysadmins who do a lot of remote administration.
http://www.tecmint.com/access-linux-server-terminal-in-web-browser-using-wetty/

Thursday, 16 June 2016

Linux sysadmin skills - too much time on your hands

Linux sysadmin skills - too much time on your hands

We don't often think about it, but having the correct time on our systems is critical. From small errors, to big fails, to security breaches, managing time securely is a critical sysadmin skill.

For years I've been in the habit of typing the following whenever I login to a system I'm working on. From a root prompt:
ntpdate -u pool.ntp.org
Actually, I usually use time.nrc.ca for servers in Canada and tick.usno.navy.mil for US systems but pool.ntp.org is a public time server pool that will work well for anyone, anywhere.
I follow that command with this one.
hwclock --systohc
(that's two dashes)

The first command reaches out to one of the official time servers on the Internet and uses it to set the local system clock to match. The -u just assures that it will work even if the system is already running a time daemon.
The second command takes the newly atomic clock accurate system clock time and stores it in the computer's hardware clock, assuring that they are in sync and that the system will still have an accurate clock upon reboot.
These two commands are something you can type into your system any time you want to update it's clock. It wouldn't hurt for regular home users to type them once a week.
Why not a script you ask? Good question. For two reasons.
The first reason is diagnostic. when you type the first command you'll get output like shown.
# ntpdate -u time.nrc.ca
16 Jun 14:53:21 ntpdate[16201]: adjust time server 132.246.11.238 offset 0.007741 sec

You can see that the command returns some information including the newly set time, the server IP used, and how far off your system clock was. In this case you can see that my clock was very close to correct, probably closer than the fine grained accuracy of the hardware clock. What this tells me is that my system is keeping time correctly and that there are likely no problems with the system timing or the hardware clock.
If there were an offset of minutes or more then you may want to start some system diagnostics, starting with your motherboard's CMOS battery.

The second reason not to put this into a script is that on most modern Linux/UNIX distributions, there is already a system in place to automate this. You'll need to look at using that system and this article is a start on how to do it securely.
Another thing that I do on most networks is to designate one or two servers as local time servers. The rest of the computers on the network use one of those two, setup as primary and backup, time servers to set their clocks. The reason for doing it this way it to be polite and reduce the load on the public time servers, and also to reduce your own network bandwidth usage and security risks.

The linked article covers using ntpd in more depth and with a focus on security as the ntp protocol is often a vector of attack.

#Linux   #Unix   #NTP #Time  
http://www.linux-server-security.com/linux_servers_howtos/linux_ntp_time_servers.html

Learning Linux -Make your own motion detecting security camera with "motion"

Learning Linux -Make your own motion detecting security camera with "motion"

I've covered motion before, but it's a powerful and complex piece of software so configuring it can be confusing at first. Plus there are many different ways to use it so I'm happy to link any tutorials I find.

Motion is simply software motion detection that can turn any Linux supported webcam into a sophisticated security system. Configuring it properly will lead to optimal results with better detection and fewer false positives.

This article is geared toward Ubuntu but it will be similar for any Linux without training wheels too.

#Linux   #Security   #MotionDetection   #Webcam  
https://www.howtoforge.com/tutorial/motion-detection-on-linux/