Archive | January, 2011

RandomLinux.com’s Easy WordPress password changer

RandomLinux.com’s Easy WordPress password changer

Posted on 30 January 2011 by Chris

We here at RandomLinux.com like to make things easy for users, so we created this script to make it easy to recover your WordPress dashboard password if you have lost it and are not able to recover it.  Head over to our forum and give it a try and give us some feedback.  Feature requests welcome!

Check out the forum post here:

Post to WordPress Password Changer

And you can download the file here:

WordPress Password Recovery Script
Downloaded 236 times

“This script was made to simplify recovering your WordPress dashboard password for any user from the command line. To use this, all you will need to know is the path to the folder that WordPress is installed in and all you have to do is input your new password and select the username to change and it’s done! This is only the first version of this script and will be updating it. We would love to have some feedback on this, so feel free to give me any criticism on it as well as any features you would like to see.

There are a few ways to get and use this file. The first way is by using wget from the command line. You can download, set the correct permssions and run the script by copying and pasting this line to the command line on your server:

wget http://randomlinux.com/scripts/wppw.sh ; chmod 755 wppw.sh ; ./wppw.sh

You can also just download the file and run it manually.

1) Download the file here.
2) Use an FTP client to upload the file to the desired place on your server.
3) Log into your server with SSH and run the script, using something like the following command
sh /path/to/wppw.sh
4) Follow the prompts and change your password.
5) Login to your WordPress Dashboard!

If this helps out, feel free to go to our home page and click and ad to thank us :D
Any features that are suggested will be added in as quickly as possible, so let me know what would make it better!

Upcoming features:
* Web-based GUI for easy use
* More”

Enjoy!

Comments (0)

Tags:

Check the storage engines for MySQL

Posted on 28 January 2011 by Chris

If you need to find out the available storage engines for MySQL, such as InnoDB, you can run the following command.

mysql -Bse 'show engines'

That will output the engines and their availability, and will look something like this.

root@server [~]# mysql -Bse ‘show engines’
MyISAM  DEFAULT Default engine as of MySQL 3.23 with great performance
MEMORY  YES     Hash based, stored in memory, useful for temporary tables
InnoDB  YES     Supports transactions, row-level locking, and foreign keys
BerkeleyDB      YES     Supports transactions and page-level locking
BLACKHOLE       NO      /dev/null storage engine (anything you write to it disappears)
EXAMPLE NO      Example storage engine
ARCHIVE NO      Archive storage engine
CSV     NO      CSV storage engine
ndbcluster      NO      Clustered, fault-tolerant, memory-based tables
FEDERATED       NO      Federated MySQL storage engine
MRG_MYISAM      YES     Collection of identical MyISAM tables
ISAM    NO      Obsolete storage engine

Comments (0)

Change WordPress password from the command line

Posted on 28 January 2011 by Chris

If you forget the login to the WordPress dashboard and the “forgot your password” link isn’t working for you, it is possible to change it from the command line. First, you will want to find the database that WordPress is using, so go to the folder that holds it, and get that from the wp-config.php file.

#]grep -i db wp-config.php

That will show you the database information from that file. It will come out like this.  All that you will need for what we are doing is the database name, which is db_name.

root@server [/home/user/public_html]# grep -i db wp-config.php
define(‘DB_NAME’, ‘db_name’);
define(‘DB_USER’, ‘db_user’);
define(‘DB_PASSWORD’, ‘yourdbpw’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8′);
define(‘DB_COLLATE’, ”);

Then, you will need to drop into the mysql command line using that database.

#]mysql db_name

After that, you will want to list the users that are in the database to get some of the information that you will need to change the password.

mysql>select * from wp_users;

That will show the users and the ids for the users, which will look something like this.

+—-+————+————————————+—————+—————————+————————-+———————+———————+————-+————–+
| ID | user_login | user_pass                          | user_nicename | user_email                | user_url                | user_registered     | user_activation_key | user_status | display_name |
+—-+————+————————————+—————+—————————+————————-+———————+———————+————-+————–+
|  1 | Admin      | dOInlojhdE93LpD/kdiascxpItw33Ld/ | admin         | admin@yoursite.com |                         | 2011-01-06 08:08:52 |                     |           0 | Admin        |
|  2 | user2      | dOInlojhdE93LpD/kdiascxpItw33Ld/ | user2         | user2@secondsite.com        | http://www.yoursite.com | 2011-01-11 22:27:31 |                     |           0 | User2        |
+—-+————+————————————+—————+—————————+————————-+———————+———————+————-+————–+
2 rows in set (0.00 sec)

Finally, it’s time to change the password. You will use the id number in the first column of the user you need to change in this command. If we are changing the user admin with the id number 1, we would use this.

mysql> update wp_users set user_pass = MD5('password') where ID = 1;

Now, you should be able to log into the dashboard with the username and whatever you put in the place of password.

Comments (1)

List the contents of a tar, tar.gz, and tar.bz2 file

Posted on 27 January 2011 by Chris

It is possible to list the contents of tar files without needing to extract them. To do this with a tar file, you will do the following.

tar -tvf file.tar

To show the contents of a tar.gz file, you can do this.

tar -ztvf file.tar.gz

And you can also show a tar.bz2 file with the following.

tar -jtvf file.tar.bz2

Comments (0)

Check the running processes for a particular user

Posted on 22 January 2011 by Chris

Sometimes when you check top and you notice that there is one user that is using a lot of resources, you may want to check for all the running processes for that user by using the following command:

ps aux | grep username

That will output the process and the path to the file that is running.

Comments (0)

Tags: ,

Force cPanel to update from the command line

Posted on 21 January 2011 by Chris

There are times when you try to update cPanel from the UI and it will fail or will hang.  When this happens, you are able to force the update from the comamnd line.   SSH into the server as root, then run the following command.

/scripts/upcp --force

This will show you what is going on will normally fix any update issues that you were having, but will also help you to troubleshoot any problem that may come up with the update.

Comments (0)

Tags: ,

Create a missing DNS zone on a server with cPanel

Posted on 18 January 2011 by Chris

If you have ever used cPanel, there may have been a time that a DNS zone was missing even though your domain was already added on.  If you have root access, you are able to fix this by using the adddns script.  This is located in the /scripts directory, but only if you are using cPanel.  So to use this,  you will define the domain and the IP that it is for.

/scripts/adddns --domain=site.com --ip=123.456.7.89

That will create a dns zone for the domain site.com with the address on the server of 123.456.7.89.  You can then check /var/named/site.com.db to make sure that it created successfully.

Comments (0)

Tags: ,

Create a cPanel backup from the command line

Posted on 18 January 2011 by Chris

You are able to create a backup of a cPanel user’s account by using the pkgacct command in the /scripts directory that can be found on any server that has cPanel installed.  If you needed to create a backup of the account for a user named user1, you would need to be in a root shell, then run the following command.

/scripts/pkgacct user1

Unfortunately, cPanel backups are limited to 4GB, but using the command line, you are able to surpass that limitation and force it to back up the account by using the following:

/scripts/pkgacct user1 --skip-limit-flag

Adding on the –skip-limit flag will allow it to skip the 4GB limit and create the backup.  Then, when the script is finished and the backup has completed, it will tell you the path that it placed the backup and you can move it to whichever directory you would like.  If you are creating this for a user that does not have root access, you will want to put it in their home directory as well as chown it to the user so that they are able to download the backup as well.

Comments (0)

Deny and allow IP addresses using the .htaccess

Posted on 17 January 2011 by Chris

You are able to deny or allow all or selected IP addresses or ranges using the .htaccess file. Edit it with any text editor and add this code deny all IP addresses from viewing a site or folder.

order allow,deny
deny from all

You can also deny a range of IPs or one particular IP by adding the allow from directive in. The first example will allow all IPs except for 123.456.6.83.

order allow,deny
deny from 123.456.6.83
allow from all

And this will deny all IPs from the 123.456.xxx.xxx range.

order allow,deny
deny from 123.456
allow from all

Also, you can deny all IPs and only allow certain ones to access the folder. To allow only 123.456.6.83 to access the site, you can use the deny all along with an allow directive.

order allow,deny
deny from all
allow from 123.456.6.83

And for a range, you can also use the same method

order allow,deny
deny from all
allow from 123.456

Comments (0)

Tags:

How to change your SSH port on CentOS

Posted on 16 January 2011 by Mitch

To change your SSH port on CentOS you can first edit the sshd_config file located in /etc/ssh/sshd_config.

nano /etc/ssh/sshd_config

Once you open that up the port line should be commented out and look something like this:

#Port 22

So you can uncomment it and set it to whatever port you’d like…I’ll use 2222 in this example.

Port 2222

Once you do that go ahead and save it by hitting CTRL+O and enter, then CTRL+X to exit nano. Now we need to open up the new port in iptables by running these commands:

iptables -I INPUT -p tcp –dport 2222 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart

Now that port 2222 is open and accepting connections, we can go ahead and restart the sshd service.

/etc/init.d/sshd restart

Once you do this go ahead and open a new terminal or PuTTy session and try to connect to the new port to test that it’s working while leaving your original session open in case it does not. If it doesn’t work please be sure you followed all the instructions carefully because if you close your first session you could get locked out of your server!

Comments (0)





Download v1 of the RandomLinux.com Android app! Stay up to date on everything that's Linux right from your phone or tablet! Download below!