Thursday 28 November 2013

Fix :: Logon errors in the Plesk File Manager

APPLIES TO: Plesk 7.5 for Windows

 Symptoms
FileList::init() failed: ls_dir_wrapper() failed: Unable to logon user (SERVER_NAMEusername): (1331) Logon failure: account currently disabled.
---------------------- Debug Info -------------------------------
0: C:Program FilesSWsoftPleskadminhtdocsfilemanagerfilemanager.php:672 psaerror(string "FileList::init() failed: ls_dir_wrapper() failed: Unable to logon user (SERVER_NAMEusername): (1331) Logon failure: account currently disabled."



Resolution


The user needs to be enabled using the Computer Management console or the command line:


Go to Computer Management, expand Local Users and Groups, Users, find the user that is disabled, right-click, Properties, General tab, uncheck Account is disabled check-box, click OK


That's it, refresh the window and check.

Wednesday 27 November 2013

Setting up cPanel Plugin

Follow the instructions below to set up the cPanel Integration plugin. The installed plugin will activate an icon within the cPanel interface so that customers can go directly to their backups via the Server Backup Manager Web Interface for Hosting Control Panel users.


1. Click on "Policy" in the Main Menu to access the "Policies" page.















Advanced EditionEnterprise Edition


[caption id="attachment_86" align="alignleft" width="137"]Linux Easy1.1 Linux Easy 1.1[/caption]


[caption id="attachment_85" align="alignleft" width="139"]Linux Easy 1.2 Linux Easy 1.2[/caption]


2. Click on the necessary Policy with Control Panel Instances added.




[caption id="attachment_84" align="alignleft" width="918"]Linux Easy1.3 Linux Easy1.3[/caption]

3. Click on the "Control Panels" tab in the "Policy Details" window.




[caption id="attachment_83" align="alignleft" width="763"]Linux Easy1.4 Linux Easy 1.4[/caption]

4. Click on the "Download Plugin" icon, located in the right column.




[caption id="attachment_82" align="alignleft" width="930"]Linux Easy1.5 Linux Easy1.5[/caption]

5. Upload the file to the server.


6. Extract the file using the following command:



root@addon [~]# tar -vzxf r1soft-cpanel-plugin-1.1.tar.gz

[caption id="attachment_81" align="alignleft" width="522"]Linux Easy1.6 Linux Easy1.6[/caption]

7. Inside the archive, there is a "README" file with directions on how to set it up.




[caption id="attachment_80" align="alignleft" width="599"]Linux Easy1.7 Linux Easy 1.7[/caption]

8. Open the r1redirect.php file in your favorite Linux text editor (vi, emacs, pico, or mcedit).




[caption id="attachment_79" align="alignleft" width="970"]Linux Easy 1.8 Linux Easy 1.8[/caption]

9. Locate the line that contains the following string:



$CDP_SERVER_URL = "..."

Replace the URL with the URL of your Backup Manager (for example, http://10.10.10.10)




[caption id="attachment_78" align="alignleft" width="848"]Linux Easy 1.9 Linux Easy 1.9[/caption]

10. Locate the line that contains the following text:



$CONTROL_PANEL_ID = "..."

Replace the ID with the ID of your Control Panel Instance (for example, 8e367b22-0ce5-481c-98ad-2667d50cf48c).




[caption id="attachment_77" align="alignleft" width="930"]Linux Easy 1.10 Linux Easy 1.10[/caption]

[caption id="attachment_76" align="alignleft" width="848"]Linux Easy 1.11 Linux Easy 1.11[/caption]

11. Copy the r1redirect.php file to your cPanel theme folde


r(s). For example:



root@addon [~]# cp r1redirect.php /usr/local/cpanel

/base/frontend/default/

12. Run the following command to integrate the plugin with cPanel:



root@addon [~]# /usr/local/cpanel/bin/register_cpanelplugin r1soft-cdp.cpanelplugin

13. The Backup Manager link should now appear inside of cPanel.




[caption id="attachment_73" align="alignleft" width="424"]Linux Easy 1.12 Linux Easy 1.12[/caption]

SSH Secure Shell Client





The SSH Secure Shell Client provides secure Telnet and FTP service. Non-secure Telnet and FTP clients cannot be used.



Install Notes




  1. Download the file sshsecureshellclient-3.2.9.exe. Save it to an easily accessible place (your Windows desktop is a good choice).

  2. Start the installation by double-clicking on sshsecureshellclient-3.2.9.exe in Windows Explorer.

  3. When the installation is complete, double click on the Desktop Icon to start the program.

  4. Go the the file menu and select Connect.

  5. Enter the host name E.G. unix.wm.edu.

  6. Enter your username.

How to Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any cached memory on the machine that it is being run on. However when it comes to Cached memory the Linux OS may at times decide that the Cached memory is being used and is needed which can lead to memory related issues and ultimately rob your server of any potentially free memory. To combat this you can force the Linux OS to free up and stored Cached memory.


1.  Connect via shell using a program such as Putty


2. At the shell prompt type crontab -e <enter> as this will allow you to edit cron jobs for the root user.
If you are not familiar with vi (linux editor) you press “i” to insert text and once done hit “esc” and type “:wq” to save the file.


3. Scroll to the bottom of the cron file using the arrows key and enter the following line:




    0 * * * * /root/clearcache.sh



1. Create a file in ‘/root’ called ‘clearcache.sh’ with the following content:




#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches



1. Once you have saved this file, the job is complete!

Monday 25 November 2013

How to change Email server IP in cPanel

Sometimes mail server IP gets blacklisted in the RBL's which causes inconvenience to send / receive emails. To overcome the problem, the mail server IP can be changed so that mails will worked fine.


To change mail server IP:

1) Login to WHM and got to WHM >> Main >> Service Configuration >> Exim Configuration Editor >> Domains and IPs , enable option "Send outgoing mail from the ip that matches the domain name in /etc/mailips"

2) Login in the server as a root user using shell and open file /etc/mailips for editing which will display something like this
*: 111.111.111.111

Replace 111.111.111.111 with the new mail server IP and save the file.

3) Restart exim service
# /etc/init.d/exim restart

Sunday 24 November 2013

Windows 8 Activator :: 2013

KMSpico – is the ideal tool to activate the final version of Windows 7/8 and Office 2010/2013. Actuator does not require user intervention, the entire activation process takes place in the background, just run the activator and a couple of minutes to check the activation status of Windows and / or Office.


Features:

  1. Universal (Activates Windows Vista/7/8 Pro/Enterprise/N/VL and Office 2010/2013 Retail/VL.)

  2. Does not require user intervention (enough to run the activator).

  3. Simultaneous activation immediately and Windows, and Office.


Instruction:
1. Run KMSpico.exe or RunTrigger.cmd
2. Done..

How This Program Works:
1. Run KMSELDI.exe
1.1. Check Products Installed.
1.2. Convert Retail to VL if it is necessary.
1.3. If it found a non-permanent product it will converted. (hacktivators based in modified dll’s ARE NOT PERMANENT) (MAK or OEM keys are the only ones PERMANENT)
1.4. Create a random service kms emulator in memory.
1.5. Activate for 180 days all VL products installed against the emulator.
1.6. Close emulator and KMSELDI.
2. Install Service KMSELDI
2.1. Every windows start or every 24 hours the service reactivate for 180 days (reset the count) with a random kms emulator.
2.2. Close emulator.
3. KMSELDI + Service KMSELDI = “permanent”.



Recommendations:                                                                                                                     – Disable Microsoft Security Updates.
– Make exceptions to Directory %ProgramFiles%KMSpico in Antivirus.
In case you want do everything manually, check the *.cmd scripts inside; they work without .NET Framework 4.0.
Windows 8 activator!


Windows 8 Activator (2,9MiB)

Saturday 23 November 2013

How to Secure PHP

Now a days PHP is an essential part of Web Develop environment, so try to secure from a System Admin’s perspective.


Hardening with php.ini



1) open_basedir = /dir

When the open_basedir parameter is enabled, PHP will be able to access only those files, which are placed in the specified directories



2) expose_php = Off

Turning off the “expose_php” parameter causes that PHP will not disclose information about itself in HTTP headers that are being sent to clients in responses to web requests.



3) register_globals = Of

When the register_globals parameter is turned on, all the EGPCS (Environment, GET, POST, Cookie and Server) variables are automatically registered as global variables. Because it can pose a serious security threat, it is strongly recommended to turn this parameter off.


 You might see some URLs like http://example.com/index.php?name=yourname
If “register_globals = On” the value which client is entering will directly pass to the variable name on PHP, so if an attacker enter a XSS script it will get executed.



 4) display_errors = Off

 If the display_errors parameter is turned off, PHP errors and warnings are not being displayed. Because such warnings often reveal precious information like path names, SQL queries etc., it is strongly recommended to turn this parameter off on production servers.
This is very critical, because one of the first attempt to check a URL is vulnerable to SQL injection is a test like http://example.com/view.php?page=1?



5) magic_quotes_gpc = On

This must be on, because if this is off the “” will read on URL. So if you set this on you can prevent the “admin=1? type of SQL injections (not completely, because an attacker can convert the string to HEX and inject)

Find symlinks pointing to the root file system of CentOS and Debian Servers

Most server admins are aware of the latest vulnerability (often found on cPanel servers) which is been used by many attackers, to create symlinks pointing to the root (/) file system of the server. If an attacker finds the account password of just one user on the server, then he can create (anywhere in the user’s public_html folder) a symlink pointing to / which if opened with Apache allows them to browse the entire directory and file structure of the server, using their browsers.


To find if there are are symlinks pointing to / in any of the users’ public_html folders, run as root the following SSH command and wait patiently for the scan to complete.


root@serv [~]# find /home*/*/public_html -type l -exec ls -l {} ; | grep "-> /$"


If you don’t get any results, then relax.

If you get something like: 


lrwxrwxrwx 1 user user 1 date time /home/user/public_html/folder -> /


Then immediately change the password of this user as it appears that somebody has found their password and created the symlink. Also delete the symlink by running (for the above example) the command:


root@servertechs [~]# rm /home/user/public_html/folder


and answer “y” if asked for a confirmation to remove the symlink

Thursday 21 November 2013

Mount Command In UNIX / LlNUX

The mount command tells the UNIX operating system that a file system is ready to use i.e. mount a file system at a particular point in the system's file system hierarchy.

Mount Command


The syntax is as follows:

mount /dev/XYZN /mount/point
WARNING!

The mount commands require root user privilege or the corresponding fine-grained privilege, unless the file system is defined as "user mountable" in the /etc/fstab file.


Examples


Mount /dev/sda5 (Linux partition) in /data directory:
mkdir /data
mount /dev/sda5 /data
df -H
ls /data
cd /data

Mount /dev/aacd0s1g (FreeBSD UNIX partition) in /salesdata directory:
mkdir /salesdata
df -H
mount /dev/aacd0s1g /salesdata
ls /salesdata
cd /salesdata

Mount /dev/dsk/c1t4d0s0 under Solaris UNIX at /data2, enter:
mkdir /data2
mount /dev/dsk/c1t4d0s0 /data2

To remove mount point run:

umount /salesdata


To mount all file systems listed in /etc/fstab, enter:
mount -a

Further readings:


man mount

How to enable alternative SMTP port in MailEnable

1. Login to the server via RDP.

2. Start>>MailEnable Administrator

3. You are presented with MailEnable administration window.

4. Now go to MailEnable Management>> Servers>>localhost>>Connectors

5. Right click "SMTP" and go to properties.

6. Click on the tab "Inbound".

7. Specify the required port number in the field "SMTP listens on Port". By default it is 25. If the ISP is blocking the port, you can enable the option "Also listen on alternate port" and specify the alternative port.

Backup and Restore individual cPanel accounts

How can I backup and restore individual cPanel accounts with R1Soft CDP?



Solution


cPanel account backups are made with the cpbackup or pkgacct utilities in cPanel.  In addition to the account's or account's home directory files there are dumps of configuration and database queries run by pkgacct.  The full details are available here.  Some of the contents of a cPanel account backup can only be obtained from your WHM server while it is running.


You can always restore the entire state of your WHM server and all cPanel accounts from a CDP recovery point by restoring all files or performing a bare-metal restore.  However, you may at times need to restore only individual cPanel accounts, for example when a cancelled customer decides they want to activate or for accidental changes made to any of the account's configuration in cPanel.


Using the example script below you can periodically create cPanel account backups that do not include the files in the account's home directory since those can easily be obtained by restoring files from a CDP recovery point.



Creating Periodic cPanel Account Packages that Get Protected by CDP

Upload or copy the script below to a file in the directory /etc/cron.daily on your WHM server.  This script will create a package of all your cPanel accounts excluding the /home directory files.


Note:




  • If you have a very large number of accounts on your WHM server it may only be feasible to run this weekly.  This can be accomplished by placing the script in /etc/cron.weekly.

  • The script uses the ionice utility which requires the CFQ io scheduler and kernel 2.6.13+.  If you do not have the ionice utility available remove "ionice -c3" from the script.

  • Ensure you have enough free space in /home to accommodate the size of the account packages created.


#!/usr/bin/perl

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use Cpanel::Config::Users  ();

my @cpusers = Cpanel::Config::Users::getcpusers();
foreach my $user (@cpusers) {

my $cmd = "nice -n 19 ionice -c3 /scripts/pkgacct --skiphomedir " . $user . " 2>&1";
print "############## ";
print $cmd;
print "n";
open my $OUTPUT, '-|', $cmd or next;
while (<$OUTPUT>) {
print $_;
}
close $OUTPUT or next;
}


The resulting configuration backup will be placed in: /home/cpmove-USERNAME.tar.gz and will be automatically backed up by CDP as long as you have selected the /home file system or disk in your Disk Safe for protection.


Restoring an Individual cPanel Account

  1. Use CDP (as the server administrator) to restore the file /home/cpmove-USERNAME.tar.gz to an alternate location (e.g. /tmp)

  2. Login to the cPanel server using SSH and run:  # /scripts/restorepkg --force /tmp/cpmove-USERNAME.tar.gz

  3. Restore the contents of the /home/USERNAME using CDP file restore

Wednesday 20 November 2013

Redirection :: https to http

How to redirect yourdomain from https://yourdomain.com to http://yourdomain.com ?


If you tried all the possibilities with the .htaccess file and your domain is still not redirected from https to http then finally you can add following code in virtual host entry means in httpd.conf file.


Search the 443 entry for a domain and add the code. If the 443 entry are not present then create/add it and then add the following code.



RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R]

For example:


VirtualHost *:443>
ServerName domain.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/domain.com
ErrorLog /var/log/apache2/domain.com_error_log
CustomLog /var/log/apache2/domain.com_access_log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem


RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R]


<Directory “/var/www/domain.com/”>
Order allow,deny
Allow from all
Deny from env=keep_out # see file block-these.inc
</Directory>


</VirtualHost>


Restart the apache and Done

How to uninstall plesk on Linux server

This article may be useful for a small business that has important third-party software, other than Parallels Plesk Panel, installed on their server. If only Parallels Plesk Panel is installed on your server, it would be better and faster to reinstall your Linux OS before uninstalling Parallels Plesk Panel.


Full Parallels Plesk Panel uninstallation

Download this script  at plesk_remove.zip (2Kb) and run it with root privileges on your Linux server:
# sh ./plesk_remove.sh

The script will remove all Plesk packages after your confirmation and shouldn't remove services like FTP, HTTP, etc. But note that some system services may not work after Plesk uninstallation due to their close integration with Plesk.


So, use this script on your own risk.


Feel free to share your experience and opinion about the uninstall script


 

Tuesday 19 November 2013

Skip or Bypass a Fsck :: Linux

It is recommended that you run a fsck on reboot if required. Usually, system automatically determines if fsck required or not. Generally, fsck is run automatically at boot time when the system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as a crash or power loss.


Bypass a fsck using shutdown command


When rebooting the server use the following command



# shutdown -rf now

Above command will reboot the system and will not run auto fsck.


Set Linux kernel option by editing grub.conf / menu.lst


Open grub.conf or menu.lst (usually located in /boot),



# vi /boot/grub.conf

Find kernel line and put fastboot at the end of the kernel line. In the end it should look as follow:



kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 fastboot

Skip fsck by updating /etc/fstab file


Finally, you can edit /etc/fstab file which, contains descriptive information about the various file systems. You will see two numbers at the end of the line for each partition, change the second number to a 0 (zero digit). This will have the system mount the partition but will not run a check when booting. The sixth field, is used by the fsck program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked. Here is sample entry:



LABEL=/disk3 /disk3 ext3 defaults 0 0

How to clean tmp folder automatically

Introduction


Removing temporary files left over in your /tmp folder, is not as easy as it looks like. At least not on a multi-user system that's connected to a network.


If you do it the wrong way, you can leave your system open to attacks that could compromise your system's integrity


Many people have query that how to automatically clean /tmp folder.  I’ve made a simple script to do this task effortlessly.



#!/bin/bash
for i in `/bin/ls -1 /tmp | egrep -v "eaccelerator|mysql.sock|lost+found|CleanTmp.sh"`;
do rm -rfv /tmp/"$i";
done ;
/etc/init.d/httpd restart;
/etc/init.d/mysql restart

If you have other files which you want to exclude and that you do not want to delete that add it after lost+found|


What you have to do is add the above script in any file and add a cron to run the file as per your convenience.


If you have any questions then, please keep them coming in the comments and if you want you can contact me.

How To Delete Temporary Files in Windows XP

Manually cleaning out the Temp folder in Window XP is often a necessary maintenance step when the Windows XP Disk Cleanup utility fails to clean out the Temp folder automatically.


Removing temporary files is a quick and easy task that can help save disk space and keep your PC clean of file clutter.


Just follow the step by step directions below to manually clean out the Temp folder:


Time Required: Manually cleaning out the Temp folder in Windows XP usually takes less than 5 minutes



Here's How:

  •     Click on Start and then Run.



  •     In the text box in the Run window, type %Temp% and click OK. A folder full of files and other folders will appear.



  •     All of the folders and files you see in this Temp folder are no longer being used by Windows XP and can safely be deleted.



  •     To remove individual folders or files, hold down your Ctrl key while left-clicking on each item you want delete. Release the Ctrl key when you're finished.



  •     To delete these items, hit your Delete key or choose File and then Delete from the menu.



  •     Confirm that you want to delete the files by clicking Yes on the Confirm Multiple File Delete window that opens.



  •     If you'd instead like to remove everything inside the Temp folder, choose Edit and then Select All from the menu.



Note: If you're prompted that there are hidden files in this folder, just click on OK to bypass the message. A few hidden files hanging out in the Temp folder probably aren't important enough to worry about.

Now that all of the files and folders are selected, hit your Delete key or choose File and then Delete from the menu.

Confirm that you want to delete the files by clicking Yes on the Confirm Multiple File Delete window that opens.

After all of the files have been deleted you can close the window and empty your Recycle Bin, permanently removing the files from your PC.

Tips: You may receive a Error Deleting File or Folder message while the files are being deleted. This just means that one of the files is in use by a program right now. Click OK, close all open programs, and repeat the steps above. If you still receive the message, try restarting your PC and repeating the process again.

History command

History command examples, which will help you in mastering history command in linux

1. Display timestamp using HISTTIMEFORMAT

Typically when you type history from command line, it displays the command# and the command. For auditing purpose, it may be beneficial to display the timepstamp along with the command as shown below.
# export HISTTIMEFORMAT=’%F %T ‘
# history | more
1  2008-08-05 19:02:39 service network restart
2  2008-08-05 19:02:39 exit
3  2008-08-05 19:02:39 id
4  2008-08-05 19:02:39 cat /etc/redhat-release

2. Search the history using Control+R

I strongly believe, this may be your most frequently used feature of history. When you’ve already executed a very long command, you can simply search history using a keyword and re-execute the same command without having to type it fully. Press Control+R and type the keyword. In the following example, I searched for red, which displayed the previous command “cat /etc/redhat-release” in the history that contained the word red.
# [Press Ctrl+R from the command prompt,
which will display the reverse-i-search prompt]
(reverse-i-search)`red’: cat /etc/redhat-release
[Note: Press enter when you see your command,
which will execute the command from the history]
# cat /etc/redhat-release
Fedora release 9 (Sulphur)

Sometimes you want to edit a command from history before executing it. For e.g. you can search for httpd, which will display service httpd stop from the command history, select this command and change the stop to start and re-execute it again as shown below.
# [Press Ctrl+R from the command prompt,
which will display the reverse-i-search prompt]
(reverse-i-search)`httpd’: service httpd stop
[Note: Press either left arrow or right arrow key when you see your
command, which will display the command for you to edit, before executing it]
# service httpd start

3. Repeat previous command quickly using 4 different methods

Sometime you may end up repeating the previous commands for various reasons. Following are the 4 different ways to repeat the last executed command.

Use the up arrow to view the previous command and press enter to execute it.
Type !! and press enter from the command line
Type !-1 and press enter from the command line.
Press Control+P will display the previous command, press enter to execute it

4. Execute a specific command from history

In the following example, If you want to repeat the command #4, you can do !4 as shown below.
# history | more
1  service network restart
2  exit
3  id
4  cat /etc/redhat-release

# !4
cat /etc/redhat-release
Fedora release 9 (Sulphur)

5. Execute previous command that starts with a specific word

Type ! followed by the starting few letters of the command that you would like to re-execute. In the following example, typing !ps and enter, executed the previous command starting with ps, which is ‘ps aux | grep yp’.
# !ps
ps aux | grep yp
root     16947  0.0  0.1  36516  1264 ?        Sl   13:10   0:00 ypbind
root     17503  0.0  0.0   4124   740 pts/0    S+   19:19   0:00 grep yp

6. Control the total number of lines in the history using HISTSIZE

Append the following two lines to the .bash_profile and relogin to the bash shell again to see the change. In this example, only 450 command will be stored in the bash history.
# vi ~/.bash_profile
HISTSIZE=450
HISTFILESIZE=450

7. Change the history file name using HISTFILE

By default, history is stored in ~/.bash_history file. Add the following line to the .bash_profile and relogin to the bash shell, to store the history command in .commandline_warrior file instead of .bash_history file. I’m yet to figure out a practical use for this. I can see this getting used when you want to track commands executed from different terminals using different history file name.
# vi ~/.bash_profile
HISTFILE=/root/.commandline_warrior

8. Force history not to remember a particular command using HISTCONTROL

When you execute a command, you can instruct history to ignore the command by setting HISTCONTROL to ignorespace AND typing a space in front of the command as shown below. I can see lot of junior sysadmins getting excited about this, as they can hide a command from the history. It is good to understand how ignorespace works. But, as a best practice, don’t hide purposefully anything from history.
# export HISTCONTROL=ignorespace
# ls -ltr
# pwd
#  service httpd stop [Note that there is a space at the beginning of service,
to ignore this command from history]
# history | tail -3
67  ls -ltr
68  pwd
69  history | tail -3

9. Ignore specific commands from the history using HISTIGNORE

Sometimes you may not want to clutter your history with basic commands such as pwd and ls. Use HISTIGNORE to specify all the commands that you want to ignore from the history. Please note that adding ls to the HISTIGNORE ignores only ls and not ls -l. So, you have to provide the exact command that you would like to ignore from the history.
# export HISTIGNORE=”pwd:ls:ls -ltr:”
# pwd
# ls
# ls -ltr
# service httpd stop

# history | tail -3
79  export HISTIGNORE=”pwd:ls:ls -ltr:”
80  service httpd stop
81  history
[Note that history did not record pwd, ls and ls -ltr]

10. To Delete a specific command from history

To delete specific command from history, you can use history -d command
#history |tail -3
1060  clear
1061  cd /
1062  history |tail -3

# history -d 1061

# history |tail -3
1061  history |tail -3
1062  history -d 1061
1063  history |tail -3

I hope today you’ve seen important  history command examples which would help you in your day to day admin task.

HOWTO: Error: 550 'Requested action not taken: mailbox unavailable or not local' when running Plesk

SYMPTOMS

When sending messages through MailEnable the following error is returned in the client:

550 Requested action not taken: mailbox unavailable or not local

Mailbox/es are unable to send and receive.

This article only applies to servers running the Plesk Control Panel and can occur with all mailboxes on the system or only one/some

CAUSE

The Plesk control system has the ability to disable mailboxes within its interface.  To do this the panel edits the MailEnable configuration file (address-map.tab) and adds a ! into the mailbox address which makes the mailbox unrecognisable by the MailEnable services.

To verify this is the case, check in the MailEnable Administration program for a mailbox that is experiencing the issue and see if the mailbox is disabled.  A mailbox that is disabled within MailEnable will have a red cross on the mailbox icon.

For more advanced users, or to verify if Plesk was the service that disabled the mailbox, open the following configuration file;

Program FilesMailEnableConfigAddress-map.tab

and search for any mailboxes that appear like the following entry:

[!SMTP:email@sample.com] a normal mailbox would appear without the ! before the SMTP: part of the configuration string.

RESOLUTION
To resolve this issue, re-enable all the mailboxes within the Plesk control panel, or search through the address-map.tab file and remove all ! characters.

Monday 18 November 2013

Permissions to execute scripts on a virtual directory are not set

The Best Practices Analyzer tool for Team Foundation Server queries the metabase for Internet Information Services (IIS). This query determines the script execute permissions that are set for the virtual directories of the Web sites for Team Foundation.

An error appears if script execute permissions are not allowed for a virtual directory that requires these permissions. The error contains the name of the Web site and the virtual directory where the script execute permissions are not allowed.

To resolve this issue, set the execute permissions to allow script execution for all virtual directories for Team Foundation, including those that are associated with SharePoint Products. You can ignore the execute permissions for SQL Server Reporting Services and all other permissions.

Required Permissions

To perform these procedures, you must be a member of the Administrators security group on the server to which the error message refers.

To change the script execute permissions on a virtual directory in IIS 6.0




  1. Log on to the server to which the error message refers.

  2. Open the Start menu, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.

    Internet Information Services (IIS) Manager opens.

  3. In the tree pane, expand ComputerName (Local Computer), and then expand Web sites.

  4. Expand the name of the Web site that the error specifies.

  5. Right-click the name of the virtual directory that the error specifies, and then click Properties.

  6. On the Virtual Directory tab, select the Scripts only check box for Execute permissions, and then click Apply.

  7. Click OK to close the dialog box.



To change the script execute permissions on a virtual directory in IIS 7.0




  1. Log on to the server to which the error message refers.

  2. Open the Start menu, point to Administrative Tools, right-click Internet Information Services (IIS) Manager, and then click Run as administrator.

    Internet Information Services (IIS) Manager opens.

  3. In the Connections pane, expand ComputerName (Local Computer), and then expand Sites.

  4. Expand the name of the Web site that the error specifies.

  5. Click the name of the Web site or virtual directory that the error specifies.

  6. In the Web Site or Virtual Directory Home area, double-click Handler Mappings.

  7. In the Actions pane, click Edit Feature Permissions.

    The Edit Feature Permissions dialog box opens.

  8. Verify that the Read and Script check boxes are both selected.

  9. Click OK to close the dialog box.


Script to list all cPanel accounts under specific reseller

To list of all cPanel accounts under a specific reseller account, then you can  use the this simple shell script.

root@server[#] vi listreseller.sh
 #!/bin/bash
usage()
{
echo "Example : $0 domain.com or username"
exit 1
}

test $1 || usage
USERN=$(grep $1  "/etc/userdomains" | awk '{print $NF}' | awk 'NR==1')

if [[ -z $USERN ]]
then
echo -e "e[1;33m $1 is not a reseller e[0m"

exit 1

fi

OWNER=`cut -d: -f1  /var/cpanel/resellers | grep -o $USERN`
exitstatus=$?

if [ "$exitstatus" == 0 ] ; then
echo  "=========================================================="
echo -e  "e[1;31m Below are the accounts associated with the reseller $name e[0m"
echo "=========================================================="

output=$(for i in `grep $OWNER /var/cpanel/users/* -l` ; do grep USER= $i ; done | awk -F"=" '{ print $2 }')
echo -e   "e[1;33m $output e[0m"
else
echo -e  "e[1;35m  $1  is not  a Reseller  e[0m"
exit

fi

 

root@server[#] chmod +x listreseller.sh

Copy the above script in a .sh file like listreseller.sh and allow executable permission to listreseller.sh file and then execute it as:

root@server[#] ./listreseller resellerusername

root@server[#] ./listreseller resellerdomain.net

After executing the script you will get the below output as ::

root@server[#] ./listreseller linuxeasy.net
==========================================================
Below are the accounts associated with the reseller
==========================================================
linuxeasy
servertech
jpssolu

root@server[#] ./listreseller linuxeasy1
linuxeasy1 is not a reseller

** Its all About to share **

Changing mail server ip address :: PLESK

If primary mail server ip address is  blocked in any spam checker sites ( eg BARRACUDA,SORBS-SPAM etc)  then there is only one solution, that is change the mail server ip address on the server.

You can easily change the mail server ip address in cPanel by using /etc/mailips file. The same as in PLESK you can also change the outgoing mail server ip address by using “/var/qmail/control/smtproutes” file.
1) first check the domain name which is hosted on the server by using following file

cat /var/qmail/control/rcpthosts
domain1.com
domain2.com
domain3.com
domain4.com
domain5.com

2) By default the “/var/qmail/control/smtproutes” file  is not present on PLESK server, you need to create it.

vi /var/qmail/control/smtproutes

3) Then add the new ip address in the following format.

domain1.com:192.168.0.2
domain2.com:192.168.0.2


4) Save the file and restart qmail

/etc/init.d/qmail restart

List all cPanel users having Wildcard Remote Mysql Access

Remote MySQL option in cPanel allows other webservers to access the MySQL database on your server remotely.

Remote MySQL option can be very handy, if  you want  to allow applications like shopping carts or guestbooks on your other servers to access the databases.

But on the contrary, if the Remote MySQL option is not handled with  care  then  it can lead to database hacks.

So, If you want to find out all cPanel users having Wildcard Access enabled then  you can  use the below simple command ::
root@server[#]mysql -N  mysql -e "Select User from user where Host='%'" | awk  -F _ '{print $1}' | uniq

Stop Spamming on cpanel server

There are number of ways, but you must enable/disable some Tweaks on cpanel server.

Setting in Exim Configuration Manager

  • Login to WHM control panel by using root user

  • Go to Main >> Service Configuration >> Exim Configuration Manager

  • Enable RBL filtering by Basic Editor >> RBLs >> switch to “On” and if you like you may additional RBL from manage option.

  • Sender Verification Callouts = ON

  • Sender Verification = ON

  • Reject SPF failures =ON

  • Then save all the configuration this will stop most of spams in the server


Some setting in Tweak Setting

  • Login to WHM control panel by using root user

  • Goto Main >> Server Configuration >> Tweak Settings

  • Initial default/catch-all forwarder destination = Fail

  • Max hourly emails per domain = 200

  • Count mailman deliveries towards a domain’s Max hourly emails = ON

  • Maximum percentage of failed or deferred messages a domain may send per hour = 60%

  • Then save all the configuration this will stop most of spams in the server.


 

Nginx 502 Bad Gateway :: Could not export database using PHPMyAdmin

APPLIES TO: Parallels Plesk Panel 11.5 for Linux


Symptoms


The following error is shown when I try to export the database using PHPMyAdmin:


Nginx 502 Bad Gateway


According to the release notes, the issue was fixed in #MU14. However, I have installed all the Micro-Updates, and the issue persists.


Cause


This issue has another root cause and will be fixed in a future product update.
Resolution


As a workaround, you may disable aps:


Set apc.enabled = 0 in the /usr/local/psa/admin/conf/php.ini configuration file.


Restart sw-engine:


# /etc/init.d/sw-engine restart

Saturday 16 November 2013

Moving Magento to Another Host or Server

The following article will outline the steps and commands involved to successfully transfer Magento from one server to another. This article assumes you
have a basic understanding of SSH, and that you have SSH access on both servers.

Overview
Here is an overview of the steps we’ll take to do this:

Make a MySQL dump file of the database
Archive the media and theme directories
Copy the files to the other server
Install a clean version of Magento
Import the dump file to a blank database
Move our copied data to the correct places
TO DO:

Include commands for saving app/code/local/ folder
Copy extensions and plugins
Then copy all to one handy script (would be great if mage supplied it)

Old Server
The first thing you’ll want to do is login to the server where Magento currently resides. You will need to go to the directory where Magento is installed. For the sake of this article, I’m going to assume your directory structure on both servers looks like this:

/home/username/public_html/
The public_html directory is considered the root directory for your domain, so if we had a file called test.html in there, it would be accessible like so:

http://www.example.com/test.html
With that in mind, we need to go to the directory where Magento is installed. In our case, it’s installed in the root of the domain, so once we are logged in we will run the following:

cd public_html
By default, when you login to SSH it will place you in the very root directory that you have access rights to, which is typically one directory above the public_html directory.

We will start by making a folder called backup, so we can place all of the files we want to transfer over to the new server in:

mkdir backup
MySQL Dump
Now we need to create a MySQL dump file of our database:

You can create a dump file and import it into your new database using one line in your terminal. You need to have remote access the the old server.

mysqldump -h oldhost -u oldusername -poldpassword --single-transaction olddbname | mysql -h newhost -u newusername -pnewpassword newdbname
Otherwise, you may do the following

mysqldump -h DBHOST -u DBUSER -pDBPASS --single-transaction DBNAME > data.sql
You will need to replace the values with the correct information:

DBHOST - Database host name, usually just localhost
DBUSER - Database user with access rights to the database
DBPASS - The password for the database user
DBNAME - The name of the database that Magento is using
NOTE: If you’re running MySQL 4.x, you should include the following option:

--default-character-set=utf8
NOTE: If your password contains special characters or punctuation marks—for example, if your password was U!re+Ha_A?r2anp—you’ll want to use this command instead:

mysqldump -h DBHOST -u DBUSER -p --single-transaction DBNAME > data.sql
After you run this command, it will ask you to enter the database password, and you can safely enter it.

Depending on the size of your database, this can take a couple seconds to a couple minutes. If no errors are reported and you’re left with a new command line, then the dump file was created successfully. We can safely move this to the backup directory we created earlier:

mv data.sql backup/
Media Directory
Now let’s compress the contents of the media directory:

tar -cvf media.tar media/*
And move it over to our backup directory:

mv media.tar backup/
Theme Files
Next, we’re going to copy the theme directory from both the app and skin directories. For the sake of this article, I’m going to assume you have not created a new interface, and that we’re using the default interface instead. We’ll start with the theme in the app directory:

cd app/design/frontend/default/
If you were wondering what I meant by interface, it’s the last directory in the previous command. Most people do not create a new interface, but if you did, you’ll want to change the last directory name with the interface name you’re using.

The directory we’re in now is where all the themes for the default interface reside. There should already be a folder in here called default. I hope you’re not modifying the files in this directory to customize the theme for your website. If you have, you’ll want to rename this directory to something more appropriate so it does not get overwritten when you upgrade Magento.

For the sake of this article, we’re going to assume that our theme is called mytheme, so let’s compress it:

tar -cvf app.tar mytheme/
We need to move this tar file to our backup directory now:

mv app.tar ../../../../backup/
We need to do the same thing for the theme in our skin directory, so let’s change in to that directory:

cd ../../../../skin/frontend/default/
This works the same way as the interface and theme in the app directory. If you’re using another interface, change the last directory name out with your interface name. Just like the app directory, we should have a directory in here called mytheme, so let’s compress that as well:

tar -cvf skin.tar mytheme/
And move it to our backup directory:

mv skin.tar ../../../backup/
Now let’s head back to the main directory:

cd ../../../
Config File
Only thing left is our config file. This file contains the encryption key, the user name and password to connect to the database. If the connection parameters are different between your old and new servers, then you need to edit this file to reflect the changes. The editing is straight forward as the password for the database connection is not encrypted. Now, let’s copy that over as well:

cp app/etc/local.xml backup/
Important note about caching! If you are using apc caching (apc in local.xml) and are creating a copy of the installation on the same server, you MUST change the setting to a new value. The reason for this is that if apc cache is used, magento will save all cache entries in the apc itself instead of /var/cache directory. And the apc cache storage is the same for the whole server, it knows nothing about installations, and setting is the only thing that can tell it which website each cache entry belongs to. If you have two sites running with the same prefix, some very strange and hard-to-find errors may occur like data from one shop appearing in another shop’s menus, spontaneous redirects to the other shops’ url in back-end, changing of settings in backend affecting the other installation etc, etc.

Alright, so we have all of the data we need!

If you omit this file in the new server, you will have to go through the setting up process the first time you browse your site in the new server. Here, Magento will make a new encryption key which will cause problems with the credit card information and passwords in the database.

NOTE: If you want to copy your .htaccess or php.ini (assuming you have one) in to the backup directory, now is the time to do it. You don’t need the .htaccess or php.ini file unless you’ve made changes to them. However, if you do want to move them over, run the following command:

cp .htaccess php.ini backup/
Our backup directory will now have the following files in it:

local.xml
app.tar
data.sql
media.tar
skin.tar
New Server
NOTE: Before continuing to move your site make sure that your server has all the necessary software components installed. Do the Magento Server Compatibility Check as described here: http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento.

A couple of tips:

1) PDO for mysql needs to be installed (ubuntu: apt-get install php5-mysql)

2) The curl extension for PHP5 needs to be installed. (ubuntu: apt-get install php5-curl). Without this when attempting to access the admin login you will see a blank page on the server you have transferred the Magento install to.

IMPORTANT NOTE FOR MAMP USERS: You must select PHP 5.2 in the PHP preferences!

We’re ready to set Magento up on the other server now, so SSH in to your account and go to your public_html directory:

cd public_html
We now want to grab all of the files from the other server, but let’s create a backup directory here so we have somewhere to move the files:

mkdir backup
And let’s go in to that directory:

cd backup/
Copy Files
Time to grab the files from the remote server:

wget http://www.example.com/backup/local.xml
wget http://www.example.com/backup/app.tar
wget http://www.example.com/backup/data.sql
wget http://www.example.com/backup/media.tar
wget http://www.example.com/backup/skin.tar
You’ll want to replace the above URLs with the IP address or domain name from the old server. Usually whatever domain you had setup on the old server will be the same one you have on the one.

NOTE: If you’ve already updated the DNS nameservers for your domain and it’s pointing to the server we’re moving the files over to, you cannot use the domain name. Use the IP address instead. If you haven’t updated the nameservers for your domain yet, then you can use that.

IMPORTANT SECURITY NOTE: Using the method above you are putting all of your data (including credit card data if you are storing it), your website files and the config file containing your database password on the public internet for anyone to download. If you must use this method, you may want to use something other than /backup as your path, and you will certainly want to delete the files immediately when you have copied them. Consider putting the files in a private folder and copying via SFTP instead.

Alternatively you can do a secure copy (SCP) as below:

scp -r username@example.com:/home/username/public_html/backup .
Sure this copy will be really secure only if /backup folder is out of /public_html as below:

scp -r username@example.com:/home/username/backup .
Now we have all of our files over here. So let’s do a clean install of Magento. We need to go back to the public_html directory, because right now we’re still in the backup directory:

cd ..
Install Magento
Ok, time to install Magento:

wget http://www.magentocommerce.com/downloads/assets/1.6.0.0/magento-1.6.0.0.tar.gz
tar -zxvf magento-1.6.0.0.tar.gz
mv magento/* magento/.htaccess .
mv php.ini.sample php.ini
chmod o+w var var/.htaccess app/etc
chmod -R o+w media
Import Database
If you haven’t setup a blank database on this server yet, do so now. We’re going to import the data from the dump file in to this database:

mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < backup/data.sql
Replace the values like you did when we created a dump file.

PEAR Downloader
Now we want to initialize the PEAR registry and let Magento update anything in our database that needs to be updated:

chmod 550 ./mage
./mage mage-setup .
./mage install community Mage_All_Latest
Lastly, a little bit of cleanup:

rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -rf magento/ magento-1.6.0.0.tar.gz
rm -rf index.php.sample .htaccess.sample STATUS.txt
Restore Media & Theme
Almost finished! We just have to move the media directory back in place and the themes:

cp backup/app.tar app/design/frontend/default/
cp backup/skin.tar skin/frontend/default/
cp backup/media.tar .
And we need to extract the data:

cd app/design/frontend/default/
tar -xvf app.tar
rm -rf app.tar
cd ../../../../skin/frontend/default/
tar -xvf skin.tar
rm -rf skin.tar
cd ../../../
tar -xvf media.tar
rm -rf media.tar
cd ..
Restore Config File
If your database details have changed from what you had on the old server, you’ll need to edit the local.xml file and update the appropriate information. It should be pretty clear what you need to update in there, all the fields are plain and not encrypted.

So the last thing left to do is to move the local.xml file where it belongs:

mv backup/local.xml app/etc/
Magento Connect Extensions & configurations
To migrate your extensions you need to copy these folders:

app/code/community
app/code/local
app/etc/modules
js
Update 1
You need to edit a few things in the database if your changing domain names or if you’re using a test server that’s just an IP address. Using PHPMyAdmin, Navicat or something similar, connect to the database. Table core_config_data has rows that need to be changed and updated with the new url. For a single store installation you need to just update:

path: value:
web/unsecure/base_url http://[you_domain_here]/
web/secure/base_url https://[your_secure_domain_here]/
with multiple stores you need also change:

path: value:
web/unsecure/base_url http://[you_domain_here]/
web/secure/base_url https://[your_secure_domain_here]/
web/unsecure/base_link_url http://[your_domain_here]/
web/unsecure/base_skin_url http://[your_domain_here]/skin/
web/unsecure/base_media_url http://[your_domain_here]/media/
web/unsecure/base_js_url http://[your_domain_here]/js/
web/secure/base_link_url https://[your_secure_domain_here]/
web/secure/base_skin_url https://[your_secure_domain_here]/skin/
web/secure/base_media_url https://[your_secure_domain_here]/media/
web/secure/base_js_url https://[your_secure_domain_here]/js/
~Fastmover

evisboy on forums provide example of code for MySQL:

UPDATE core_config_data SET value="unsecure.domain.com" WHERE path=’web/unsecure/host’;
Propose: I think ‘web/unsecure/host’ should be changed to ‘web/unsecure/base_url’ in the last line above here.

~ bdugan

Have A Beer (STZBR!)
That’s it! Open up your browser and your site should be working. If it is, you can delete the backup directory on the new server:

rm -rf backup/
The data on the older server is safe to delete as well.

Alternative Method
The above method starts you out with a fresh, clean installation of the latest version of Magento. If you experience problems using this method, there’s another way to copy the data.

Follow the instructions above for creating a MySQL dump file, and leave that in the directory where Magento is installed. Make sure you Refresh or Disable the cache before exporting the database. You can also do an “Export” via phpMyAdmin.

You’re then going to archive the entire public_html directory, so you’ll want to be one directory above the directory where Magento is installed:

tar -cvf backup.tar public_html/
You will then need to use wget like we did before to transfer this file from the old server to the new one. Extract the data from the backup archive we created:

tar -xvf backup.tar
And move it out of it’s directory:

mv public_html/* public_html/.htaccess .
You can remove the extracted public_html directory now. Do not confuse this with the public_html directory for your site, this is only the name of the directory that was in our backup file!

rm -rf public_html/
Now you need to create a blank database and import the MySQL dump file to it. The instructions are listed in the previous method.

Open the new database with phpMyAdmin (or however you prefer), go to the [mage]core_config_data table, and edit the web/unsecure/base_url and web/secure/base_url (config_id’s 2 and 3) rows to reflect the new URL of the new server.

(Note: some seem to avoid this step by changing the paths to { {base_url} } in the Admin section [System?Configuration?General?Web?Secure and Unsecure] before attempting to move the site, and then changing it in the Admin after the move.)

(Another quick way to deal with the URL changes is to load the SQL dump into Editplus or something similar and search and replace the URLs before importing)

Edit the local.xml (app/etc/local.xml) file and update the database variables if they’ve changed (but keep the same security/encryption key).

Lastly, in order to make magento connect to work correctly edit the pear.ini (downloader/pearlib/pear.ini) and update al the paths that you see in this file. Otherwise magentoconnect will try to upgrade your old site when you use it.

(the files downloader/pearlib/pear downloader/pearlib/peardev downloader/pearlib/pecl may also need the paths updating if you have changed the path)

(Note: Updating this file -pear.ini- is a tedious job, because when you change the paths, you also need the update the field before it which starts with “s:”. You need to type in the length of characters of the path field that you have updated.)

A simple helper script to generate a new the pear.ini file: drop your old pear.ini in the same directory as the PHP script, adjust the paths in the script, open it in a browser and paste the contents into your new pear.ini.

header('Content-type: text/plain');
$contents = explode("n", file_get_contents('pear.ini'));
$data = unserialize($contents[1]);

foreach($data as $key => $value) {
if(is_string($value)) {
$data[$key] = str_replace('/old/path', '/new/path', $value);
}
}

echo $contents[0] . "n";
echo serialize($data);
?>
Note: The code above splits the ini file into lines by detecting the “n” character - depending on the operating system you are running on the correct new line character to split your file may vary.

Make sure there is nothing in the cache directory (var/cache and var/session):

rm -rf var/*
Finally make sure the permissions are still correct on the new server:

chmod o+w var var/.htaccess app/etc
chmod -R o+w media
If you find any errors, make sure folder permissions are set to 755 and file permissions to 644. If your administration submenu pulldowns don’t work, make sure /js/index.php is 644.

That’s it, you’re all done!

Friday 15 November 2013

HOWTO: Error: 550 'Requested action not taken: mailbox unavailable / not local' when running Plesk

SYMPTOMS

When sending messages through MailEnable the following error is returned in the client:

550 Requested action not taken: mailbox unavailable or not local

Mailbox/es are unable to send and receive.

This article only applies to servers running the Plesk Control Panel and can occur with all mailboxes on the system or only one/some.

CAUSE

The Plesk control system has the ability to disable mailboxes within its interface. To do this the panel edits the MailEnable configuration file (address-map.tab) and adds a ! into the mailbox address which makes the mailbox unrecognisable by the MailEnable services.

To verify this is the case, check in the MailEnable Administration program for a mailbox that is experiencing the issue and see if the mailbox is disabled. A mailbox that is disabled within MailEnable will have a red cross on the mailbox icon.

For more advanced users, or to verify if Plesk was the service that disabled the mailbox, open the following configuration file;

Program FilesMailEnableConfigAddress-map.tab

and search for any mailboxes that appear like the following entry:

[!SMTP:email@sample.com] a normal mailbox would appear without the ! before the SMTP: part of the configuration string.

RESOLUTION

To resolve this issue, re-enable all the mailboxes within the Plesk control panel, or search through the address-map.tab file and remove all ! characters.

Thursday 14 November 2013

PleskMainDBException - Resolved

ISSUE: Logging into Plesk fails and you receive the following message:

ERROR: PleskMainDBException
Source: Microsoft OLE DB Provider for SQL Server
Description: Cannot open database "psa" requested by the login. The login failed.

0: plibcommon_func.php3:600
db_mssql_connection()
1: plibcommon_func.php3:629
reconnect()
2: plibcommon_func.php3:590
db_connect()
3: auto_prependauth.php3:87


CAUSE: This happens when Plesk is not able to log into its PSA database. The most common causes for this are:
1) SQL is not running
2) The "admin" user's password was changed.

RESOLUTION:
Part 1: Reset the "admin" password in SQL.

Log into the server via remote desktop
Ensure that SQL is running.
Open up SQL Server Management Studio and connect to the local server.
In Management Studio, Go to Security > Logins.
Right-Click on the "admin" user and select "Properties"
Under "Password" and "Confirm Password", type in the new password and then click "OK"

Part 2: Reset the "admin" password in Plesk.

Click on Start > Run. Type "cmd" and press enter.
In the command prompt, type (the quotes are required): "%plesk_bin%PleskSrvClient.exe"
A "Set Plesk Admin Password" dialog will appear. It will display an error message indicating that it can not connect to the Plesk SQL Server. That is OK.
Type in the same password you typed above and then click "OK" followed by "Yes".
You will now be able to log into Plesk with the password you entered.

Wednesday 13 November 2013

WebAdmin link for MSSQL database shows 404 page not found

Error:

WebAdmin link for a Plesk user's MSSQL database shows 404 page not found.

Login To Plesk >> Databases >> WebAdmin show below error(Redirects to URL below):

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /mssql/app/connect.aspx

Version Information: Microsoft .NET Framework Version:2.0.50727.3649; ASP.NET Version:2.0.50727.3618

Solution:

1. Firstly try to ping the sub-domain mssql.mydomain.com and check if it is working or not, if not, you need to create a dns entry for mssql. If the same error still persists, you can run the following commands in the 'cmd'.

2. Run the commands one by one in 'cmd'

> cd %plesk_bin%

> websrvmng.exe --reconfigure-sqladmin
> defpackagemng.exe --fix --type=sqladminmssql

Tuesday 12 November 2013

How To Block Facebook ?

1. Go to Start > Programmes > Accesories
2. Then Right click on Notepad and Run it as administrator.
3. Now open host file by clicking on File > Open and locate to following address


C:WINDOWSsystem32driversetc


4. Then just below # 127.0.0.1 localhost paste folowing code


# Blocking Facebook
127.0.0.1 login.facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 apps.facebook.com
127.0.0.1 blog.facebook.com


5. Now save the host file and done.
6. Open any browser and try to open facebook. It won't open. If facebook opens then you might have done somthing wrong. (let me know if you face any problem)


Blocking Other Website
If you want to block website other then facebook then change facebook address with whatever website you want to block. For example: to block google paste following code below # 127.0.0.1 localhost


# block google
127.0.0.1 www.google.com



Tuesday 5 November 2013

Xen and KVM

Xen :

Xen was first shipped in RHEL 5.0 and provided integrated virtualization capabilities for the first time. Paravirtualizatin techniques are used to allow modified operating systems to run on older x86 processors that do not have support to modern virtualization extensions. If the system processor does supports virtualization extensions, unmodified OS such as Windows Server 2003 can be run in a guest. The system is booted to run Xen hypervisor, which then boots a RHEL VM running a modified linux kernel. This first guest is privileged, and has ability to do control and access the resourses of other VM. The Xen hypervisor is and will continue to be fully supported RHEL on the 32bit x86, x86_64 and 64-bit ia64 version of the distribution.

KVM :

The kenrel based virtual machine integrates support for virtualization directly into the linux kernel. A normal, unmodified linux environment is booted as the host, which can then be used to start over virtual machines as guests. KVM needs processor vitualization support (i.e VT-Support), so it cannot be used on older x86 hardware. Operating system do not need to be modified to run on a KVM guest virtual machine. However KVM can use paravirtualization techniques to speed up virtual machine system performance if appropriate drivers for the VM OS are installed. In addition by integrating the hypervisor code into the kernel , the design of the system is actually simplified and support of the system is easier . KVM is fully supported in RHEL on the x86_64 arch starting with RHEL 5.4, and is the basis of the thin hypervisor product provided in RHE-V.

How to Install two php version on plesk

1. SSH to your Parallels Plesk Panel (PP) server as root, download the PHP source, unpack it, and configure it

# cd /usr/local/src
# mkdir php540
# cd php540
# wget http://www.php.net/get/php-5.4.0.tar.gz/from/at2.php.net/mirror
# tar xzvf php-5.4.0.tar.gz
# cd php-5.4.0

Note: You HAVE TO USE THE PREFIX SWITCH in order for your new PHP to be installed inside a single directory. For example:

# ./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php540-cgi' '--with-config-file-path=/usr/local/php540-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-fastcgi' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php540-cgi' '--with-png-dir=/usr/local/php540-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php540-cgi' '--with-openssl' '--with-pspell' '--with-pcre-regex' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--with-unixODBC=/usr' '--enable-shmop' '--enable-calendar' '--without-sqlite3' '--with-libxml-dir=/usr/local/php540-cgi' '--enable-pcntl' '--with-imap' '--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-bcmath' '--with-xmlrpc' '--with-ldap' '--with-ldap-sasl' '--with-mysql=/usr' '--with-mysqli' '--with-snmp' '--enable-soap' '--with-xsl' '--enable-xmlreader' '--enable-xmlwriter' '--enable-pdo' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear=/usr/local/php540-cgi/pear' '--with-mcrypt' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php540-cgi/php.d'

As you can see, this is the prefix: /usr/local/php540-cgi/
Choosing a prefix is a MUST because it prevents your new PHP installation from interfering with the older PHP version used by PP.

2. Compile your PHP:
# make

3. Install your new PHP:
# make install

4. Create a PHP wrapper. For example, let’s say you have a customer, domain.com, that uses some newer PHP functions that don’t exist in the default PHP 5.1. Let’s call that customer domain.com. We will tell Apache to use our new PHP version (5.4.0) for him:
# cd /var/www/vhosts/domain.com/cgi-bin
# mkdir .cgi_wrapper
# cd .cgi_wrapper

Create a new file, .phpwrapper, with the following content:

#!/bin/sh
export PHPRC=/var/www/vhosts/domain.com/etc/
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=1000
exec /usr/local/php540-cgi/bin/php-cgi

Set necessary permissions and privileges for created files and directories:
# chgrp psaserv /var/www/vhosts/domain.com/cgi-bin
# cd /var/www/vhosts/domain.com/cgi-bin
# chmod 101 .cgi_wrapper
# chmod 500 .cgi_wrapper/.phpwrapper
# chown domain.com:psacln .cgi_wrapper -R
# chattr -R +i .cgi_wrapper

5. Make Apache aware of our new PHP wrapper. PP offers an option to change the httpd setup per host. We will use this option to tell Apache domain.com needs to use our new PHP wrapper instead of the one provided by PP:
# cd /var/www/vhosts/domain.com/conf

Create a vhost.conf file there with the following content:


RemoveHandler fcgid-script

AddHandler fcgid-script .php

SetHandler fcgid-script
FCGIWrapper /var/www/vhosts/domain.com/cgi-bin/.cgi_wrapper/.phpwrapper .php
Options +ExecCGI
allow from all


So far, we have told Apache not to use the default PP PHP wrapper (RemoveHandler fcgid-script) and instead, we created a new handler for PHP files. When executing PHP files on the domain.com domain, Apache will call the new PHP wrapper and use the new PHP that was installed in Steps 1-3.

6. Reconfigure the domain.com domain:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com

7. Restart Apache:
# /etc/init.d/httpd restart

Fixing Plesk Horde Webmail

Sometimes you may see horde webmain in plesk windows showing page not found errors or not working properly during sending email via webmail. Here is the general fix for all the problems.

"%plesk_bin%websrvmng.exe" --reconfigure-webmail
"%plesk_bin%defpackagemng.exe" --fix --type=webmail.horde

Hope this helps.

Saturday 2 November 2013

How to fix URL file-access is disabled Issues

URL file-access is disabled in the server configuration

This error arises when allow_url_fopen is set to “OFF” in the server’s php.ini file – which is the default value for (I believe) PHP 5. That setting controls your script’s access to the include and require statements and access to remote files. As such, there are certainly security concerns, so don’t follow my suggestion below until you understand if you really need it, why you need it, and that your script is safe and sanitizing data.

Just like my last Quick Tip for 1and1.com this is another quick fix, just a little different. If you manage your own server, just locate and edit the php.ini file. However, for folks using shared hosting (I suspect the majority) that’s not going to be an option.

However, you may be able to create your own “local” php.ini file. Add the following line:

allow_url_fopen = ON

Save the php.ini and upload it to the main directory of your site and test. For my 1and1 hosted app this worked instantly and solved my issues.

I’ve seen similar solutions that involve adding the following to the .htaccess file:

php_flag allow_url_fopen on

With 1and1, though, this only generates HTTP 500 errors and a busted app. However, it is definitely worth a shot on other hosting company servers.