install fail2ban

fail2ban is a Python script that help you to protected against brute force

Install : apt-get install fail2ban

some config … before all you should create a copy from fail2ban config file
cd /etc/fail2ban
cp -r jail.conf jail.local
now we can change the jail.local

for sending email set destemail as your email .
change action to action = %(action_mwl)s
add below code at the end of file

[ssh]
enabled = true
port = ssh,some_port
filter = sshd
logpath = /var/log/auth.log
maxretry = 2
bantime = 10m

After that restart fail2ban service
service fail2ban stop
service fail2ban start

now you should check the inbox or span folder for an email from fail2ban.also, you can check the banned ip by
fail2ban-client status sshd
for more detail you can check this article

Linux send an email after login

It is a security concept that you know when a user (almost root user) loge in.

For this do like below

Add a shell script to send email

cd etc/ssh/

nano login-notify.sh and add below code

You should change sender and recepient

After that we should change file permission
chmod a+w login-notify.sh
and for testing sh login-notify.sh
Please check your email (inbox and spam folder).

nano /etc/pam.d/sshd And add this line at the end of file (use Alt and / to go to the end)

session optional pam_exec.so seteuid /path/to/login-notify.sh

All thing is ready but be careful, Please use another terminal to connect to your server and do not close your current connection.

find and change all permission

To find and change founded file or directory permission I use beloved command

“find” : find command

“.” : directory and “.” is current directory

“-type” : type the file that we want to search is “d” is directory and “f” is file

“-exec” : executing next commend

“chmod”: command for change permission

“755 or 644 ” : permission of file or folder

linux download stream video

If you need to download some video from YouTube or another website that you can just play and watch video without download it, you can use XDM app for do this.

This application with a chrome extension can help you get download link.
For install you tow way
1 : use repositories

And second way is download source file and install

Go to thin link and download tar file
cd extracted folder and run this command sudo ./install.sh

Phpstorm indexes is very slow

Phpstorm is very slow even with SSD hard. The least week I change my HDD hard to SSD and update my Ubuntu to 16 but I don not see any change to Phpstorm indexing time. after many searches I found solution. I remove some directories from indexes sequence.

Create block and pass data from XML layouts

For first create block PHP under Vendor/Module/Block1

Code should be like bellow

after create block you need pass some data to block. I wanna use XML for this

You can use this XML code on any layout like default.xml.

I hope this post helped you

Setup php7.2 for magento 2.3

after migrate to magento 2.3 from magento 1.8 our company need to upgrade linux os php’s

We need to install PHP 7.2 but my OS (ubuntu16.04 ) does not support that. then we have to use repository .

First add this repository.

open terminal (alt ctrl t) and add this line

after press inter you should update

Now our os is ready for install php 7.2

Restart Apache service and enjoy from you magento 2.3

for install php extension that are required for magento do like this

List of required extension

PDO/MySQL
mbstring
mcrypt
mhash
simplexml
curl
gd2, ImageMagick 6.3.7 (or later) or both
soap
bcmath
zip
intl