Enable linux root access on Microsoft Azure Cloud

How to enable linux root access on Microsoft Azure Cloud

1. Login via ssh using your sudo user on your Microsoft Azure linux server

2. Now login as root user

[root@lin ~]# sudo su -

3. check if root access is set (LOCK means that root access is disabled)

[root@lin ~]# grep root /etc/shadow

Result:
root:*LOCK*:14600::::::

4. enable root access  (as root user enter command passwd)

[root@lin ~]# passwd

5. Now enter your password and root access is enabled.

You can check this by using command “grep root /etc/shadow”

That’s all folks

 

Redirect web traffic based on Country origin

You can enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.
Redirect web traffic based on Country origin to subdomain or to different web site.

You will find the IP geolocation option by going to:
Webiste –>CloudFlare Settings –>IP Geolocation

Direct link is:
https://www.cloudflare.com/cloudflare-settings?z=YOURSITE

Once enabled, Cloudflare will then add a header called “CF-IPCountry” to all requests to your website.

Redirect web traffic based on Country origin

Here are a couple of examples of how to access/store this value:

$country_code = $ENV{"HTTP_CF_IPCOUNTRY"}; # to access in Perl
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; // to access in PHP

CloudFlare includes this information for both IPv4 and IPv6 addresses

In your website code capture that header and redirect traffic.
Redirect web traffic based on Country origin PHP sample:

$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

if($country_code=="US"){
$location='http://www.mysite.com/us';
}elseif($country_code=="UK"){
$location='http://www.mysite.com/uk';
}else{
$location='http://www.mysite.com/us';
}
header("location:$location");
exit;

Update:

ASP.NET example:
http://netjunky.net/redirect-web-traffic-with-cloudflare-and-asp-net/

Delete exim queue

Delete exim queue sometimes is impossible task.
There are just to many emails and queue manager is to slow.

You can use this dirty trick:

cd /var/spool/exim
find input -type f -exec rm -rf {} \;
find msglog -type f -exec rm -rf {} \;
service exim restart

Warning
This will erase all your emails from queue.

Backup odoo 8 database automatically

Great tool if you need to backup odoo 8 database periodically.
Work as odoo module.
Take automated back-ups, remove them automatically and even write them to an external server through an encrypted tunnel. You can even specify how long local backups and external backups should be kept, automatically.

Write your backups to an external server. Specify the credentials to the server, specify a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!

Module can send E-mail on backup failure.

backup odoo

 

You can download and try module from odoo apps:
https://www.odoo.com/apps/modules/8.0/auto_backup/

Requirement is pysftp package.
To install package run:

sudo pip install pysftp

 

Enable themes on your odoo 8 server

To enable themes you must install Less CSS via nodejs.

On Linux, use your distribution’s package manager to install nodejs and npm.

Warning
In debian wheezy and Ubuntu 13.10 and before you need to install nodejs manually:

$ wget -qO- https://deb.nodesource.com/setup | bash -
$ apt-get install -y nodejs

In later debian (>jessie) and ubuntu (>14.04) you may need to add a symlink as npm packages call node but debian calls the binary nodejs

$ apt-get install -y npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

Once npm is installed, use it to install less and less-plugin-clean-css:

$ sudo npm install -g less less-plugin-clean-css

on OS X, install nodejs via your preferred package manager (homebrew, macports) then install less and less-plugin-clean-css:

$ sudo npm install -g less less-plugin-clean-css

on Windows, install nodejs, reboot (to update the PATH) and install less and less-plugin-clean-css:

C:\> npm install -g less less-plugin-clean-css

Warning
You can have problems with NodeJS and NPM packages in the Ubuntu 14.04 repository because they are outdated.

Follow the instructions from the NodeJS Website:

curl -sL https://deb.nodesource.com/setup_0.10 | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g npm (to update npm)

Then install Less and accessories:

sudo npm install -g less less-plugin-clean-css
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!