Link: Install And Learn How To Use ufw Firewall In Linux

Ubuntu does not have many open ports by default, but there are times when you want to restrict access to a port(ports) or a specific ip adress. Maybe you run a ssh server in your ubuntu machine and want to block everyone from connecting to it, except yourself. Have you ever thought how to accomplish such things or tried to do it? You need a firewall to do that. In this article I will explain what is a firewall and teach you how to use the ufw ubuntu firewall by giving real world examples of it.

Full article here:
Install And Learn How To Use ufw Firewall In Linux (LinOxide)

How to run a program every time a user logs in to Linux (and where the startup configuration files are stored)

Sometimes new Linux users want to know how to run a particular command or shell script every time a user logs in (which also implies that if it’s a single-user system, this could be a command that runs when the system starts). In Ubuntu and its many variants, you can simply place the startup command in Ubuntu’s Startup Applications Preferences, as we demonstrated in the article, Enabling a SOCKS proxy via SSH tunnel in Ubuntu or Mac OS X at startup.

Ubuntu Startup Applications Preferences - adding SOCKS proxy
Ubuntu Startup Applications Preferences – adding SOCKS proxy

However, you may be on a variant of Linux that doesn’t have a Startup Applications Preferences program, or maybe you simply want to add something from the command prompt. Or maybe you want to tweak an existing startup command to do something different. The key to this is that the startup configuration files for each user are stored in the ~/.config/autostart directory (where ~ is the user’s home directory). The actual format of the files may differ between different variants of Linux, and some versions may not utilize them at all, but if that directory exists on your system, that’s probably where they are stored. There are also system-wide autostart files; those are found in the /etc/xdg/autostart directory, at least on Ubuntu-based systems.

For example, referring back to the command to activate a SOCKS proxy when Ubuntu starts (the first example in the article referenced above), what happens when you create that command in the Startup Applications Preferences is that it creates a file named ~/.config/autostart/screen.desktop (the filename will be different for each autostart command), which in turn contains the actual script that’s run at startup (similar to this example):

[Desktop Entry]
Type=Application
Exec=screen -dmS tunnel ssh username@server_address -D local_socks_proxy_port
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=SSH Tunnel
Name=SSH Tunnel
Comment[en_US]=SSH SOCKS proxy tunnel
Comment=SSH SOCKS proxy tunnel

The startup scripts can contain much more than just this. When you install certain programs that autostart, they will write considerably more complicated configurations. In Ubuntu, you can take a look at the /etc/xdg/autostart/update-notifier.desktop file as an example of a more complex configuration file.

Possibly the best way to figure out the format of these files is to take a look at several of them in the directories mentioned above, since they may well differ to some degree in different versions of Linux. There are other ways to start programs at startup in Linux, but they may run at system startup before a user has logged in, or they may only execute if a user logs in using a terminal session, but not when they bring up a desktop session. The method shown here is supposed to work no matter how a user logs into the system. And, it can sometimes be useful to know where Linux stores its configurations.

Link: Securing Your Asterisk VoIP Server with IPTables

Now that you have set up your personal Asterisk® server, it’s time to secure it. I can’t overstate the importance of this step. Without it, you could be leaving your server’s VoIP and SSH ports open for anyone on the Internet, which is a very bad idea and may cost you a lot of money.

Full article here:
Securing Your Asterisk VoIP Server with IPTables (Lin’s Tech Blog)

Link: Understanding the Linux df And du Commands

Although it is possible to get information about disk usage from within the various Linux desktops, those who are comfortable with the command line can get much greater detail using the df and du commands. With these two commands, not only can you discover details about the free space on the mounted file systems, but you can also see the amount of space used by individual directories.

Full article here:
Understanding the Linux df And du Commands (Make Tech Easier)

Link: 30 Linux TOP Command Examples With Screenshots

The top command in Linux displays the running processes on the system. One of the most important tools for a system administrator. It is used extensively for monitoring the load on a server. In this article, we explore the top command in detail. The top command is an interactive command. Many commands are available when top is running. We will explore these commands as well.

Full article here:
Unbelievable ! 30 Linux TOP Command Examples With Screenshots (LinOxide)

Link: How to remote control Raspberry Pi

Once you have a fully working Raspberry Pi system, it may not be convenient for you to continue to access Raspberry Pi directly via a keyboard and HDMI/TV cable connector dedicated to Raspberry Pi. Instead, you will want to remote control “headless” Raspberry Pi from another computer.

In this tutorial, I will show you how to remote control your Raspberry Pi in several different ways. Here I assume that you are running Raspbian on your Raspberry Pi. Also, note that you are not required to run desktop on Raspbian when trying any of the methods presented in this tutorial.

Actually that last quoted line does not appear to be quite correct — the first three methods shown don’t require a desktop, but the fourth involves using VNC, which pretty much assumes a desktop will be present. And if were were considering using VNC, we might also want to consider Nomachine NX, which can support multiple simultaneous sessions that each have a separate, independent desktop, and is also faster than VNC in some situations. Although, we’ve never tried installing it on a Raspberry Pi.

Also, some or all of these tips may be useful for controlling Linux remotely regardless of the actual hardware that is in use — in other words, these are by no means exclusive to the Raspberry Pi.

Full article here:
How to remote control Raspberry Pi (Xmodulo)

Link: Do More, Faster In The Linux Terminal With Midnight Commander

This is the program we always install first in any new Linux-based installation, and if for some reason we can’t install it, that system tends to get blown away and replaced by a different version of Linux (or whatever) almost immediately. Not being able to install Midnight Commander is kind of a deal-breaker around here.

File browsing in a Linux terminal is alright, but it could be so much better. Midnight Commander is the program you’re looking for –  it gives you a two-paned file browser that makes working in the terminal so much easier. And the best part? It’s simple to get and use.

Full article here:
Do More, Faster In The Linux Terminal With Midnight Commander (MakeUseOf)

We’ll just add that even some Mac OS X users are apparently lost without Midnight Commander, since an older article on installing it under OS X is still one of the most popular on this site, even though for day-to-day use, we would think that most OS X users would be happier with the more recent versions of XtraFinder, which now includes dual pane functionality (and it’s free!). As for Windows users, there is always the venerable Total Commander.

How to make FreePBX and other Asterisk-based systems send voicemails and notifications to two or more email addresses

FreePBX and Asterisk do not allow you to send voicemails and notifications to multiple email addresses. But, there is a way to do it. Here are the simple steps:

  1. From a Linux command prompt, open the file /etc/aliases in your favorite text editor. Add a line to the end of that file, using a descriptive name that should not duplicate any of the names already in this file, nor the username of any users on the system. The line should look like this (this is just an example, obviously):
    foo: user1@gmail.com,user2@gmail.com
    Where foo can be replaced with any alias name you like that does not duplicate an existing alias or username.  You can add as many email addresses as you need, but they should be separated only by commas, and NO spaces other than the one between the alias name and the first email address.
  2. From the Linux command prompt, run the command newaliases and make sure that no errors are reported (you should not see any output at all).
  3. If you are running raw Asterisk, then wherever you would normally use a single email address, you can now use the alias name @localhost, for example, foo@localhost.
  4. If you are using an old version of FreePBX then it may not allow you to use addresses ending in @localhost. In that case, from the Linux command prompt run the command hostname -f and then use the result of that in place of localhost in step 3.
  5. You can repeat these steps as needed to create additional aliases for different users on your system.  You might want to use meaningful alias names, for example mikevm to send Mike’s voicemails to multiple addresses.
  6. Don’t forget that if you are only sending voicemail notifications, and not the entire voicemail as an attachment, that many wireless companies have SMS gateway addresses that you can send an email to, that will convert the first 140 characters of the email to an SMS text message.  You can find a list of email address formats to use for this purpose in this article:  How To Send Email To Any Cell Phone (for Free)
  7. This technique is not limited to Asterisk and FreePBX; it should provide a solution for any software that can’t seem to deal with more than one email address at a time.

Link: 25+ Awesome Linux/Unix command chaining examples

Today we will learn how to use different command chaining operators available for us in an easy way.

Command chaining operators

& –Sends process background (so we can run multiple process parallel)
; –Run multiple commands in one run, sequentially.
\ –To type larger command in multiple lines
&& –Logical AND operator
|| –Logical OR operator
! -NOT operator …
| — PIPE operator
{} –Command combination operator.
() –Precedence operator

Full article here:
25+ Awesome Linux/Unix command chaining examples (The Linux Juggernaut)