reset password of vultr server debian 7

  1. login into console from vultr console panel
  2. restart the server, while server start booting stop it by press esc key
  3. You will see a GRUB boot prompt – press “e” to edit the first boot option.
  4. Find the kernel line (starts with “linux /boot/”) and add init=”/bin/bash” at the end of the line
  5. Press CTRL-X or F10 to boot.
  6. System will boot and you will see the root prompt.then type passwd to change password. put your new password
  7. reboot it again . that’s all

Protect Your Server Against the Dirty COW Linux Vulnerability

Check Vulnerability

Ubuntu/Debian

To find out if your server is affected, check your kernel version.

uname -rv

If your version is earlier than the following, you are affected:

  • 4.8.0-26.28 for Ubuntu 16.10
  • 4.4.0-45.66 for Ubuntu 16.04 LTS
  • 3.13.0-100.147 for Ubuntu 14.04 LTS
  • 3.2.0-113.155 for Ubuntu 12.04 LTS
  • 3.16.36-1+deb8u2 for Debian 8
  • 3.2.82-1 for Debian 7
  • 4.7.8-1 for Debian unstable

CentOS

Some versions of CentOS can use this script provided by RedHat for RHEL to test your server’s vulnerability. To try it, first download the script.

  • wget https://access.redhat.com/sites/default/files/rh-cve-2016-5195_1.sh

Then run it with bash.

  • bash rh-cve-2016-5195_1.sh

If you’re vulnerable, you’ll see output like this:

Output
Your kernel is 3.10.0-327.36.1.el7.x86_64 which IS vulnerable.
Red Hat recommends that you update your kernel. Alternatively, you can apply partial
mitigation described at https://access.redhat.com/security/vulnerabilities/2706661 .

Fix Vulnerability

Fortunately, applying the fix is straightforward: update your system and reboot your server.

On Ubuntu and Debian, upgrade your packages using apt-get.

  • sudo apt-get update && sudo apt-get dist-upgrade

You can update all of your packages on CentOS 5, 6, and 7 with sudo yum update, but if you only want to update the kernel to address this bug, run:

  • sudo yum update kernel

Finally, on all distributions, you’ll need to reboot your server to apply the changes.

  • sudo reboot

start apache2,mysql,nginx from shell script root crontab on ubuntu

in case Debian 3.2.68 distribution . all syntax will be working fine as per my live test.

cd /usr/local/vesta/bin

sudo nano apache-restart.sh

type following..

=========================================================================..

#!/bin/sh

ps auxw | grep apache2 | grep -v grep > /dev/null

if [ $? != 0 ]
then
        service apache2 start > /dev/null
fi
======================================================================================
save it as apache-restart.sh
sudo nano mysql-restart.sh
===================================================================================
#!/bin/bash
/usr/bin/mysqladmin ping| grep 'mysql is alive' > /dev/null 2>&1
if [ $? != 0 ]
then
 sudo service mysql restart
fi
====================================================================================================
save it as mysql-restart.sh

sudo nginx-restart.sh
=========================================================================================

#!/bin/sh
sudo service nginx status > /dev/null

if [ $? != 0 ]
then
 echo "nginx stopped"
 sudo service nginx start > /dev/null
 echo "nginx start"
fi

=============================================================
type crontab -e and type the following shell script to run every minute from root cron user.

* * * * * sh -x /usr/local/vesta/bin/mysql-restart.sh
* * * * * sh -x /usr/local/vesta/bin/apache-restart.sh
* * * * * sh -x /usr/local/vesta/bin/nginx-restart.sh

and save it . that's all. in case any problem you can contact me at [email protected]

 

mysql restart from cron using shell script

check crontab -u root -l - list of cron for user root
cd /home/smruti/
sudo nano mysql-check.sh
==========================================================
#!/bin/bash
/usr/bin/mysqladmin ping| grep 'mysqld is alive' > /dev/null 2>&1
if [ $? != 0 ]
then
    sudo service mysqld restart
fi
======================================
save as  mysql-check.sh
To make it executable chmod 0755 mysql-check.sh
create cron job  crontab -e from command 
type * * * * * sh -x /home/smruti/mysql-check.sh
press esc :wq for save

check it by type sudo service mysqld stop
it will automatically start after 1 min.

iframe youtube video responsive with css

just add this below div along with class video-container format like…

<div class="video-container"><iframe.......></iframe></div>

then put the below css in your site header

.video-container {
	position:relative;
	padding-bottom:56.25%;
	padding-top:30px;
	height:0;
	overflow:hidden;
}

.video-container iframe, .video-container object, .video-container embed {
	position:absolute;
	top:0;
	left:0;
	width:100%;
	height:100%;
}



genesis seo meta action hook for custom post type

add_action( ‘genesis_meta’, ‘custom_meta_seo_listing’,11 );
function custom_meta_seo_listing() {
global $post;
if(!is_singular() ||
genesis_get_custom_field( ‘_genesis_description’ ) ||
genesis_get_custom_field( ‘_aioseop_description’ ) ||
genesis_get_custom_field( ‘_headspace_description’ ) ||
genesis_get_custom_field( ‘thesis_description’ ) ||
genesis_get_custom_field( ‘description’ )
) return;
if(is_single() && get_post_type( get_the_ID()) == “idxc_featlist”){
$address = get_post_meta(get_the_ID(), “_idxc_mb_featuredlistings_address”, $single = true);
echo ‘<meta name=”description” content=”For Sale:’.$address.'” />’;
} else{
if(genesis_get_custom_field( ‘_genesis_description’ ) == “”){
echo ‘<meta name=”description” content=”bahamas real estate” />’;
}
}
}

genesis seo meta tag changes from wordpress action hook

/*
Automatically generates a post/page meta description
for SEO in Genesis framework.
If Genesis doesn't return a description then one is
automatically generated from the excerpt
else from the post/page	content.
*/

add_action( 'genesis_meta', 'my_auto_description' , 11 );

function my_auto_description(){	
	if(
		!is_singular() || 
		genesis_get_custom_field( '_genesis_description' ) ||
		genesis_get_custom_field( '_aioseop_description' ) ||
		genesis_get_custom_field( '_headspace_description' ) ||
		genesis_get_custom_field( 'thesis_description' ) ||
		genesis_get_custom_field( 'description' )
	) return;
	global $post;
	setup_postdata($post); #wp
	add_filter('excerpt_more', '__return_false');	//remove the more text
	add_filter('excerpt_length', 'my_auto_description_length'); #wp	//limit the no of character in the generated description to a custom value
	$excerpt = trim(str_replace('[...]', '', wp_trim_excerpt(get_the_excerpt()))); #wp	//remove [...] from excerpt	
	remove_filter('excerpt_more', '__return_false');	//remove the filter we hooked to earlier
	$description = '<meta name="description" content="' . $excerpt . '" />';
	echo   $description  ;
}

/*
Limits the auto generated description to a certain length.
If not required you can just do `return $length;`
*/

function my_auto_description_length($length) {
	return 150;
}

/*
Automatically generates a post/page meta keywords
for SEO in Genesis framework.
If Genesis doesn't return a keywords then the keywords are
automatically generated from the post-tags or  
else from the post/page	title.
*/

add_action( 'genesis_meta', 'my_auto_keywords' , 11 );

function my_auto_keywords(){
	if(
	!is_singular() ||
	genesis_get_custom_field( '_genesis_keywords' ) ||
	genesis_get_custom_field( '_aioseop_keywords' ) ||
	genesis_get_custom_field( 'thesis_keywords' ) ||
	genesis_get_custom_field( 'keywords' )
	) return;

	$tags = get_the_tags(); #wp

	if ($tags) {
	foreach ($tags as $tag) {
		$keywords[] = $tag->name;
		}
	}

	if ($keywords) {
		$keywords = '';	 
	}
	else {
		$title = get_the_title();
		$keywords = preg_split("/s/", $title);
		$keywords = array_diff($keywords, my_excluded_words());	//remove useless words
		$keywords = '';
	}

	echo $keywords;
}

function my_excluded_words(){
	return array ("a", "able", "about", "above", "abroad", "according", "accordingly", "across", "actually", "adj", "after", "afterwards", "again", "against", "ago", "ahead", "ain't", "all", "allow", "allows", "almost", "alone", "along", "alongside", "already", "also", "although", "always", "am", "amid", "amidst", "among", "amongst", "an", "and", "another", "any", "anybody", "anyhow", "anyone", "anything", "anyway", "anyways", "anywhere", "apart", "appear", "appreciate", "appropriate", "are", "aren't", "around", "as", "a's", "aside", "ask", "asking", "associated", "at", "available", "away", "awfully", "b", "back", "backward", "backwards", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "begin", "behind", "being", "believe", "below", "beside", "besides", "best", "better", "between", "beyond", "both", "brief", "but", "by", "c", "came", "can", "cannot", "cant", "can't", "caption", "cause", "causes", "certain", "certainly", "changes", "clearly", "c'mon", "co", "co.", "com", "come", "comes", "concerning", "consequently", "consider", "considering", "contain", "containing", "contains", "corresponding", "could", "couldn't", "course", "c's", "currently", "d", "dare", "daren't", "definitely", "described", "despite", "did", "didn't", "different", "directly", "do", "does", "doesn't", "doing", "done", "don't", "down", "downwards", "during", "e", "each", "edu", "eg", "eight", "eighty", "either", "else", "elsewhere", "end", "ending", "enough", "entirely", "especially", "et", "etc", "even", "ever", "evermore", "every", "everybody", "everyone", "everything", "everywhere", "ex", "exactly", "example", "except", "f", "fairly", "far", "farther", "few", "fewer", "fifth", "first", "five", "followed", "following", "follows", "for", "forever", "former", "formerly", "forth", "forward", "found", "four", "from", "further", "furthermore", "g", "get", "gets", "getting", "given", "gives", "go", "goes", "going", "gone", "got", "gotten", "greetings", "h", "had", "hadn't", "half", "happens", "hardly", "has", "hasn't", "have", "haven't", "having", "he", "he'd", "he'll", "hello", "help", "hence", "her", "here", "hereafter", "hereby", "herein", "here's", "hereupon", "hers", "herself", "he's", "hi", "him", "himself", "his", "hither", "hopefully", "how", "howbeit", "however", "hundred", "i", "i'd", "ie", "if", "ignored", "i'll", "i'm", "immediate", "in", "inasmuch", "inc", "inc.", "indeed", "indicate", "indicated", "indicates", "inner", "inside", "insofar", "instead", "into", "inward", "is", "isn't", "it", "it'd", "it'll", "its", "it's", "itself", "i've", "j", "just", "k", "keep", "keeps", "kept", "know", "known", "knows", "l", "last", "lately", "later", "latter", "latterly", "least", "less", "lest", "let", "let's", "like", "liked", "likely", "likewise", "little", "look", "looking", "looks", "low", "lower", "ltd", "m", "made", "mainly", "make", "makes", "many", "may", "maybe", "mayn't", "me", "mean", "meantime", "meanwhile", "merely", "might", "mightn't", "mine", "minus", "miss", "more", "moreover", "most", "mostly", "mr", "mrs", "much", "must", "mustn't", "my", "myself", "n", "name", "namely", "nd", "near", "nearly", "necessary", "need", "needn't", "needs", "neither", "never", "neverf", "neverless", "nevertheless", "new", "next", "nine", "ninety", "no", "nobody", "non", "none", "nonetheless", "noone", "no-one", "nor", "normally", "not", "nothing", "notwithstanding", "novel", "now", "nowhere", "o", "obviously", "of", "off", "often", "oh", "ok", "okay", "old", "on", "once", "one", "ones", "one's", "only", "onto", "opposite", "or", "other", "others", "otherwise", "ought", "oughtn't", "our", "ours", "ourselves", "out", "outside", "over", "overall", "own", "p", "particular", "particularly", "past", "per", "perhaps", "placed", "please", "plus", "possible", "presumably", "probably", "provided", "provides", "q", "que", "quite", "qv", "r", "rather", "rd", "re", "really", "reasonably", "recent", "recently", "regarding", "regardless", "regards", "relatively", "respectively", "right", "round", "s", "said", "same", "saw", "say", "saying", "says", "second", "secondly", "see", "seeing", "seem", "seemed", "seeming", "seems", "seen", "self", "selves", "sensible", "sent", "serious", "seriously", "seven", "several", "shall", "shan't", "she", "she'd", "she'll", "she's", "should", "shouldn't", "since", "six", "so", "some", "somebody", "someday", "somehow", "someone", "something", "sometime", "sometimes", "somewhat", "somewhere", "soon", "sorry", "specified", "specify", "specifying", "still", "sub", "such", "sup", "sure", "t", "take", "taken", "taking", "tell", "tends", "th", "than", "thank", "thanks", "thanx", "that", "that'll", "thats", "that's", "that've", "the", "their", "theirs", "them", "themselves", "then", "thence", "there", "thereafter", "thereby", "there'd", "therefore", "therein", "there'll", "there're", "theres", "there's", "thereupon", "there've", "these", "they", "they'd", "they'll", "they're", "they've", "thing", "things", "think", "third", "thirty", "this", "thorough", "thoroughly", "those", "though", "three", "through", "throughout", "thru", "thus", "till", "to", "together", "too", "took", "toward", "towards", "tried", "tries", "truly", "try", "trying", "t's", "twice", "two", "u", "un", "under", "underneath", "undoing", "unfortunately", "unless", "unlike", "unlikely", "until", "unto", "up", "upon", "upwards", "us", "use", "used", "useful", "uses", "using", "usually", "v", "value", "various", "versus", "very", "via", "viz", "vs", "w", "want", "wants", "was", "wasn't", "way", "we", "we'd", "welcome", "well", "we'll", "went", "were", "we're", "weren't", "we've", "what", "whatever", "what'll", "what's", "what've", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "where's", "whereupon", "wherever", "whether", "which", "whichever", "while", "whilst", "whither", "who", "who'd", "whoever", "whole", "who'll", "whom", "whomever", "who's", "whose", "why", "will", "willing", "wish", "with", "within", "without", "wonder", "won't", "would", "wouldn't", "x", "y", "yes", "yet", "you", "you'd", "you'll", "your", "you're", "yours", "yourself", "yourselves", "you've", "z", "zero");
}

[FIX] phpmyadmin some feature/controluser

Installation:
Universal installer with OS Checker

Code: Select all
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma.sh && chmod +x pma.sh && ./pma.sh

or

Code: Select all
sudo wget –no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma.sh && chmod +x pma.sh && ./pma.sh

OS Installation:
Ubuntu

Code: Select all
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-ubuntu.sh && chmod +x pma-ubuntu.sh && ./pma-ubuntu.sh

or

Code: Select all
sudo wget –no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-ubuntu.sh && chmod +x pma-ubuntu.sh && ./pma-ubuntu.sh

Debian

Code: Select all
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-debian.sh && chmod +x pma-debian.sh && ./pma-debian.sh

or

Code: Select all
wget –no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-debian.sh && chmod +x pma-debian.sh && ./pma-debian.sh

CentOS

Code: Select all
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-centos.sh && chmod +x pma-centos.sh && ./pma-centos.sh

or

Code: Select all
wget –no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-centos.sh && chmod +x pma-centos.sh && ./pma-centos.sh

What the script does:
– we don’t use pwgen for generation password anymore, no extra utilities;
– check wget/curl before downloading dump for database;
– universal installer with os detector by Sergey Rodin (VestaCP – https://vestacp.com);
– options savedsearches / navigationhiding / users / usergroups are set (for 4.x phpmyadmin);
– added table pma__usergroups (for 4.x phpmyadmin);
– sql dump on github now;
– sh files on github too.

Tested on different servers: Debian 7/8, Ubuntu 12/14/15, CentOS 6/7

Support 3.x and 4.x version of phpmyadmin
Last edited by skurudo on Sun Jan 17, 2016 8:31 pm, edited 3 times in total.
-> DigitalOcean competition – please, support us
-> fix for phpmyadmin – nice and sweet now

setting of vsftpd for wordpress plugin auto update

Using the package manager for your distribution, install vsftpd. On Debian and Ubuntu, it can be installed by the following command.

$ sudo apt-get install vsftpd

onfigure FTPS

Edit /etc/vsftpd.conf and do the following.

Comment out anonymous_enable line

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
#anonymous_enable=YES

Uncomment local_enable and write_enable lines

# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES

Override the umask for local users to 022 by uncommenting the local_umask line

# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022

NOTE: Failing to do this, will make the plugin directory unreadable by your webserver and you will start getting PHP include errors. If this happens, you have to disable the plugin and remove the directory or change the permission of the directory to 755.

Turn on SSL by adding the following lines. This is disable plain FTP and allow only FTPS

ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES

It is assumed that the RSA certificate and key are in the standard locations /etc/ssl/certs/ssl-cert-snakeoil.pem and /etc/ssl/private/ssl-cert-snakeoil.key respectively. If not, create these and put them there.

# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

Restart vsftpd

Restart vsftpd by issuing the following command.

$ sudo /etc/init.d/vsftpd restart

One final step which is most importance to do this as following.

sudo chown -R www-data:[user_name] [location_of_WordPress]