How to fix “Sorry, you are not allowed to access this page.”

Using WP-CLI

If you see an empty ROLES then it is

wp user list
+----+------------+--------------+--------------------------------+---------------------+---------------+
| ID | user_login | display_name | user_email            | user_registered                | roles |
+----+------------+--------------+--------------------------------+---------------------+---------------+
| 1  | admin1     | admin1           | [email protected] | 2018-06-19 17:00:02 |         |
+----+------------+--------------+--------------------------------+---------------------+---------------+

So add admin right for this user:

wp user set-role 1 administrator

Check it, should be good now:

wp user list
+----+------------+--------------+--------------------------------+---------------------+---------------+
| ID | user_login | display_name | user_email            | user_registered                | roles |
+----+------------+--------------+--------------------------------+---------------------+---------------+
| 1  | admin1     | admin1           | [email protected]
Read the rest

How to create a file of specific size using Linux command line

Reduce size using truncate command

Run for a second:

yes "some text" > testfile.txt

Reduce size using truncate:

truncate -s 50M testfile.txt

Create 50M file using fallocate command

fallocate -l 52428800 testfile.txt

To be more exact using inline arithmetic:

fallocate -l $((50*1024*1024)) testfile.txt
Read the rest

How to change firefox default tab size and fix wonky tab behavior

Under your profile folder create a chrome/ folder

cd /home/`whoami`/.mozilla/firefox/*default*
mkdir chrome
cd chrome

Create userChrome.css file

touch userChrome.css

Update userChrome.css with the following lines:

@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
.tabbrowser-tab:not([pinned]) {
max-width: 80px !important;
}
.tabbrowser-tab:not([pinned]):not([fadein]) {
max-width: 0.1px !important;
}

 

Restart firefox and enjoy

Source:
https://www.askvg.com/how-to-customize-and-change-width-or-length-of-tabs-in-mozilla-firefox/Read the rest

Useful nmap command

Traceroute to IP address

nmap -sn --traceroute remoteipaddress

Traceroute to port

nmap -Pn --traceroute -p 443 remoteipaddress

Output:

PORT STATE SERVICE
443/tcp open https

Open means its ok

PORT STATE SERVICE
443/tcp filtered https

Filtered means that a firewall or some filtering or other network issue is covering the port and preventing nmap from determining if the port is open.… Read the rest

How to find WordPress admin users over mysql command line

How to show WordPress admin user using mysql command prompt

select * from wp_users u INNER JOIN wp_usermeta m ON m.user_id = u.ID where meta_value like '%administrator%';

or

SELECT u.ID, u.user_login, u.user_nicename, u.user_email FROM wp_users u INNER JOIN wp_usermeta m ON m.user_id
Read the rest

How to update .bashrc .bash_profile and get PS1 full path reflection

cd

Create .bash_profile if not exist yet

touch .bash_profile

The .bash_profile should contains the following:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Append into the file .bashrc the following:

PS1="\u@\h [\$PWD]# "

LS_OPTIONS='--color=tty -F -a -b -T 0';
export LS_OPTIONS;
alias ls='/bin/ls $LS_OPTIONS';
alias dir='/bin/ls $LS_OPTIONS --format=vertical';
alias vdir='/bin/ls $LS_OPTIONS --format=long';
alias d=dir;
alias v=vdir;
eval `dircolors -b`

Run next to get this updated:

source .bashrc
Read the rest