Reset ownCloud Passwords For Admin And Users Using phpMyAdmin

Warning:  Following the instruction below at your own risks, because bad things happen!  Don’t blame me for your bravery in destroying ownCloud’s database if something goes wrong and beyond one’s expectation.  Nonetheless, I’ve used the exact directives to successfully change the admin and users passwords for ownCloud.

Forgetting your ownCloud’s password?  Whether your ownCloud’s admin or regular user password is lost, you can always restore or change the password for the admin or user.  Perhaps, you forgot to enter the email address into user’s settings to receive lost password reset email, to think that you’re stuck is being crazy.  Of course, unless you forgot your MySQL database’s root password too, then you really are stuck and won’t be able to access your data that reside within ownCloud.  Nonetheless, let’s hope you aren’t yet out of options, then you can totally use your MySQL’s root password to edit your ownCloud’s admin or user password.  I won’t talk about how to access and edit any other database as I can barely get around MySQL.  Nonetheless, read on and the trick is here to treat you well.

I don’t even bother with MySQL command lines, and so I sure hope you have installed phpMyAdmin.  We will use phpMyAdmin to edit out the oc_users table’s passwords.

  1. So, first of all, log into your ownCloud MySQL’s database as a root user or the owner of ownCloud database through phpMyAdmin.
  2. Secondly, expand the left panel and expand the ownCloud database.  You should see bunch of ownCloud tables underneath ownCloud’s database, and these tables should begin with oc_ extension.  Try to find oc_users!
  3. Click on oc_users to access the oc_users table.  Before you even think aboud editing a user entry within this table, you must know that once you edit a user’s password there is no going back to the original password.  Of course, if you already know the original password, you wouldn’t do this in the first place!
  4. Click on the edit link next to the user to access the oc_users’ user entry.  In here you can change the password for a user.  Don’t do anything yet though, because the passwords store within oc_users table are encrypted with whatever.  If you delete the encrypted passphrase, you basically delete the password.  Nonetheless, you can’t enter a password of your own, because your password isn’t encrypted.  If you try to enter a plain password, your user account won’t see the password change.  Furthermore, if you try to empty out the password, ownCloud’s login page won’t allow you to access ownCloud service even though you had emptied out the password.
  5. If you read my instruction carefully, it means you haven’t done anything yet.  Good, because now you need to open up a web browser’s tab or a new web browser so you can go to http://pajhome.org.uk/crypt/md5/ (link).  If this webpage is still the same and has yet to be changed, under the Demonstration section you should see MD5/SHA-1 boxes.  Instead of entering a real password that can be read by the owner of this website, you need to enter a weak password (that you plan to change it later) into the Input Calculate Result’s top box.  When done entering a temporary password that is easy to remember, hit the SHA-1 button to allow the webpage to generate the SHA-1 hash.  Make sure you copy the SHA-1 hash result in the bottom box.
  6. We need to paste the SHA-1 hash passphrase into the password’s value field (box) of a user you want to change the password for within the database.  So, back in phpMyAdmin, within a user’s entry which resides within the oc_users table, you need to enter the SHA-1 hash into the password’s value field (box).  Hit the Go button which situates right underneath the password’s value field (box).  This should do it.
  7. Now, you can try log into ownCloud service with a new password that you had created for the ownCloud user.  Of course, the password isn’t the SHA-1 hash passphrase, because the ownCloud’s login page expects the regular plain password that you encrypted with SHA-1 hash earlier.  If everything goes as plan, you should be able logging into the ownCloud’s admin or user account.  From, here you can change the password in Personal page, and so you should change the password you just changed for your ownCloud admin or user into a really strong password.

Now, you can chuck down a beer and congratulate yourself a job well done.

How To Install Web Server On Linux

I might not be very good at explaining things in an impromptu manner, but hopefully within the video right after the break I do somewhat OK in showing you how to install a web server on Linux.  Also, I explain how to use the web server in a basic sense.  For the bonus, I also show you how to install MySQL’s web administrative interface PHPMyAdmin.  At the end of the video, I demonstrate how to install WordPress just to prove to you that you can really host a web application on your brand new web server.  Please enjoy the video tutorial right after the break!

Backing Up MySQL Databases using a shell script

Have you ever wondered how to backup huge amount MySQL databases, but you also want to be able to cherry pick specific MySQL databases to be included in your backup schedule?  How about on top of what you’ve already wondered, to be able to schedule the backup of these MySQL databases?  Obviously, typing in long command lines aren’t going to cut it.  Some control panels such as Cpanel can help alleviate your pain, but sometimes Cpanel chokes badly on long list of MySQL databases or huge MySQL databases, so you cannot really feel safe that your MySQL databases will get back up.  Rsync is great, but sometimes MySQL databases are hidden in locations that rather mystical to you since your system may have configure rather differently.  Why not just use mysqldump since it’s knowing rather well where all MySQL databases are hidden?  Unfortunately, if using mysqldump command in its normal way can be rather crude such as entering long command, but entering command is not yet the worse of all since you still have to re-entering the same very long command over and over again for every backup.  Plus, mysqldump itself cannot be used with cron efficiently to schedule your backup.

The solution is to use a shell script that someone or perhaps it’s you who cooks up the script itself.  To write a shell script, it’s demanding that you must know how to program somewhat.  Some of us are rather clueless on programming front, and so such option also may be out of our grasp.  Fortunately, the web is a huge archive where we can dig for some clues.  I’ve found this short shell script on DreamHost’s wiki page which proves to be very useful to me, and so it may also be the very mysqldump script you need for doing backups of your MySQL databases.

domains=( yourdomain.com yourdomain2.com )
sqldbs=( yourdb1 yourdb2 )
opath=$HOME/backup/
mysqlhost=mysqlhostname
username=mysqlusername
password=mysqlpassword
suffix=$(date +%m-%d-%Y)
for (( i = 0 ; i < ${#domains[@]} ; i++ )) do cpath=$opath${domains[$i]} if [ -d $cpath ] then filler="just some action to prevent syntax error" else echo Creating $cpath mkdir -p $cpath fi mysqldump -c -h $mysqlhost --user $username --password=$password ${sqldbs[$i]} > ${cpath}/${sqldbs[$i]}_$suffix.sql
done

So, let us break apart the essential parts from the code above which will allow you to configure and eventually execute the script to backup your MySQL databases.  At where it says domains= and inside parentheses it seems you need to enter your domain name, but that is misleading!  Instead, what you need to do is to enter a directory that you’re intending to keep your backup databases inside.  Unfortunately, this script behaves as if one database per domain name/directory as I have mentioned above.  To work around this, enter the same domain name or directory name inside the parentheses as many time as you need so the next line of code will understand how to store which database in which directory.  To make it clearer, the next line of code is sqldbs= and inside the parentheses would be your database names such as username_db01 username_db02 and so on; as you can see if you name the former line of code such as domains=( example.com example01.com ), then you will get two different directories which the former hold username_db01’s backup db and the latter directory which is example01.com will hold username_db02’s backup db.  In my case, I have abundance of databases under a domain name, and my configuration of the code above would turn out to be domains=( essayboard.com essayboard.com essayboard.com essayboard.com ) and continue on with the next line of code would be sqldbs=( db_01 db_02 db_03 db_04 ) — this makes db_01 and db_02 and db_03 and db_04 to be backed up inside only one directory names essayboard.com.

The line of code says opath=$HOME/backup/, you can change the portion says backup/ to anything you like such as you have a directory named backingupsales/.  This line of code will tell the script to create the directory which defined from the code domains=( yourdomain.com yourdomain2.com ).  To put it another way, whatever directories the line of code domains= creates, these will be placed inside the directory of which you had defined above from the line of code opath=.

The lines of code mysqlhost= and username= and password= are self-explanatory, but you need to put a single semicolon before and after the string of text you enter right after the equal sign.

Don’t touch anything else, and save the script in a location inside your server that you would remember.  Anytime you want to do a backup, just become a user which has permission to execute the script and do this command line:  sh thescriptname.sh.  thescriptname.sh can be in any name since it’s you who ultimately name the script and save it.  Just make sure the extension of the script would end up with .sh.

You can also use your text editor or Open Office’s spreadsheet to manipulate hundreds or even thousands of database names, then copy those database names and directory names into the appropriate portions of the script’s lines of codes.  I was able to back up thousands of databases using this script, and it takes me only few minutes to configure the script myself.

Since we have the script, we can always configure a cron job to run the script daily or weekly or monthly.  How to configure a cron job is beyond the scope of this post.  I’m sure you can google it easily.  Have fun backing up your MySQL databases!

Ghosts of The Past, A Story Of Dead MySQL Databases Repopulated Inside Cpanel’s Account

Ghosts from the past visit the now, and I’m not talking about a horror here.  Recently, I had learned something from Cpanel that I had no idea before.  If you’re unfamiliar with Cpanel, I suggest you google it!  Back to the main course, I logged into Cpanel and noticed that the MySQL databases I had deleted eon ago repopulated inside Cpanel.  I pulled my hair, googled everywhere, but I couldn’t find the source of the souls of these supposed to be dead databases.  Luckily, I called up a person who knew much more about ghosts of the past of MySQL/Cpanel, and he showed me the way.

It turned out, even though inside PHPMyAdmin and /var/lib/mysql, the ghosts of the past did not repopulated, and it supposed to be that way — this gave me an idea that everything had been normal besides the fact that the ghosts of the past of dead databases had repopulated within Cpanel.  The person I called up figured it out and told me that inside directory /var/cpanel/databases/, there would be two files that I could take a look at.  One would start with username.cache (replace username with a real account’s username) and the other would start with username.yaml (replace username with a real account’s username).

It turned out he was corrected.  The ghosts of the past of MySQL turned out to be just a list of lost souls who’s silhouettes refused to leave the living world.  Anyway, I deleted the list of dead databases in those two files, and my Cpanel is perfect again.  If you still don’t know why I had wanted to get rid the ghosts of the past, I’ll tell you so… it’s because I do not want every time I get into Cpanel’s MySQL section and I have to wait for Cpanel to recall all the ghosts of the past; it takes a long time you know?  Also, it can be very confusing by staring at the ghosts of the past, fearing of getting lost among them.

So, take a look at my report here and get rid of yours before Halloween once again returns!

Installing Virtualmin On Ubuntu 10.04

New php developers and web designers who are wanting to develop their codes in a test environment, they need to learn how to set up a local server or a local server environment on their laptops and desktops.  It’s a dreaded thing for them to learn even more before they can have a test environment going so they can frequently upload their php scripts and related html codes.  It’s a lot of work!  Not to worry, I know an easier way for you to get a test server environment going!  I’m sure there are even easier ways than mine, but if you haven’t found out a better way yet, why not try my method, right?  So how?  One word, Virtualmin!

What’s Virtualmin?  It’s a control panel of sort that helps you manage your server using LAMP configuration.  For your information, LAMP stands for the combination of technologies involves with Linux, Apache, MySQL, and PHP.  Why is it easy to manage your test server or production server with Virtualmin?  For an example, you can create a new virtualhost account that has FTP access, SSH access, email account, SSL protocol for securing website, and a lot more by just filling out a single web page where you can enter new username and password for the new virtualhost account, check necessary boxes of features that you want your virtualhost account to have, and then accept the creation of your newly virtualhost account with one single last click on the create account button.  It’s simple as that!  It saves you time to open up a terminal, editing various configuration files of Apache, Bind, FTP, MySQL, and so on.  Just like any powerful control panel in the market, Virtualmin has many ways for you to manage your server either in the test environment or in the production environment with ease.

I have created a video which shows you how to install Virtualmin.  Also, in this video, I show you how to create a simple virtualhost account.  Check it out after the break!  Have any feedback or comment for me?  Don’t hesitate to write a feedback or a comment on my video.  I don’t mind if it’s a negative comment, because the more critical you’re, the more that I know you care!