Linux Mint Programs

Notepad++

NppFTP

jEdit

Homebank

Meld

FreeFileSync

Amarok

Audacity

Unetbootin

Notepad++

NppFTP

jEdit

Homebank

Meld

FreeFileSync

Amarok

Audacity

Unetbootin

https://blog.programster.org/ubuntu-18-04-install-unetbootin
sudo add-apt-repository ppa:gezakovacs/ppa -y
sudo apt-get update
sudo apt-get install unetbootin -y
sudo add-apt-repository ppa:gezakovacs/ppa -y
sudo apt-get update
sudo apt-get install unetbootin -y

Preview function on panel icons accidentally disabled

Open System Settings in the main menu, go to Preferences, Applets, Window list, click on the gear icon on the right and in Display, enable “Show window thumbnails on hover”.

Install Metamorphose 2

This is the most advanced of all available bulk renamers. Metamorphose 2 binaries for Linux (deb and rpm) and Windows are available on SourceForge.

Because these binaries are pretty old (2011), you can grab the latest version source (which dates to August, 2015) from GitHub.

Ubuntu 15.10 and newer users can install the latest Metamorphose 2 by using the main WebUpd8 PPA:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install metamorphose2

Define a Specific Sidebar Using Custom Fields

Do you want to define the custom sidebar for specific posts by replacing the get_sidebar() function? While there can be no plugin to achieve this, we have created a quick code snippet that you can use to define a specific sidebar using custom field in WordPress.

Instructions:

All you have to do is add this code to your theme’s template file where you want to call the custom sidebar:

<?php 
$sidebar = get_post_meta($post->ID, "sidebar", true);
get_sidebar($sidebar);
?>

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 62 best free WordPress blog themes and how to set up download tracking in WordPress with Google Analytics.

Generate WordPress theme templates with Underscores Components

You might already know about Underscores, often abbreviated as _s, which is a popular starter theme for WordPress. This is a big project maintained by Automattic which is the company operating WordPress.

Recently they created another tool called Components. This is a free online theme generator built on WordPress with custom blueprints made for portfolios, business sites, and different blog themes from standard blogs to magazines.

Components is completely free to use and it’s one of the most powerful generators on the web. Why start a new theme from scratch when you can work with the proven Underscores framework?

Each theme comes with a responsive layout, pre-built menus, and Sass code along with raw CSS.

You just need to select which template you want and give it a name (for example “My Theme”). Other optional info can include the theme’s slug, the author’s name/URI, and a brief description of the theme.

But with just a theme name you can download a complete package with a basic Underscores WP theme ready to go.

Naturally you can customize all of these themes to your liking and they’re pretty simple to work with.

Some developers may prefer to work with their own codebase rather than relying on someone else’s. But if you need to get a project online fast there’s no better way to get moving than with a pre-built blueprint.

You can also find all the Components source code on GitHub along with the individual themes located by themselves. If you want a WordPress-approved theme blueprint then the Components generator is an excellent place to start.

https://www.hongkiat.com/blog/components-underscores/

How to install Ubuntu server 16.04 and the Webmin GUI

If you need to add Linux to your data center, consider giving Ubuntu server a try. Follow these steps to install Ubuntu server 16.04 and the Webmin GUI admin tool.

Chances are, you have to look to open source to power some aspect of your business. If that aspect happens to be a server in the backend of your workflow, you’re in luck because there are a number of solid choices. One such choice is Ubuntu.

Many believe Ubuntu is only a desktop distribution, but they’re wrong. Ubuntu also comes in a very powerful server flavor that is well suited to aid you in the expansion of your company’s data center.

If you’ve never installed a Linux server, you might be surprised to learn that it’s quite easy. Although some distributions do not offer a fancy GUI-based installer for their servers, even the NCURSES installers make the task simple.

I’ll walk you through the process of installing a Ubuntu server. I hit the important steps of the process and offer screenshots where necessary, so that you can have a Linux server up and running in no time. We’ll also add the Webmin admin GUI to make managing your Ubuntu server much, much easier.

For this installation, I use VirtualBox running on an Elementary OS Freya host to install a guest Ubuntu 16.04. As I mentioned, the process is completely NCURSES.

https://www.techrepublic.com/article/how-to-install-ubuntu-server-16-04-and-the-web-based-admin-tool-webmin/

How to Build A Fully Customized WordPress Login Page

Many of you, I believe, are familiar with the WordPress login page at wp-login.php. It looks nice, and works fine. But when it comes to creating a website for clients, you might want a more customized login page, so that it integrates nicely with the website design as a whole. In addition, having a customized login page could also give your clients a good impression of your skills.

If this is something that you want to achieve on your site, here’s how you can build a fully customized WordPress login page.

Custom Login Page

First, we need to create a custom page template for the login page. To do so, you can create a new page template and name it – for example – page-login.php. Then, create a new Page from the WordPress backend and set the permalink to login so that WordPress will automatically take the page-login.php template for the page.

The Login Form

Put the wp_login_form tag in the page-login.php page template to display the login form.

<?php wp_login_form(); ?>

The following is optional, but could be useful in certain cases. You can configure a few things for the login form, like specifying the redirecting of URL after the user has successfully logged in, changing the ID of the username, and the password input field.

<?php
$args = array(
'redirect' => home_url(), 
'id_username' => 'user',
'id_password' => 'pass',
) 
;?>
<?php wp_login_form( $args ); ?>

Furthermore, you can also add something aside. It could be your logo and a little description of your site, for example.

<div class="login-branding">
<a href="#" class="login-logo">Hongkiat.com</a>
<p class="login-desc">
Hongkiat.com is a design weblog dedicated to designers and bloggers. We constantly publish useful tricks, tools, tutorials and inspirational artworks.
</p>
</div>
<div class="login-form">
<?php
$args = array(
'redirect' => home_url(), 
'id_username' => 'user',
'id_password' => 'pass',
) 
;?>
<?php wp_login_form( $args ); ?>
</div>

Now, let’s make the form nicer with CSS. You can make the CSS up on your own as per your site requirements. In this example, here is how my login form looks like. It has black background, with a blue button, which fits quite well with the Hongkiat.com site theme.

Validation

At this point, the login page is already functional. We can try logging in, and if suceeded we will be redirected to the URL that we have specified in the redirect parameter above. But, there is something that we need to address.

First, the wp-login.php page is still accessible. It would be better to redirect the wp-login.php to our new login page to deliver a unified experience to our clients.

To do so, you can add the following codes in the functions.php of your theme.

function redirect_login_page() {
$login_page  = home_url( '/login/' );
$page_viewed = basename($_SERVER['REQUEST_URI']);
 
if( $page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
wp_redirect($login_page);
exit;
}
}
add_action('init','redirect_login_page');

Remember to change the $login_page variable to your own login page (thanks to Montana Flynn for the tip).

Second, the login page can work as expected when we are successfully logged in. But if an error occurs like when submiting invalid user and password combinations, or submitting an empty field, we will also be thrown away to wp-login.php. To solve this issue, add the following functions in the functions.php.

function login_failed() {
$login_page  = home_url( '/login/' );
wp_redirect( $login_page . '?login=failed' );
exit;
}
add_action( 'wp_login_failed', 'login_failed' );
 
function verify_username_password( $user, $username, $password ) {
$login_page  = home_url( '/login/' );
if( $username == "" || $password == "" ) {
wp_redirect( $login_page . "?login=empty" );
exit;
}
}
add_filter( 'authenticate', 'verify_username_password', 1, 3);

These two functions perform two tasks. They will redirect the user upon failing, and append a login query string to the URL with the value of either failed or empty.

The last problem is we will also be redirected to wp-login.php when we have logged out from the site. So, we also need to specify the redirecting URL upon logging out, like so.

function logout_page() {
$login_page  = home_url( '/login/' );
wp_redirect( $login_page . "?login=false" );
exit;
}
add_action('wp_logout','logout_page');

Error Message

We will display an error message, showing the user when the error occurred, and when they have logged out by using the query string that we have put in the URL. To get the value from the login query string above, we can use $_GET.

Put this code below in the login page template.

$login  = (isset($_GET['login']) ) ? $_GET['login'] : 0;

The above code will check whether the login variable contains value, otherwise it will set to 0. Then we will display different notification messages based on the value of $error, like so.

if ( $login === "failed" ) {
echo '<p class="login-msg"><strong>ERROR:</strong> Invalid username and/or password.</p>';
} elseif ( $login === "empty" ) {
echo '<p class="login-msg"><strong>ERROR:</strong> Username and/or Password is empty.</p>';
} elseif ( $login === "false" ) {
echo '<p class="login-msg"><strong>ERROR:</strong> You are logged out.</p>';
}

And below is what the error message looks like.

Conclusion

There are several things that we could do to improve our login page such as adding Lost Password link, Register Link, and a personalized error message. But, at this point it is now functioning well enough for our users to login and logout, and it could also be a good start to create a more advanced login page.

We hope that you find this tutorial useful.

How to Create phpinfo File and Check PHP Information

If you’re looking for a way to check your website’s PHP configuration, also known as phpinfo, you’ve come to the right place. For example, you might want to check whether your PHP configurations meet the requirements of any software you want to run on your server.

In this tutorial, we’ll show you how to create a phpinfo file and also how to check its detailed information using the tools provided in your hosting control panel. So, let’s get to it!

Checking PHP Information Using Hosting Control Panel

In this guide, we’ll be using Hostinger’s hPanel, where you can easily check your PHP information using the PHP Info tool. Once you’re logged in, scroll down and go to Advanced -> PHP Info.

You’ll then be forwarded to a page with detailed information about your current PHP version, modules, and values, etc. Scroll down to browse for more.

If you wish to find data about a specific module or function, you can use the CTRL + F (CMD + F for macOS) shortcut to open the search feature within your browser.

Checking PHP Information by Creating a phpinfo File

In case your hosting platform doesn’t offer the mentioned built-in PHP Info feature, there is no need to worry! You can reach the same goal by creating a phpinfo file in your public_html directory.

The file will be accessible via a browser and will show you the same detailed information.

You will need a way to access your public_html files. Here we’re using Hostinger’s File Manager as an example.

  1. Navigate to File Manager under the Files section in your hPanel.
  2. Once you’re in public_html directory, click the New File button.
  3. Name your file phpinfo.php and press Create.
  4. Scroll down and locate the new phpinfo file within the directory, then right-click to Edit.
  5. Now, copy and paste the following code into the text editor and press Save.
<?php phpinfo(); ?>

The same result can be achieved by using any text editor on your computer. Create the phpinfo.php file by following the same steps from before, then uploading the file to your server’s public_html folder through an FTP client.

If you don’t know how to configure or never worked with an FTP client, such as FileZilla, refer to our guide for more information.

Checking PHP Information Using a Browser

You should have a phpinfo.php file in your public_html directory by now. So, all that’s left is to access the file by adding /phpinfo.php at the end of your domain name.

You should see a similar view when the file is accessed via any browser:

Note: If you don’t want your phpinfo page to be displayed all the time, you can easily disable the file by giving it a different name. phpinfo.php_disabled, for instance.

Conclusion

There you have it! By finishing this tutorial, you’ve learned how to create a phpinfo.php file and how to check PHP information via your hosting control panel or your default browser. That was pretty easy, right?

Configuring the PHP Development Environment in Linux Ubuntu

This tutorial shows how to configure the PHP development environment in the Ubuntu operating system (7.10 and later). This involves installing and configuring the PHP engine, a MySQL database, an Apache web server, and the XDebug debugger.

his tutorial shows how to configure the PHP development environment in Ubuntu 7.04 and later. You need to:

  1. Install the Apache2 HTTP server, the PHP5 engine, the MySQL 5.0 database server, and the PHP5-MySQL module. These packages can be installed together as the LAMP stack, or they can be installed separately.
  2. Specify the Document Root for the Apache2 HTTP server
  3. Configure the MySQL database server
  4. Install and enable the XDebug 2.0 debugger

See the Ubuntu community for more information on installing Apache, MySQL, and PHP.

Installing the Software Packages Together

Ubuntu provides a Linux AMP (LAMP) package that contains all the necessary packages for your PHP environment. You can install the software by executing the following command at the command prompt in the Terminal window:

sudo tasksel install lamp-server

The lamp-server package includes the most suitable version of PHP, Apache 2, MySQL, and PHP5-MySQL.

Installing the Software Packages Separately

Instead of installing the entire set of LAMP packages, you can also install the packages individually. This is useful if you already have installed one of the components, such as the Apache server or MySQL database server. You can use command-line tools or the Synaptic Package Manager GUI.

The individual packages to install are the following:

  • apache2
  • php5
  • mysql-server
  • php5-mysql

Checking the Installation

After you set up your PHP web stack, check that it is installed correctly and that your Apache server recognizes your PHP engine.

To check that Apache and PHP are installed and running, open NetBeans IDE and create a PHP project. In the index.php file, enter the PHP method phpinfo(). Run the file. The standard PHP information page should display.

Troubleshooting

The following are some frequently encountered problems when checking the installation of your PHP stack in Ubuntu:

  • The browser window displays a Not Found error for ~USER/PROJECT/index.php. Remove the ~USER string from the URL. For example, if this error appears for the URL ~ubuntu/test1/index.php, change the URL to test1/index.php. Note that you can set the URL for a PHP project in NetBeans IDE either when you create the project, or by right-clicking the project node and going to Properties > Run Configuration.
  • The browser shows you a popup asking you to open the file, as if the PHP engine is not recognized. There’s a problem with your php5-common package. Replace it with php5 and phpmyadmin. To replace php5-common, run the following two commands:
apt-get --purge remove php5-common
 apt-get install php5 phpmyadmin

Specifying the Document Root for the Apache2 HTTP Server

The Document Root is the directory where the Apache HTTP server takes files for displaying in the browser. The Document Root is specified in the file that defines your virtual host. The default virtual host configuration file is

/etc/apache2/sites-available/default

with the document root

/var/www/

We recommend that you create your own virtual host and enable it instead of editing the default one.

Creating the Document Root Location

  1. Choose Places > Home Folder.
  2. From the context menu, choose Create Folder.
  3. Enter the name of the folder, for example, public_html.

Creating a New Virtual Host

  1. To launch the Terminal, choose Applications>Accessories>Terminal. The Terminal window opens.
  2. To copy the configuration file of the default virtual host to a new file (mysite), type the following command at the command prompt:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

3. Run the gedit application and edit the new configuration file (mysite) in it:

gksudo gedit /etc/apache2/sites-available/mysite 

If asked, enter the password that you specified for the root user during the installation of your operating system.

4. Change the Document Root to point to the new location:

/home/<user>/public_html/

5. Change the Directory directive, replace

<Directory /var/www/>

with

<Directory /home/user/public_html/>

6. Save the file mysite

Activating the New Virtual Host

  1. To deactivate the default host and activate the new host, launch the Terminal and run the following two utilities in the Terminal window: sudo a2dissite default && sudo a2ensite mysite
  2. Restart the Apache HTTP server: sudo /etc/init.d/apache2 reload

Configuring the MySQL Database Server

During the installation of the MySQL database server, a root user is created. A dialog opens during installation in which you set a root user password. If this dialog did not open, or you did not set a password in this dialog, you need to create a MySQL root user password now. You will need the password for creating other MySQL server users.

  1. To connect to the MySQL server, launch the Terminal and in the Terminal window enter the following command: mysql -u root -p The MySQL command prompt appears.
  2. At the command prompt enter the following command and press Enter: SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘<yourpassword>’); If the command is executed successfully, the following message is displayed: Query OK, 0 rows affected (0.00 sec)
https://netbeans.org/kb/docs/php/configure-php-environment-ubuntu.html

How To Put WordPress Site Into Maintenance Mode

Sometimes, you may have the need to put your website into maintenance mode for upgrades. This would make your website temporarily unavailable to public access. You wouldn’t want errors to pop up when you are running important updates in the background, right?

There are several ways of putting a website into maintenance mode, and the technical details may differ accordingly. If you are on WordPress, here are 3 ways to put your website into maintenance mode.

Using .Htaccess

If you are using the Apache server, you can use.htaccess to control access of the directories within the server, and send a response code of the server status.

To put the website into maintenance mode, you can use the 503 status code, which indicates that the server is temporarily unavailable.

Before we specify anything in .htaccess, however, we need to create a new file in.html or .php format, and add a message in the file, e.g.

Sorry we are down for maintenance, but we’ll be back up shortly.

Style your page. Next, open the .htaccess file in your server, and add the following:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=503,L]
</IfModule>

This will set the server status code to 503, while also redirects visitors to the maintenance page. You can set your IP address with the following line RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000 so that you will still be able to access your website.

WordPress Built-in Maintenance Page

When updating WordPress, plugins, or themes, you can create a file called .maintenance that says

Briefly unavailable for scheduled maintenance. Check back in a minute.

This file will be automatically removed when the process is completed – if the process fails, the file could get stuck in your server, so you have to remove it manually.

The problem is that .maintenance is not customizable, as it is generated dynamically.

So, if your emphasis is on the overall appearance of your website, you can create a file named maintenance.php, which you can customize with CSS, then put inside thewp-content folder. That way, the next time you update WordPress or plugins, WordPress will use the content inside this file.

The function is specfied in wp-includes/load.php, like so.

if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
require_once( WP_CONTENT_DIR . '/maintenance.php' );
die();
}

Using a Plugin

There are several WordPress plugins available to help put your website into maintenance mode, but my personal favorite is the Maintenance Mode plugin by Michael Wohrer. Although this plugin hasn’t been updated for about 2 years now, it still works perfectly.

Using the Maintenance Mode plugin, you can simply activate or deactivate the maintenance mode with a few clicks. You can also specify how long the website will be in maintenance mode.

In addition, this plugin comes with a default theme template to be displayed when the maintenance mode is activated. You can also use your own theme by creating a 503.php file and uploading it to your theme directory. Just go to the Maintenance Mode Setting page and select the 503.php file you have created.

Here is a sample page where I used this plugin along with a 503.php page template.

Conclusion

We hope you found this tutorial useful in helping you run your WordPress site more efficiently. For further reading on the subject, you can head over to the following sites.

https://www.hongkiat.com/blog/wordpress-maintenance/

15 Useful .htaccess Snippets for Your WordPress Site

Having a well-configured .htaccess file is crucial if you want to increase security and reduce vulnerabilities on your WordPress site. Usually, the main goal of creating a custom .htaccess file is to prevent your site from being hacked but it’s also an excellent way to handle redirects and manage cache-related tasks.

.htaccess is a configuration file used on Apache web servers. Most WordPress sites run on an Apache server, although a small portion is powered by Nginx. In this article, you can find a collection of .htaccess code snippets, most of which you can use to secure your website while the rest implements other useful features.

Don’t forget to back up the .htaccess file before you edit it so that you can always return to the previous version if something goes wrong.

And, if you’re someone who rather not touch configuration files I recommend you the BulletProof Security plugin which is the most reliable (and probably the oldest) free .htaccess security plugin on the market.

Create the default WP .htaccess

.htaccess works on a per-directory basis which means that each directory can have its own .htaccess file. It can easily happen that your WordPress site doesn’t have a .htaccess file yet. If you don’t find a .htaccess file in your root directory create an empty text file and name it to .htaccess.

Below, you can find the default .htaccess WordPress uses. Whenever you need this code you can quickly look it up in the WordPress Codex. Note that there is a different .htaccess for WP Multisite.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

The lines beginning with # are comments. Don’t edit anything between the lines # BEGIN WordPress and # END WordPress. Add your custom .htaccess rules below these default rules.

All code snippets you can find in this article go to the core .htaccess file found in your root directory.

1. Deny access to all .htaccess files

The code below denies access to all .htaccess files you have installed in your WordPress. This way you can prevent people from seeing your web server configurations.

# Denies access to all .htaccess files
<Files ~ "^.*\.([Hh][Tt][Aa])">
Order Allow,Deny
Deny from all
Satisfy all
</Files>

2. Protect your WP configuration

The wp-config.php file contains all your WP configurations, including your database login and password. You can either deny it from everyone or give permission to admins to access it.

If you choose the latter comment out the # Allow from xx.xx.xx.xxx line (remove # from the beginning of the line) and insert the admin’s IP address in place of xx.xx.xx.xxx.

# Protects wp-config
<Files wp-config.php>
Order Allow,Deny
# Allow from xx.xx.xx.xxx
# Allow from yy.yy.yy.yyy
Deny from all
</Files>

3. Prevent XML-RPC DDoS attack

WordPress supports XML-RPC by default, which is an interface that makes remote publishing possible. However, while it’s a great feature, it’s also one of WP’s biggest security vulnerability as hackers may exploit it for DDoS attacks.

If you don’t want to use this feature it’s better to just disable it. Just like before, you can add exceptions by commenting out the # Allow from xx.xx.xx.xxx line and adding the IPs of your admin(s).

# Protects XML-RPC, prevents DDoS attack
<FilesMatch "^(xmlrpc\.php)">
Order Deny,Allow
# Allow from xx.xx.xx.xxx
# Allow from yy.yy.yy.yyy
Deny from all
</FilesMatch>

4. Protect your admin area

It’s also a good idea to protect the admin area by giving access only to administrators. Here, don’t forget to add at least one “Allow” exception otherwise you won’t be able to access your admin at all.

# Protects admin area by IP
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
<LIMIT GET>
Order Deny,Allow
Deny from all
Allow from xx.xx.xx.xxx
Allow from yy.yy.yy.yyy
</LIMIT>

5. Prevent directory listing

Most WordPress sites don’t disable directory listing, which means anyone can browse their folders and files, including media uploads and plugin files. It’s needless to say that this is a huge security vulnerability.

Below, you can see how a typical WordPress directory listing looks like.

Luckily, you just need one line of code to block this feature. This code snippet will return a 403 error message to anyone who wants to access your directories.

# Prevents directory listing
Options -Indexes

6. Prevent username enumeration

If WP permalinks are enabled, it’s quite easy to enumerate usernames using the author archives. The revealed usernames (including the admin’s username) then can be used in brute force attacks.

Insert the code below into your .htaccess file to prevent username enumeration.

# Prevents username  enumeration
RewriteCond %{QUERY_STRING} author=d
RewriteRule ^ /? [L,R=301]

….

https://www.hongkiat.com/blog/useful-htaccess-snippets-for-wordpress/