Whitelisting IP Address in AWS Console

Go to EC2 Instance > Security Group > Select the group name that want to edit > click action > edit Inbound Rule > Click Add Rule

fill the type ‘all-tcp’ > then fill the IP Address, (public IP range, for example your IP address 139.228.23.12 change it to 139.228.23.0/24 or simply add 139.228.23.12/32 as the console suggested)

Advertisements

Common SSH Commands

I use terminal in OSX so the command may follow unix commands

Copy a file to target directory

cp -t /destination/directory/ file1

Copy multiple files to target directory

cp -t /destination/directory/ file1 file2 file3

Rename file/directory

mv dirname/ newdirname/

Move file/directory

mv dirname/ otherfolder/dirname/

Remove file/directory

rm a_file

Remove a directory and its files

rm -rf somedir/

-r “recursive” -f “force” (suppress confirmation messages), be careful!

Compress file/directory

zip -r thedir_name.zip thedir/

Decompress a compressed file

unzip thedir_name.zip

List files within directory

ls

List files and its details

ls -l

List file size within directory

du sh *

Show file size in Mb

du -msh file.php

Change owner file/dir

chown theuser thefile.php

Change owner and the group at once files/directory

chown theuser:thegroup thefile.php

chown -R theuser:thegroup path/to/dir/

sometimes need to add sudo

Download a zip file from url 

wget http://url.com//thefile.zip

Fix admin-ajax.php 403 Error

Got weird error this morning in my Console tab:

admin-ajax.php Failed to load resource: the server responded with a status of 403 (Forbidden)

and this in the Network tab

admin-ajax.php error in network tab

admin-ajax.php error in network tab

Checked the files on the wp-admin folder, the file is there.

Checked the permission is correct, 0644

Then I realize earlier the host provider put a post block on the site, that may be the cause. Something like this in the .htaccess

<Limit POST>
order deny,allow
deny from all
allow from 127.0.0.1
</Limit>

I suppose that preventing the unregistered IP being blocked to accessing wp-admin/admin-ajax.php files that sometimes needed by the themes.

Then I put this after the post block line:

<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>

to ignore admin-ajax.php for being blocked

The issue is now gone 😗, lets check if this trick will face any other issue in the future.

Pengalaman beli laptop di Blibli.com

Tulisan ini dibuat sebagai sharing pengalaman ane membeli laptop di situs Blibli.com.

Laptop yang ane idamkan adalah Acer E5-465G dengan range harga dibawah 7-juta dengan spek inti yang ane butuhkan sbb:

RAM: 4GB, HDD: 1TB, VGA: geforce 920mx or diatasnya

Setelah cek harga di berbagai situs seperti Bhinneka, Tokped, dan Bukalapak ternyata di Blibli lah yg paling murah, gratis ongkir pula 😳 waktu itu harganya 6.799.000 beberapa ratus ribu lebih murah dari situs sebelah. Tanpa pikir panjang ane pun transaksi untuk purchase ini laptop di tanggal 5 September 2017.

Disinilah masalah mulai bermunculan 🤔 Continue reading

SSH Command to See Files or Directories Size 

I use OSX for working so this SSH command should be working with OSX’s terminal.

To show a directory size:

du -sh thedir

Which s stand for summary and h is human readable format, Don’t forget to change ‘thedir’ to directory you wish to see the size, for example we try to check index.html file size. It will show a result like this: Continue reading

Hardening Wordpress Site

I’ll write the most common things to do to harden our WordPress site Based on my experience on handling hacked sites.

  • Keep themes, plugins, and core update

Better delete unused themes and plugins if any, we can put a setting to let the WordPress update automatically, just add this code in your wp-config.php file :

Auto update WordPress core:
define( 'WP_AUTO_UPDATE_CORE', true );

And in your theme’s functions.php:

Auto update plugins:
add_filter( 'auto_update_plugin', '__return_true' );

Continue reading