Change group and owners of files and folders on Linux server

July 31, 2008 · Filed Under Linux / Unix Commands · Comment 

chown command - change the owner of a file

You must be either the root user or the owner of the file in order to change the group ownership.

To change the group and owners of files and folders on the linux server use the below command

Set the file’s owner:
$ chown username filename

where username is the new owner of the file and filename is the file for which ownership need to be changed.

You can also set the file’s group at the same time. If the user name is followed by a colon and a group name, the file’s group will be changed as well.
$ chown username:usergroup filename

You can set the owner of a directory exactly the same way you set the owner of a file:
$ chown username dirname

In order to set the ownership of a directory and all the files in that directory (recursive), you’ll need the -R option:
$ chown -R username dirname

R stands for recursive because this command will recursively change the ownership of directories and their contents

Verbose mode

$ chown -v username somefile
changed ownership of ’somefile’ to username

Here, v stands for verbose. If you use the -v option, chown will list what it did (or didn’t do) to the file.

The verbose mode is especially useful if you change the ownership of several files at once. For example, this could happen when you do it recursively:

$ chown -Rv username somedir
changed ownership of ‘dirname/’ to username
changed ownership of ‘dirname/file1′ to username
changed ownership of ‘dirname/file2′ to username

chgrp - change the group ownership of a file

You must be either the root user or the owner of the file in order to change the group ownership.

chgrp works the same way as chown does, except it changes the file’s user group instead of the owner

$ chgrp usergroup filename

where usergroup is the newgroup to which the filename need to be assigned

after execution of the command, the file’s group has changed to usergroup, the file’s owner will still be the same.

The options of using chgrp are the same as using chown. So, for example, the -R and -v options will work with it just like they worked with chown:

$ chgrp -Rv usergroup dirname
changed group of ‘dirname/’ to usergroup
changed group of ‘dirname/file1′ to usergroup
changed group of ‘dirname/file2′ to usergroup

How to restore compressed mysql backup file

July 31, 2008 · Filed Under Linux / Unix Commands, Mysql · 1 Comment 
To restore compressed backup files you can do the following:
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]

If you need to restore a database that already exists, you’ll need to use mysqlimport command. The syntax for mysqlimport is as follows:

mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]

Mysql backup using phpmyadmin

July 26, 2008 · Filed Under Mysql · Comment 

To tack the mysql database backup you can login to phpmyadmin and follow the following steps

1. Select Export from the menu

technointellects-phpmyadmin-export1

technointellects-phpmyadmin-export1

2. Select the Zipped format for downloading in compressed form

3. Press “GO

technointellects-phpmyadmin-export2

technointellects-phpmyadmin-export2

Upgrade from Wordpress 2.5.x to Wordpress 2.6 in easy steps

July 26, 2008 · Filed Under Wordpress · Comment 

Step 1 : Backup your existing files of wordpress site .

Step 2 : Backup your wordpress database.

Step 3 : Deactivate your plugins. A plugin might not be compatible with the new version, so it’s nice to check for new versions of them and deactivate any that may cause problems. You can reactivate plugins one-by-one after the upgrade.

Step 4 : Download Wordpress 2.6 (~1.2MB)

Step 5 : Delete your old wp-includes and wp-admin directories (I would suggest you to rename it till the time Wordpress 2.6 is installed successfully).

Step 6 : Copy the new WordPress files (after unzipping) to your server, overwriting old files in the root. You may use FTP or shell commands to do so. Note that this means *all* the files, including all the files in the root directory as well. If you use the default or classic theme and have customized it, then you can skip that theme.

NOTE : Take care to preserve the content of the wp-config.php file in the root directory. This file contains current settings for your existing installation, e.g. database sign-in information.

Step 7 : Login to the Admin section and Point your browser to “http://yourdomain/wp-admin/upgrade.php“. Follow the instructions on screen to continue and upgrade within seconds.

Congratulation, Your Wordpress site is upgraded to version 2.6

Step 8 : Delete the renamed folders, if had not deleted yet (Step 5)

In case any thing goes wrong you still have the backup taken in Step 1 and Step 2 to restore to your old version.

How to insert html code in Joomla content or module?

July 23, 2008 · Filed Under Joomla · 5 Comments 

Many of the times there is need or requirement to insert raw HTML in a Joomla article or module. For example, embedding Google maps etc.

Unfortunately, sometimes the editor screen you are using will strip out the HTML code, or cause an error. Rather than having to turn the editor on/off in global configuration, there is an easier way.

Try using JCE editor, it has an option to insert html code and javascript in advance mode

OR

Try this trick.

Make a super administrator, say “htmlinsert”. and then find him in the user manager and change his editor to “No Editor”.

Any time you need to work in raw html, log in with the user “htmlinsert” , front end or back end.

This also works for articles too.

How to find the module positions for a new or existing Joomla template?

July 22, 2008 · Filed Under Joomla · 1 Comment 

To find the module positions in your Joomla 1.0.x or  Joomla  1.5.x template simply add  the following  to your URL

/index.php?tp=1

for eg. if your domain name is www.mydomain.com,  then to find the module position type in the addressbar

www.mydomain.com/index.php?tp=1

Adding new module position to Joomla 1.0.x and 1.5.x

July 22, 2008 · Filed Under Joomla · 2 Comments 

In Joomla 1.0.x we can add new module positions by going to

Site -> Template manager -> module positions (total 50 places). [Add your position]

However in Joomla 1.5.x we need to add the module positions within the templatedetails.xml under the active template folder

<positions>
<position>hornav</position>
<position>breadcrumbs</position>
<position>banner</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>search</position>
<position>topsl</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>user5</position>
<position>user6</position>
<position>user7</position>
<position>user8</position>
<position>user9</position>
<position>footer</position>
<position>syndicate</position>
<position>debug</position>
</positions>
Simply add another line(s) with <position>your module position</position> and place it in the order it will appear within the list

301 redirect to new domain

July 21, 2008 · Filed Under SEO - Search Engine Optimization, htaccess · 1 Comment 

If you have moved your site to a new domain and want that the traffic from the old domain should get redirected to the new domain, add the following lines in the .htaccess file of the old server

redirect 301 / http://www.newdomain.com/

Installing Joomla 1.5.x

July 18, 2008 · Filed Under Joomla · Comment 

With the increasing popularity of Joomla most people are moving towards Joomla.

I would like to take the initiative to help the new Joomla family members installing Joomla 1.5.x version on their server

Please follow the following steps

  1. Download joomla package from joomla.com
  2. Decompress the file downloaded
  3. Login to your FTP server
  4. Upload the extracted files on the server
  5. Open web browser.
  6. Access the site http://yourwebsite.com you will get first installation page.
  7. In first page, you will choose language. Default en-GB - English. Click Next button on top right.
  8. Next step, Joomla will check your system before installation. On top part, your system must match with requirement. If not, your Joomla installation not functioning correctly. There are several recommended setting on bottom page. If your settings do not quite match the recommended, it will be red warning on actual column. You can fix it or leave. Click next button to continue.
  9. Next page about licence. Read carefully. Click next button.
  10. Next page about database configuration. Before configure, make sure you made a database for joomla. These must already exist for the database you are going to use.If not ready, open your phpmyadmin. Create a new database, for example give name “joomla”.Then, fulfill all item at database configuration. Click next button.
  11. Next page about FTP Configuration. Click Next button.
  12. Next page about site configuration. Enter your site name, email and admin password.Click Install Sample Data button.Then, Click Next button.
  13. If you get sentence “Congratulations! Joomla! is installed.”, your steps successfull.
  14. The last step, remove folder installation from your root directory.

If you want look site, click Site button. Or click Admin button for login to administration page.

What is MVC pattern in Joomla ?

July 18, 2008 · Filed Under Joomla · 2 Comments 

With the introduction of joomla 1.5.x, I was very excited to learn the new architecture implemented. With the increasing popularity of Joomla 1.5.x I could not stop myself teach myself the new Joomla MVC pattern.

MVC stands for Model View Controller

MVC is an architectural pattern used in software engineering. The model-view-controller solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component: the controller.

In other words , to organize a computer applications that present lots of data to the user, one often wishes to separate data (model) and user interface (view) , so that changes to the user interface (ie Front End Design) do not impact the data handling (ie Backend), and that the data can be reorganized without changing the user interface.

MVC was originally developed to map the traditional input, processing, output roles into the GUI realm:

Input –> Processing –> Output
Controller –> Model –> View

model-view-controller-joomla15-component

the Model-View-Controller (MVC) pattern organizes and separates software into three distinct roles:

  • The Model encapsulates your application data, application flow, and business logic.
  • The View extracts data from the Model and format it for presentation
  • The Controller direct application flow and receive input and translates it for the Model and View.

Model

The model is the part of the component that encapsulates the application’s data. It will often provide routines to manage and manipulate this data in a meaningful way in addition to routines that retrieve the data from the model. In our case, the model will contain methods to add, remove and update information about the books in the database. It will also contain methods to retrieve the list of books from the database. In general, the underlying data access technique should be encapsulated in the model. In this way, if an application is to be moved from a system that utilizes a flat file to store its information to a system that uses a database, the model is the only element that needs to be changed, not the view or the controller.

View

The view is the part of the component that is used to render the data from the model in a manner that is suitable for interaction. For a web-based application, the view would generally be an HTML page that is returned to the data. The view pulls data from the model (which is passed to it from the controller) and feeds the data into a template which is populated and presented to the user. The view does not cause the data to be modified in any way, it only displays data retrieved from the model.

Controller

The controller is responsible for responding to user actions. In the case of a web application, a user action is a page request. The controller will determine what request is being made by the user and respond appropriately by triggering the model to manipulate the data appropriately and passing the model into the view. The controller does not display the data in the model, it only triggers methods in the model which modify the data.

When we implement MVC, we face in more complex codes. The Model, View, and Controller are never captured in single classes, but are instead implemented as closely-related groups of objects, where each group performs one specific MVC task.

Next Page »