Showing posts with label Linux Software. Show all posts
Showing posts with label Linux Software. Show all posts

Friday, October 18, 2013

Parse error: syntax error, unexpected T_VARIABLE in \ /usr/local/apache/htdocs/stat/config.inc.php on line 25

Error:
Parse error: syntax error, unexpected T_VARIABLE in  \
/usr/local/apache/htdocs/stat/config.inc.php on line 25


Solution:

put a ";" at the end of hostfile var

Password protecting a directory in Webmin

rmally we use .htaccess and .htpassword files for setting up password protection for accessing certain pages/folders/directories.

In Webmin, there is an option called "Password protecting a directory" set up for you.

Below are the easy steps to password protect a directory using Webmin:

1) login in to the Webmin interface

2) Main menu -> choose "Others" -> choose "Protected Web Directories" -> "Add protection for a new diretcory"
3) in settings:

Directory path: select the path/directory which you want to protect
File containing users: if any, or choose automatically

File containing groups: if any, or choose None

Password encryption: choose the encryption type

Authentication realm: the name will appear in login box, ex: "Admin Area"

Users to allow: put the username you want to setup in "Only Users:" field

4) click the "Create" button

5) in the next page, you can add/edit password for this user, then click submit/save button. It's done!

Wednesday, October 2, 2013

Squid as a transparent proxy over ssl https



Setting up squid as a transparent proxy is fairly an easy job. If we Google for “how to set up squid as a transparent proxy” Google renders a lots of links for our reference. But it is commonly seen that when we are using transparent proxy we are unable to connect to https connection like Gmail and many more sites which https protocol for security concern. Sites which use http protocol can easily open.

Let’s understand first how squid proxy works in transparent mode. While setting up squid as a transparent proxy we can forward the entire request coming from port 80 to squid server’s port i.e. 3128 by default. When we talk about port 80 it means http protocol. What if we request for Gmail who uses https protocol and this protocol by default send request to port 443 of squid’s port, and we iptable firewall rules to forward traffic from port 80 to port 3128 and we forget about port 443 which is used by https protocol and squid is http proxy server. Now many folks may think it’s easy and forward all traffic coming from port 443 to squid port 3128.  No it won’t work.  Because https connection establishes a secure connection over the network and for that it uses certificate and public key private key pairs. And first of all I thanks God for RSA and DSA algorithm as it is not so easy to decrypt data which is encrypted by use of this algorithm. Squid proxy is a middle man who changes packets header and route traffic to internet world. So what we have to do is to create certificate and public key private key pair for internal network which can be used by squid client and squid server and later squid server can route your traffic to internet world. To yield faster results it is better to sign certificate from CA. self signed certificates are little bit slowing the connection. As in a transparent mode encryption and decryption done twice so it may yields result slow so I advised you to keep patience.

Steps are:

  1. iptables  -t nat -A PREROUTING -i eth0  -p tcp --dport 80 -j REDIRECT --to-port 3128

  2. iptables  -t nat -A PREROUTING  -i eth0 -p tcp --dport  443 -j REDIRECT --to-port 3130


Certificate and public key private key generation.

  1. openssl genrsa -des3 -out server. Key 1024

  2. openssl req -new –key -out server.csr

  3. openssl req -new -key server. Key -out server.csr


Steps to remove passphrase

  1. cp server. Key server. Key.old

  2. openssl rsa -in server. Key.org -out server. Key


Create server certificate

Openssl x509 -req -days 365 -in  server.csr -sign.key -out server.crt

Now make some changes to squid.conf file

  1. http_port 3128 transparent

  2. https_port 3130 transparent cert=/”path to server.crt” key=/”path to server.key”.


Another easy way to create certificates and public key private key pair is using genkey utility. In order to use that you have crypto-utils package install on your machine.

Steps are:

  1. #yum -y install crypto-utils

  2. genkey -days 365 squidserver.hostname.com

  3. Hit next.

  4. Select number of bits for data encryption. Default is 1024. This command will generate random bits.

  5. Generate the certificate.

  6. I will suggest you to never used passphrase for key, because if u assigns passphrase to key then along with public key we need to share passphrase.

  7. Certificate and key are stored at /etc/pki/tls/certs/ and /etc/pki/tls/private/

  8. In squid.conf make necessary change like this


http_port 3128 transparent

https_port 3130 transparent cert=/etc/pki/tls/certs/squidserver.hostname.com.crt key=/etc/pki/tls/private/squidserver.hostname.com.key.

In order to run it in a proper way the desired way that we want we also need to configure BIND DNS for local intranet along with forwarders ON and in forwarder we need to define ISP IP Address. At Client side must define both gateway and DNS (In my Env it is Proxy server.)

How to Stop WordPress Asking for FTP details to Upgrade Plugins


  1. First, we need to see what user Apache is running under. Type the following into a New file in any text editor. Save As whoami.php in the /var/www directory (or wherever you set Apache to serve files from):
    <?php echo(exec("whoami")); ?>


  2. Open this file in a browser (for instance, localhost/whoami.php). It should reveal who the user is

  3. This tells you that the web server is running under the user webuser.

    You can now give that user recursive ownership (all subfolders) of your WordPress installation using the command:

    chown -hR webuser:webuser /var/mydomain.com/public_html/wordpress/

Monday, September 16, 2013

RoundCube: Strict Standards: Non-static method PEAR :: setErrorHandling

When installing the messages appear









1
2
3

PHP Strict Standards: Non-static method PEAR :: setErrorHandling () should not be called statically in / installer / utils.php on line 80

PHP Strict Standards: Non-static method rcube_install :: get_instance () should not be called statically in / installer / index.php on line 49


Eliminated as follows:
1. Open the file .. / installer / index.php
2. Find line









1

ini_set ('error_reporting', E_ALL & ~ E_NOTICE);


and change it to









1

ini_set ('error_reporting', E_ALL & ~ (E_NOTICE | E_STRICT));


3. If no, add this line here









1

define ('RCMAIL_CHARSET', 'UTF-8');


Here after this









1

define ('RCMAIL_CONFIG_DIR', INSTALL_PATH. 'config');

Ubuntu Server 12.04 64-bit with Zoneminder 1.25.0 the easy way

http://www.zoneminder.com/wiki/index.php/Ubuntu_Server_12.04_64-bit_with_Zoneminder_1.25.0_the_easy_way

Sunday, September 15, 2013

How To Install and Configure Varnish with Apache on Ubuntu 12.04

About Varnish






Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the virtual private server itself if there is a need for an active process.

Setup






To perform the steps in this tutorial, you will need to both have a user with sudo privileges and apache installed on your virtual private server.

To create a user with sudo privileges, go through the third and fourth steps of the initial ubuntu server setup tutorial
Apache can be installed on your VPS with a single command from the apt-get repository.
sudo apt-get install apache2

 

Step One—Install Varnish






The varnish site recommends installing the varnish package through their repository.

You can start that process by grabbing the repository:
sudo curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -

The next step is to add the repository to the list of apt sources. Go ahead and open up that file.
sudo nano /etc/apt/sources.list

Once inside the file, add the varnish repository to the list of sources.
deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-3.0

Save and exit.

Finally, update apt-get and install varnish.
sudo apt-get update
sudo apt-get install varnish

 

Step Two—Configure Varnish






Once you have both apache and varnish installed, you can start to configure them to ease the load on your server from future visitors.

Varnish will serve the content on port 80, while fetching it from apache which will run on port 8080.

Let’s go ahead and start setting that up by opening the /etc/default/varnish file:
sudo nano /etc/default/varnish

Uncomment all of the lines under “DAEMON_OPTS”—under Alternative 2, and make the configuration match the following code:
 DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"

Once you save and exit out of that file, open up the default.vcl file:
sudo nano /etc/varnish/default.vcl

This file tells varnish where to look for the webserver content. Although Apache listens on port 80 by default, we will change the settings for it later. Within this file, we will tell varnish to look for the content on port 8080. The configuration should like this:
backend default {
.host = "127.0.0.1";
.port = "8080";
}

 

Step Three—Configure Apache






So far we have told varnish that apache ports will be running on 8080. However the default settings for apache are still on port 80. We will correct the discrepancy now.

Open up the apache ports file:
sudo nano /etc/apache2/ports.conf

Change the port number for both the NameVirtualHost and the Listen line to port 8080, and the virtual host should only be accessible from the localhost. The configuration should look like this:
NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080

Change these settings in the default virtual host file as well:
sudo nano /etc/apache2/sites-available/default

The Virtual Host should also be set to port 8080, and updated line looks like this:
 <VirtualHost 127.0.0.1:8080>

Save and exit the file and proceed to restart Apache and Varnish to make the changes effective.
sudo service apache2 restart
sudo service varnish restart

Accessing your domain should instantly take you to the varnish cached version, and you can see the details of varnish’s workings with this command:
varnishstat

Friday, May 10, 2013

How to minotor live Squid traffic in GUI

SqStat

#cd /var/www

#wget http://samm.kiev.ua/sqstat/sqstat-1.20.tar.gz

#tar -zxvf sqstat-1.20.tar.gz

#cd sqstat-1.20

#mv config.inc.php.defaults config.inc.php

#mv sqstat.php index.php

test di browser anda :

http://192.168.169.2/sqstat-1.20/index.php

Monday, April 22, 2013

Mount a partition to a folder

mkfs.ext3 /dev/hdb1

Then you can mount it using


mount -t ext3 /dev/hdb1 /mnt/hdb1

Sunday, April 21, 2013

Error wile installing application on redhat

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6

Temp Solution:

using --nogpgcheck,

e.g. yum install --nogpgcheck yum-priorities.

 

 

Tuesday, March 26, 2013

This host is vt-capable but vt is disabled vmware

VT technology is disabled by default in BIOS

Goto bios and enable Virtualization Technology

Mostly under CPU option

Wednesday, March 13, 2013

Booting into a Graphical Environment - Linux

If you have installed the X Window System but are not seeing a graphical desktop environment once you log into your Red Hat Enterprise Linux system, you can start the X Window System graphical interface using the command startx.

Once you enter this command and press Enter, the graphical desktop environment is displayed.

Note, however, that this is just a one-time fix and does not change the log in process for future log ins.

To set up your system so that you can log in at a graphical login screen, you must edit one file, /etc/inittab, by changing just one number in the runlevel section. When you are finished, reboot the computer. The next time you log in, you are presented with a graphical login prompt.

Open a shell prompt. If you are in your user account, become root by typing the su command.

Now, type gedit /etc/inittab to edit the file with gedit. The file /etc/inittab opens. Within the first screen, a section of the file which looks like the following appears:
# Default runlevel. The runlevels used by RHS are: 
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
# id:3:initdefault:

To change from a console to a graphical login, you should change the number in the line id:3:initdefault: from a 3 to a 5.

Warning


Change only the number of the default runlevel from 3 to 5.

Your changed line should look like the following:
	 id:5:initdefault: 

When you are satisfied with your change, save and exit the file using the Ctrl-Q keys. A window appears and asks if you would like to save the changes. Click Save.

The next time you log in after rebooting your system, you are presented with a graphical login prompt.

Monday, January 14, 2013

connection to failed the system returned (13) permission denied

Squid Error:

# system-config-securitylevel-tui

you find three chooses of SELinux tool that under Security level change it to be (Permissive) Instead of (Enforcing).

NOW that website is open,,

Sunday, December 23, 2012

Why WordPress Asks for Connection Info

One of the great features of WordPress is that it allows you to automatically install and upgrade plugins.

A common problem is that WordPress is unable to access the filesystem directly, which results in a page indicating that “To perform the requested action, connection information is required.

 

Connection Information

If you feel that your WordPress installation should not be asking you for this information, or you simply do not want WordPress to use this method of plugin management, you may be able to work around it.

What is Causing This?


Whenever you use the WordPress control panel to automatically install, upgrade, or delete plugins, WordPress must make changes to files on the filesystem.

Before making any changes, WordPress first checks to see whether or not it has access to directly manipulate the file system.

If WordPress does not have the necessary permissions to modify the filesystem directly, you will be asked for FTP credentials so that WordPress can try to do what it needs to via FTP.

Why Can’t WordPress Write To The Filesystem?


In order to understand why WordPress can’t write to the filesystem, we need to take a look at some WordPress internals.

The following code is from the get_filesystem_method() method in the wp-admin/includes/file.php file:
if( function_exists('getmyuid') && function_exists('fileowner') ){
$temp_file = wp_tempnam();
if ( getmyuid() == fileowner($temp_file) )
$method = 'direct';
unlink($temp_file);
}

This code creates a temporary file and confirms that the file just created is owned by the same user that owns the script currently being run. In the case of installing plugins, the script being run is wp-admin/plugin-install.php.

This may seem a little counter-intuitive, since the only thing WordPress really needs to be able to do is write to the wp-content/plugins directory.

What Can I Do About It?


In order to fix this issue, you will need to make sure that the scripts which need to write to the filesystem are owned by the same user that apache is running as.

Many hosting companies will run your apache instance using your user account, and all of your files will be owned by the same account. In those cases, you will probably not have the issue described here.

If your hosting company is running apache as a system user, and your files are owned by your own account, your only option may be to enter your FTP credentials here and allow WordPress to use FTP.

If you are running on a hosting company that gives you root access, or you have installed WordPress on your own development machine at home or at work, you should be able to modify the filesystem permissions to allow WordPress to directly access the filesystem.

The easiest way to do this is to find out what user apache is running as and change ownership of the entire WordPress directory to that user. For example, if apache is running as ‘httpd’, you could use the following commands on your WordPress installation directory:
# chown -R httpd: wordpress

Note that not all versions of chown are equal. If that command does not work, see your local chown man page for usage information.

Tip: In order to find out what user your instance of apache is running as, create a test script with the following content:

<?php echo(exec("whoami")); ?>

Friday, December 21, 2012

How to Back Up Your Linux Machine to Box



deja-dupIn a previous article, we took a look at Backintime for KDE, a nice client to automate your back-ups to an external hard drive or other local directory. But it’s good practice to keep a version of your back-ups off-site as well. In this article, we’ll use Deja Dup, the back-up application that comes with Ubuntu, to back up a directory to Box.

Backing Up to Box with Deja Dup


Deja Dup is available out-of-the-box from the “System” section of the “System Settings” in Ubuntu Precise.

ubuntu system settings

Clicking on this item will display the “Overview” screen, which shows a couple of default settings, including Ubuntu One as the back-up’s destination, and your entire home directory as what will be backed up. First, let’s change this to just back up your Documents.

dejadup-overview

  • Click on the “Folders” tab

  • This will have your “Home” folder on the left-hand side, under “Folders to Back up,” and “Trash” and “Downloads” on the right-hand side as folders to be ignored.

  • We can delete “Trash” and “Downloads” by selecting them and clicking the “-” button at the bottom of the window. We can also remove the “Home” folder in the same way.

  • Next, click the “+” button on the left-hand side to display a dialog with your home directory folders. Select “Documents” from this window, and click the “Open” button.


dejadup-folders

Next, we’ll change this so the back up is sent to your Box account:

  • Click on the “Storage” tab – this will already set to Ubuntu One

  • Click the “Backup Location” pull-down, and select “WebDAV.”

  • You’ll see some new fields there… fill these in as follows: the server name “www.box.com,” select the option for “Secure Connection,” enter 443 for the “Port,” the folder name where you want to store your back-up, and your Box username.


dejadup-storage-webdav

By default, automatic back-ups are turned off, but if you return to the “Overview” tab, you can test it out by clicking the “Back Up Now” button. Once you’re done, if you visit your Box account, you’ll see three files in the folder you specified:

  • duplicity-full-signatures.[DATE AND TIME].sigtar.gz: This contains some signatures of the files in your backup

  • duplicity-full.[DATE AND TIME].manifest: This contains some information about your backup

  • *duplicity-full.20121015T230958Z.vol1.difftar.gz: Finally, this contains your files


However, you shouldn’t need to worry about these unless you want to “roll back” a change you made. Restoring the folder(s) you selected completely is as simple as selecting the “Restore” button from the “Overview” screen. You can also use the “Schedule” tab to run your back-up daily, weekly, bi-weekly, or monthly.

Backing Up to Box with Other Clients


There are other clients you can use for this as well:

rsync: By combining the directions to automount Box on login located here with the instructions on creating rsync-based backup’s here, we can create a simple shell script to mount the Box share (once you’ve configured it), run the rsync command, then unmount it again:








#!/bin/bash
mount /path/as/configured/in/fstab &&
rsync -avz /folder/you/want/to/backup /path/as/configured/in/fstab &&
umount /path/as/configured/in/fstab



kbackup: This back-up application will, like all KDE apps, take advantage of kioslaves. First, set up your Box account in Dolphin by clicking the “Network” link on the left-hand side. Then, click “Add a Network Folder,” and select “WebDAV” as the protocol. Fill in a name, your username for Box, “www.box.com” for the Server, and “/dav” for the folder. Then, click the “Use encryption” option, and make sure the “Port” number changes to “443″ (as shown in the first figure below). Then click the “Save & Connect” button. On my machine, this will create a shortcut to the Box share and try to open it right away, although this fails for me. But the shortcut does work – use this to visit your Box account, and create a folder for your new backup.

Next, install kbackup with the following command:








sudo apt-get install kbackup



This application is as easy as it gets… on the left-hand side, pick out the folder(s) you want to back-up, then in the “Target -> Folder” field, use the folder button to bring up the file dialog. You can select “Network -> [name of the Box shortcut you created above] -> [folder you want to put the back-up in]” from this dialog, then hit the “OK” button. Hit the big ol’ “Start Backup” button, and you’re off and running.

kbackup-box-backup

With some of the big storage handouts Box has been making, it makes for a good option for cloud-based back-up, with lots of different ways to meet your back-up needs.

Thursday, December 20, 2012

How To Easily Transfer Files Between Different Cloud Storage Services

backup-box-mainA few months back, Damien wrote an article about scheduling regular database backups to Dropbox. Then Dropbox can sync the database backup to your local computer. This is such a wonderful way of automatically backing up your database especially when the database size is quite large to fit to the email limits. The only limitation with this approach is that it works only with Dropbox. What if you want to sync the files across multiple cloud storage services?

Backup Box is a service which will let you transfer files from one cloud service to another. This process is completely web based and does not require any local computer resources or bandwidth. Backup Box supports several services including Box, Dropbox, Google Drive, Microsoft SkyDrive, SugarSync, FTP and SFTP. It also supports full MySQL database and Amazon S3 transfers. You can transfer files from any service to any other service directly.

To start using Backup Box, just head on to the Backup Box site and create a new account.

Backup Box login

After the sign up process, you will be taken to the step one. Backup Box wizard will guide you through the whole configuration process. The first step is about choosing the source location.

choose source

When you click the “Click to Connect” button, you will see a list of all the supported services which we have discussed earlier in the article. Just click on any of the service to configure its options.

Choose source service

For the sake of this tutorial, let’s select Dropbox as source. Every service will have its own configuration options. One thing common in all the services is that you will need to enter a display name of the service. This is for your ease of use.

Add connector

When you press the “Add this connector” button, you will be taken to the actual connection window where you can connect your Backup Box to Dropbox or any other supported service.

Connecting to backup box

Once this is completed, the source files will be shown on the next browser window.

backup-box-starting step 2

Step two will allow us to choose the destination. The process is the same as step one. For the sake of this tutorial, I will be adding an FTP account as the destination.

FTP settings

The next screen will give you a better idea of what we are going to do. In this tutorial, we are actually transferring selected files and folders from our Dropbox account to an FTP location. You will need to select the files and folder that need to be transferred and also a destination folder. The two connected accounts can be browsed within the same webpage.

After you have selected the files and folders to be moved, you will have two options, either you can initiate the transfer immediately or schedule the transfer for later.

The scheduling options are quite comprehensive. You can schedule this as a recurring transfer meaning that the transfer process will be initiated after a specified time and this will keep on recurring until the schedule is deactivated.

Scheduling options

One disadvantage of Backup Box is that it will actually move the files from one service to another. It would be a good option for the developers to let the user select whether he wants to copy the files or move them.

It has been a wonderful experience using this service until now. And since Backup Box is just a startup, hopefully the developers will put in more horse power and exciting features to make the service an essential part of cloud storage. What do you think?

Which cloud service are you using as your primary one? Do you intend to move to another cloud storage service? What methods do you have in mind to transfer your files from one cloud storage service to another?

Backup Box

NitroShare Allows You to Share Files Easily With Computers In The Same Network



nitroshare-shareboxWith a stable Internet connection, you can easily share files with others either via email, Dropbox or any other file sharing services website out there. However, what if you are in local network with no Internet access, or you just want to quickly send a file over to another computer without having it to go to the web and back? In such situation, NitroShare is the one for you.

NitroShare is a good file sharing app for the local network and it works with all the common OSes, including Windows, Mac and Linux.

Installation and Setting Up


1. Go to the NitroShare Launchpad site and download the version for your OS and architecture.

2. Run the installer on your computer. After the installation, it will prompt if you need help in setting up the application.

nitroshare-installation-setup

3. For the first part of the setup, you have to give your current PC a name so other computer running NitroShare can identity you.

nitroshare-installation-pc-name

4. Lastly, NitroShare will scan your network for other machines running NitroShare and add it to its list. The process will take quite some time.

nitroshare-installation-discover-machine

That’s it for the setup. It is very easy and almost effortless.

Usage


Once installed, you should see a widget (also known as the sharebox) on your desktop that allows you to drag and drop the files (that you want to share) onto it.

nitroshare-desktop-widget

The default sharebox is a generic one that doesn’t tie to any PC. If you are connected to many other PC, you can create a sharebox for each PC so when you drag and drop a file onto it, it will go directly to that PC instead of prompting you which PC to send the file to.

Alternatively, you can also access the “Send File to” option from the appindicator to send files to other PC.

nitroshare-send-file-to

Note that NitroShare also allows you to drag and drop a folder of files into the widget. From the appindicator, you just have to select the “Send Directory to” option.

When you share a file, the other computer will show a notification to ask if you want to accept the file. Click “Yes”.

nitroshare-accept-files

Settings


In the Settings section, you can configure the location to store the accepted files and whether to compress them and calculate the checksum of the files to verify their integrity.

You can also change the notification settings to notify you when new files are received or when an error has occurred. Lastly, for the security, you can configure it to automatically accept files when they match a certain regular expression, or always prompt before accepting files.

nitroshare-settings-security

Conclusion


NitroShare is really a handy file sharing app for the local network. If you are in a restricted environment with little or not Internet connection, or you have multiple computers each running different OS, then NitroShare comes in handy to get the files/folders across the network. There are very little setup required and the drag-and-drop feature makes it very easy to use. Try it out and let us know if it is useful to you.