aws RDS for external mysql master

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.External.Repl.html

mysql error #1005 - Can't create table (errno: 150) importing database from another server

http://stackoverflow.com/questions/9018584/error-code-1005-cant-create-table-errno-150/30102503#30102503
Reference link to stackoverflow

This could also happen when exporting your database from one server to another and the tables are listed in alphabetical order by default.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:

vim export.sql

use  databasename100;
SET FOREIGN_KEY_CHECKS=0;
..
..
...sql'sss ....

and it shall work.



reset user password using GRUB and set grub password in the end Ubuntu 14.04 LTS

on boot menu

select  "e" to edit the menu item
find line starting with "linux..." and in the end append  init=/bin/bash
and press
ctrl+x

mount -o remount,rw /
passwd <username>
reboot -f

To set grub password

login as root

# grub2-mkpasswd-pbkdf2 
OR
grub-mkpasswd-pbkdf2

Password: ****
Reenter password: ****
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A

Paste the encrypted long string into the file /etc/grub.d/40_custom

eg. copy the content starting from "grub.pbkdf2.sha512.10000.9CA461100..."

vim /etc/grub.d/40_custom

set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...

grub2-mkconfig -o /boot/grub2/grub.cfg
or 
grub-mkconfig -o /boot/grub2/grub.cfg

if on the local terminal use help of "tee"

grub-mkpasswd-pbkdf2 | tee myhelper.txt

your password content and other text are copied in myhelper.txt, edit this myhelper.txt file and cat its content to /etc/grub.d/40_custom

cat myhelper.txt >> /etc/grub.d/40_custom
grub-mkconfig -o /boot/grub2/grub.cfg

apache xss protection headers

Setting up Apache to emit NoSniff, X-Frame and X-XSS-Protection headers

Security Headers is a service which checks that your web server is not revealing too much information. It does this by checking the HTTP headers returned with every request. The service checks to see if the server information is being leaked or if it’s reporting what scripting language is being used in the X-Powered-By header.
The service also checks and reports on a list of useful security headers like NoSniff, which prevents browsers from MIME-sniffing a response away from the declared content-type. It also checks for headers which prevent clickjacking and cross site scripting by detecting if X-Frame-Options and X-XSS-Protection are defined.

Add the headers to the Apache config file

I decided it would useful to implement these headers on the web servers I support. In particular I wanted to prevent other sites from framing my content within an iframe. By setting the X-Frame-Options to deny I am explicitly disallowing framing of any type. After a little research, these are the headers that my servers now emit:
<IfModule mod_headers.c>
    Header unset ETag
    Header set X-Frame-Options: deny
    Header set X-XSS-Protection: "1; mode=block"
    Header set X-Content-Type-Options: nosniff
    Header set X-WebKit-CSP: "default-src 'self'"
    Header set X-Permitted-Cross-Domain-Policies: "master-only"
</IfModule>
If your using the Joomla CMS, then using deny on the X-XSS-Protection will prevent the media manager from working properly. In this case you will need to relax the setting to use the same origin policy:

Header set X-Frame-Options: sameorigin

ssh error

root@server1:~# service ssh restart
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_ecdsa_key

The root cause of this problem is that sshd daemon somehow is not able to load SSH host keys.
When OpenSSH server is first installed on Linux system, SSH host keys should automatically be generated for subsequent use. If, however, key generation was not finished successfully, that can cause SSH login problems like this.
Let's check if SSH host keys are found where they should be.
$ ls -al /etc/ssh/ssh*key 
make sure size is not zero,
good example:-
 root@server1:~# ls -al /etc/ssh/ssh*key
-rw------- 1 root root  668 Nov 30 18:12 /etc/ssh/ssh_host_dsa_key
-rw------- 1 root root  227 Dec  5 15:03 /etc/ssh/ssh_host_ecdsa_key
-rw------- 1 root root 1675 Nov 30 18:12 /etc/ssh/ssh_host_key
-rw------- 1 root root 1671 Nov 30 18:12 /etc/ssh/ssh_host_rsa_key

[SOLUTION - debian / ubuntu ]
root@server1:~# dpkg-reconfigure openssh-server
Creating SSH2 ECDSA key; this may take some time ...
[ ok ] Restarting OpenBSD Secure Shell server: sshd.

[SOLUTION - redhat/centos]
On CentOS, RHEL or Fedora, all you have to do is to restart sshd after removing existing (problematic) keys.
$ sudo rm -r /etc/ssh/ssh*key

$ sudo systemctl restart sshd

An alternative way to regenerate SSH host keys is to manually generate them using ssh-keygen command.
$ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key 
Once new SSH host keys are generated, make sure that they are found in /etc/ssh directory. There is no need to restart sshd at this point.
$ ls -al /etc/ssh/ssh*key
Now try to SSH again to the SSH server to see if the problem is gone.

ispconfig 3 phpmyadmin 404 not found error


ln -s /usr/share/phpmyadmin /var/www/
service nginx restart

mysupermarket.com/phpmyadmin

enter user/password and login...this will redirecto below url

http://mysupermarket.com/index.php?token=81d1f26028dc0f0f625803c2d1ccd402

it will still give

ERROR 404 - Not Found!
The following error occurred:
The requested URL was not found on this server.
Please check the URL or contact the webmaster.

insert phpmyadmin between domain.com and index.php.... like below
http://mysupermarket.com/phpmyadmin/index.php?token=81d1f26028dc0f0f03c2d1ccd402#PMAURL:server=1&target=main.php&token=81d1f26028dc0f0f625803c2d1ccd402










still need to fix....