In the event you lose your device or two-factor just isn’t working for whatever reason, you have the ability to disable it by logging into your server via command line as root. Then run the following to disable two-factor authentication… For further options you can review the official documentation… WHM API 1 Functions – twofactorauth_disable_policy
List Unique IPs that Accessed Linux Server
IPs from Apache access logs… [code]$ cat ./access_log | awk ‘{print $1}’ | sort -n | uniq -c | sort -nr | head -20[/code] IPs that logged into server (via SSH, etc)… [code]$ last[/code]
Change Group if the Original Group is XYZ
To change the group recursively of files and folders only if the original group is a certain value, you can use the following (replace “yournewgroup”, “youroldgroup”, and “/path/to/wherever” to your own values).
Determine MySQL Version via Command Line
Want to find out what version MySQL you are running using only your command line interface? This one is super easy. Log in to MySQL (replace “root” with your username of choice or keep as root) mysql -u root -p Enter your password when prompted Run the following statement SHOW VARIABLES LIKE “%version%”; Your output […]
PHP Tips to Display Errors, Warnings and Notices
Adding these two little lines at the top of your code can often solve a world of questions you have on why your code isn’t working. Make sure they are placed at the very top right after the opening <?php tag. If anything is output before them it will not work properly. Another helpful tool […]
Selectively Dump Data with mysqldump
You can dump part of a table using the mysqldump in command line. The command is… The “-t” flag will suppress the “DROP” and “CREATE” commands so you will be left with a clean “INSERT” statement that you can load where ever needed. You can also use a shortcut for the “where” by using just […]
Create MySQL Database and Add New User (command line)
Here is a quick example of how to create a database, assign a new user and set their password. Connect to MySQL server as user “root” (you will be prompted for a password) The “mysql>” prompt will now appear. Create new database… we’ll call it “orders” Give user (named “fluffy”) full permissions Set password for […]