cli

There are two ways to make this happen. The first is using the semicolon like so: sudo apt-get update; sudo apt-get upgrade -y  The only problem with that method is that the second command will run, even if the first command fails. In those cases, you'd run the command: sudo apt-get update && sudo apt-get upgrade -y Both versions of the command will run, but the second form will only run...

Read More
phpmyadmin

  Edit file /usr/share/phpmyadmin/libraries/sql.lib.php using this command: sudo nano +613 /usr/share/phpmyadmin/libraries/sql.lib.php On line 613 the count function always evaluates to true since there is no closing parenthesis after $analyzed_sql_results['select_expr']. Making the below replacements resolves this, then you will need to delete the last closing parenthesis on line 614, as it's now an extra parenthesis. Replace: ((empty($analyzed_sql_results['select_expr'])) || (count($analyzed_sql_results['select_expr'] == 1) ...

Read More
phpmyadmin

MySQL 5.7 and above Creating a Superuser for phpMyAdmin In terminal, log in to MySQL as root. sudo mysql -p -u root CREATE USER 'pmauser'@'localhost' IDENTIFIED BY 'password_here'; Now we will grant superuser privilege to our new user pmauser. GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'localhost' WITH GRANT OPTION; You should now be able to access phpMyAdmin using this new user account....

Read More
cli

Login to your server as root. As the root user, edit the sshd_config file found in /etc/ssh/sshd_config: vi /etc/ssh/sshd_config Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there. PermitRootLogin yes Save and exit the file. Restart the SSH server: systemctl restart sshd or service sshd restart  ...

Read More
cli

Let’s take an plain text file, input.txt, that looks like this PATTERN-1 First line of unimportant text Second line of unimportant text PATTERN-2 Some more texts (may/ mayn't be important!) We want to delete some of the lines from the file using the command line stream editor, sed. 1. Use the following command to delete the lines lying between PATTERN-1 and PATTERN-2 , excluding the lines containing these patterns: sed '/PATTERN-1/,/PATTERN-2/{//!d}' input.txt If you...

Read More
cli

Here are two ways to delete the blank lines in a text file opened with vim: 1. Delete all the blank lines with NO white spaces other than new lines: :g/^$/d 2. Delete the blank lines containing any type of white spaces: :g/^\s*$/d BONUS: Remove only multi blank lines (reduce them to a single blank line) and leaving single blank lines intact: :g/^\_$\n\_^$/d Reference: Stack Overflow....

Read More
apache2

Server version: Apache/2.4.6 As per the documentation at [1], "In 2.4.5 and later, SSLProxyCheckPeerCN has been superseded by SSLProxyCheckPeerName, and its setting is only taken into account when SSLProxyCheckPeerName off is specified at the same time." So adding following entry did the trick: SSLProxyCheckPeerName off So my working config looks like...

Read More
linux

Source: https://www.marksei.com/linux-users-groups-tutorial/ User basics Linux Users are users of the system, they can be either used by a human or they can be used by a software such as a web server or a database. The latter are also known as system users. There is no clear way to tell the difference between a system user and a human user, the former tend to have names associated...

Read More
apache2

Disable directory listing on Apache; but access to individual files should be allowed. If you are using Debian/Ubuntu, just go to terminal and type sudo a2dismod autoindex sudo service apache2 restart If you are using Centos/Fedora, just do: mv /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/autoindex.bkp /etc/init.d/httpd restart # sudo a2dismod autoindex WARNING: The following essential module will be disabled. This might result in unexpected behavior and should NOT be done unless you know exactly what you are doing! autoindex To continue...

Read More