Installing and Configuring SNMPD + MRTG

MRTG (Multi Router Traffic Grapher) – a tool for displaying various data in graphs.

The installation command in Ubuntu/Debian:

sudo apt-get install mrtg snmp snmpd

In CentOS:

yum install mrtg net-snmp net-snmp-utils

The command below can tell you which additional modules are in the repository:

apt-cache search mrtg

Open the configuration file /etc/snmp/snmpd.conf

sudo nano /etc/snmp/snmpd.conf

Comment on the line:

com2sec paranoid default public

And uncomment the line:

com2sec readonly default public

Restart snmpd so that changes to the configuration file take effect:

sudo /etc/init.d/snmpd restart

You can check snmp by commands:

netstat -nlp | grep snmpd
snmpwalk -v2с -c public localhost

Beginners can generate a simple configuration file with the command:

sudo cfgmaker public@localhost >> /etc/mrtg.cfg

where public is the name of the community (the password is in other words), and localhost is the host address or ip.

Example of starting the configuration file /etc/mrtg.cfg:

WorkDir: /var/www/mrtg
Options[_]: growright, bits, nobanner
Background[_]: #B0C4DE
EnableIPv6: no
Language: russian
EnableSnmpV3: no
Interval: 10
Refresh: 600
Include: /etc/mrtg/server1.cfg
Include: /etc/mrtg/server2.cfg

Create the working directory:

sudo mkdir /var/www/mrtg

Then you must write or generate the index.html file with the command:

sudo indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html

We look at the log /var/log/mrtg.log so that there are no errors.

Here is an example of setting up SNMP on D-Link switches:

private CommunityView Read Write
public CommunityView Read Only

Example of a manual start script (mrtg.sh):

#!/bin/bash
#run mrtg
LANG=C
export $LANG
/usr/bin/mrtg /etc/mrtg.cfg --logging /var/log/mrtg.log

IPTables rules for Samba

To open access to Samba in IPTables, you must add four rules at once:

sudo iptables -A INPUT -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT

To only allow access to a particular network, for example 192.168.1.0/24:

sudo iptables -A INPUT -s 192.168.1.0/24 -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -A INPUT -s 192.168.1.0/24 -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 445 -j ACCEPT

To remove a rule, we’ll specify the same command, replacing -A with -D, for example:

sudo iptables -D INPUT -s 192.168.1.0/24 -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -D INPUT -s 192.168.1.0/24 -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -D INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -D INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 445 -j ACCEPT

To view the list of rules, use the command:

sudo iptables -nvL

See also my articles:
Configuring IPTables
Installing and Configuring Samba on Linux

How to schedule shutdown Windows

There are several ways to schedule a Windows shutdown.

1) You can execute the command shown below in the “Run” window (it can also be opened with the WIN+R keys), also on the command line or the PowerShell, for all variants the command is the same:

shutdown –s –t 3600

Where 3600 is the number of seconds after which Windows will shut down and the computer will shut down.
3600 seconds = 1 hour.

Similarly, you can put the computer into hibernation mode if it is available:

shutdown –h –t 3600

To cancel a command, you must:

shutdown /a

2) The second way is to create a simple task in the task scheduler.
Open the Control Panel\System and Security\Administration\Task Scheduler.
Click “Create a simple task …”.
Enter any name for the new task, for example, “Shutdown.”
In the next window, select “Once.”
In the next window, we indicate the time when we need to complete the task.
In the next window, select “Run the program.”
In the line “Program or script:” we indicate the program:

C:\Windows\System32\shutdown.exe

and in the line “Add arguments (optional):” -s
Create a task.

Similarly, you can create a task such as sleep mode by entering “Program or script:” in the line:

C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Sleep

If you want to delete it, in the Task Scheduler window on the left click “Job Scheduler Library” and clicking the right button on the desired task, click “Delete”.

See also my article – Enable or disable Hibernate mode in Windows

Lenovo A3000 Hard Reset

On the test I will use Lenovo A3000-H.

Let’s get started. Turn off the tablet if it is possible, if not, we still press and hold the power key and the volume up key at the same time until the following menu appears:

Recovery Mode
Fastboot Mode
Normal Mode

Press the volume up key to select the desired mode, and go to the volume down key. In our case, let’s move on to Recovery Mode.

There was a robot, we put the power button on and another menu will appear. In it, on the contrary, by the sound reduction button we select the necessary operation, and the magnifications will be performed by it.
First we choose and execute “wipe cache partition“, later “wipe data/factory reset” and at the end we execute “reboot system now“, the device will reboot with standard settings and without user data.

Done.

Installing and Configuring PostgreSQL in Ubuntu

The installation command in Ubuntu:

sudo apt-get install postgresql postgresql-client postgresql-contrib

You can install a graphical client for easy management:

sudo apt-get install pgadmin3

or

sudo apt-get install phppgadmin

To access from outside, open the configuration file (Ctrl + X to exit):

sudo nano /etc/postgresql/9.3/main/postgresql.conf

And uncomment the line:

listen_addresses = 'localhost'

In the pg_hba.conf file, we specify which addresses are allowed access:

host all all 192.168.0.1/32 md5

Restart PostgreSQL so that the changes to the configuration files take effect:

sudo service postgresql restart

Here is the password for the postgres user:

sudo -u postgres psql
ALTER USER postgres with encrypted password 'PASSWORD';
CTRL+Z

An example of testing a connection from a remote computer:

psql -h СЕРВЕР -U postgres -W

If PostgreSQL is to be used with Apache2, then we’ll install the other components:

sudo apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-gd php5-pgsql

Solution of the error “Using unique option prefix pass instead of password is deprecated …”

I noticed some errors coming to the root mail with the subject and the text:

Cron /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.

The problem lies in the file ~ / .my.cnf, that is /root/.my.cnf in my case.

In which the parameter “pass” is obsolete and must be changed to a new “password”.

For example, that’s how it was when the error occurred:

[client]
user=root
pass=password

Changed to password and the error disappeared:

[client]
user=root
password=password

See also:
Connecting to MySQL from localhost without entering a password

How to make a bootable USB flash drive with CentOS

I will describe the actions that must be performed to make a bootable USB flash drive with CentOS:

1) Download the image of CentOS (namely LiveCD, looking for it usually under the buttons in “via Torrent”) from the official site
https://www.centos.org/download/
Old versions can be downloaded for example here (in isos folders)
http://vault.centos.org

2) Download Universal USB Installer
pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
files.ixnfo.com/Soft/Universal-USB-Installer-2.0.1.4.zip

3) We connect the USB flash drive to the computer and run the Universal USB Installer. In it, we agree with the license agreement by clicking “I Agree“, in the second window where:
Step 1:” choose “CentOS“,
Step 2” click “Browse” and point to the downloaded iso-image CentOS.
Step 3:” select the letter of the flash drive, tick the “Format” (this will re-partition the file system table and erase all the data on the USB flash drive).

4) Click “Create” and we are waiting for the completion of the process.

How to delete an Instagram account

It took somehow to delete the account in Instagram.
I went to Instagram with a login and password, clicked on the right at the top of the account name, then chose “EDIT PROFILE” and at the very bottom there was a link “Temporarily block my account”, which does not delete, but only blocks it with the possibility of recovery in the future, here’s a direct link to the lock
https://www.instagram.com/accounts/remove/request/temporary/

But you do not need to block it, but completely delete it, so you can find the link to delete below in the “CONFIDENTIALITY”. Go to which you need to specify the reason for the deletion and confirm the deletion.
Actually here is a direct link to delete the account in Instagram so do not search – https://www.instagram.com/accounts/remove/request/permanent/