Category Archives: Linux

Everything related to Linux, Ubuntu, Centos, Debian.

Onboarding Linux Client (DEEPIN) to Microsoft Azure Threat protection ATP using ubuntu repository

Installing Microsoft Azure Threat Protection (ATP) on Linux Devices

While playing with ATP on some windows devices, I was in the mood of trying the new Deepin 20 desktop flavor which is a famous Chinese Linux OS based system.

Microsoft doesn’t indicate anywhere that installation of ATP on a Linux client is possible but Linux server is mentioned in the official ATP installation documents.

How to Install?

After I installed the Deepin OS, I was really impressed by the new beautiful Linux design so I plan to use it and have it secure with ATP.



  1. Configure the Linux software repository for Ubuntu and Debian
  2. Application Installation
  3. Download the onboarding Package
  4. Client Config

1-Configure the Linux software repository for Ubuntu and Debian

You will need to install the required libraries, install Gpg, apt-transport-https and update repository metadata using the following commands one by one.

  • sudo apt-get install curl


  • sudo apt-get install libplist-utils



  • sudo mv ./microsoft.list /etc/apt/sources.list.d/microsoft-ubuntu.list
  • sudo apt-get install gpg




After successfully installing all the libraries, I will go ahead and install the application

2- Application Installation

From the Linux client Terminal using sudo power user run the following script

sudo apt-get install mdatp


Once finished, You can go back to the ATP portal and download the Linux Onboarding package on the linux server/client you want to onboard

3- Download the onboarding Package

Since I am doing a single deployment not bulk, then I will go to the Microsoft Defender Security Center’s setting page and download the Linux package from the device management section.


The steps for the onboarding is already mentioned on that page so after you download the script you’ll know exactly what to do next.

The file is 9kb python in size


Copy the file to your Linux Desktop


4- Client Config

From the terminal type in chmod a+x and hit enter

Note: python must be installed on this linux dervice.

Then type python /


This will run pretty quick and will assign your Linux server/client with your Organization ID.

To see the Organization ID type:

mdatp –health orgId


Few minutes later you’ll be able to see the installation completion and the status through this command

Check if WDATP is functioning as expected

mdatp –health healthy


Check if WDATP agent is enabled

mdatp –health realTimeProtectionEnabled


Let’s check on our ATP portal and see if the machine is showing there.

Note: It might take 5-15 mins to update the definitions of WDATP when onboarding.


Running a detection Test:

curl -o ~/Downloads/


In few seconds the file has disappeared


Checking for threats

mdatp –threat –list –pretty


Let’s see this on the ATP Portal



This is just a test malware not a real one therefore it wont harm your machine at all.

Hope this helps you with your deployments


Deepin 20 Beta version

Deploy Azure Linux and Windows servers in 10 mins via cli

This is a step by step guide about deploying Linux or Windows servers on Azure via CLI.

Why Cli?

Some people prefer using Linux rather than PowerShell and it seems sometimes easier and faster to learn esp if you’re not GUI type of person.

Installation Options

If you’re working on Windows and would like to use CLI, you’ll have two options to install CLI

Option 1

Run Azure CLI installation directly from your Powershell (PowerShell needs to run from a privileged account)

Invoke-WebRequest -Uri -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList ‘/I AzureCLI.msi /quiet’

As soon as you run this command, it’ll take about 5 mins or less depending on the connection you have.


Option 2

Download the MSI file directly from MS’s link and install it on your Computer.

Connect to Azure CLI from PowerShell

Run PowerShell or CMD and type the following command to connect

Az Login then hit enter

As soon as you type this, a web page will be launched asking you for your Azure Account credentials so open the session for your Cli window.

The moment you verified your account, PowerShell will list your azure plans that you have / had before.


If you’re going to use Linux (Ubuntu, Debian) flavor then you’d have to following the following instructions

Manual install instructions

If you don’t want to run a script as superuser or the all-in-one script fails, follow these steps to install the Azure CLI.

  1. Get packages needed for the install process:


    sudo apt-get update
    sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
  2. Download and install the Microsoft signing key:


    curl -sL |
        gpg --dearmor |
        sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
  3. Add the Azure CLI software repository:


    AZ_REPO=$(lsb_release -cs)
    echo "deb [arch=amd64] $AZ_REPO main" |
        sudo tee /etc/apt/sources.list.d/azure-cli.list
  4. Update repository information and install the




    sudo apt-get update
    sudo apt-get install azure-cli

Run the Azure CLI with the


command. To sign in, use the az login command.

  1. Run the



    Azure CLI

    Try It

    az login

    If the CLI can open your default browser, it will do so and load an Azure sign-in page.

    Otherwise, open a browser page at and enter the authorization code displayed in your terminal.

  2. Sign in with your account credentials in the browser.

To learn more about different authentication methods, see Sign in with Azure CLI.

Deploying Linux (CentOS):

Creating a Resource Group for Azure Container Instances (ACI)

We will start first by creating a Resource Group for our Machine, calling it a AzureLinuxServersGroup to easily identify that this group contains our Linux Servers

az group create –name AzureLinuxServersGroup –location westeurope


Next we will be creating a container to contain the Linux OS on the resource group which we have just created

First, How we know which Image to use and if that will be proper for our deployment?

To answer that, we will use the following command which will view the available latest edition Linux OS with different flavors.

I would like to use CentOS since its identical to RedHat and used by majority of Enterprises.

To list the Images, Enter the following command

az vm image list –output table


Notice there are many columns, The one which we are going to use in terminal command line is the UrnAlias. It’s important to remember this.

az vm create \

–resource-group AzureLinuxServersGroup \

–name AzureCentOSWP \

–image CentOS \

–admin-username Moh10lyUser \



Since we are using Bash, It’s a case sensitive and it complained about user having capital letters. So we’ll go ahead and use small letters


After running the command with small letters, it’s telling us where we can find the keys in order for us to reach and get them to use later to login to this newly created machine.

SSH key files ‘/home/moh10ly/.ssh/id_rsa’ and ‘/home/moh10ly/.ssh/’ have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage, back up your keys to a safe location.

The deployment of the machine takes about 3 mins, and it’ll be created with the default minimum resources. Let’s view


Our machine is ready to be accessed now


In order for you to get the SSH Keys, you’ll have to have a bit of knowledge

I am going to go the location mentioned previously after creating a machine and copy the keys from the bash screen into a file. Save the file and Import it into SSH client which I will be using (Bitvise in my case).

From the bash screen goto cd /

Cd /home/user/.ssh/

Cat id_rsa hit enter and copy the key and save it into notepad.

Cat and copy/save into a notepad as the public key.


After loading both keys, I was able to successfully login to the Server




Get a list of Azure VMS

az vm image list


Let’s List and deploy a WordPress on CentOS

To view the list of available CentOS images, we’ll use the following cli command

az vm image list -f CentOS –all

The image needs to be grabbed from dockerhub URL


az container create –resource-group mohazbackupgroup –name mohcontainer –os-type Linux –image cognosys:wordpress-with-centos-77-free:wordpress-with-centos-77-free:1.2019.1008 –dns-name-label azmohlinux –ports 22

Create Windows Server core with IIS

az container create –resource-group mohazbackupgroup –name mohcontainer –os-type windows –image –dns-name-label azmohlinux –ports 22ws/servercore/iis:nanoserver –dns-name-label azmohiis –ports 80


Here we go I got a machine ready (took about 5 mins)


To delete the container, you can write the following

az container delete –resource-group mohazbackupgroup –name mohcontainer



Stay tuned for more articles about Azure.

Windows 10 powershell’s Linux sudo apt-get install like CMDlet with Chocolately app

The Story

Windows 10 has arrived finally and with it came lot of new features, and one of my favorite new features is that you can finally install applications through powershell just like Linux OS’s terminal window command (apt-get install).

Although the command is still pretty new and lack many repositories where you can find and install applications from.

There’s already some people who are working on adding sources of applications which you can test initially before Microsoft asks product companies to start making their own repositories so Powershell can trust these sites and applications.

One of the sites that are working on providing Windows 10 with repositories is which provides hundreds of softwares that can be installed through PS.

To install Chocolately repository simply do the following

Open powershell as an administrator and paste the following cmdlet

@powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((new-object net.webclient).DownloadString(‘’))” && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin


Then this

iex ((new-object net.webclient).DownloadString(‘’))



As soon as you have installed chocolately, you will get a new huge list of applications that can be installed with a very simple and short cmdlet as in the below screenshots.

The good things about these cmdlets is it can be used to deploy an app for a huge number of clients by simply running the script through GPO or batch file.

I am going to install VLC and Google drive on my computer using these cmdlet …


Find-package -Name VLC







Checking if the app is really installed or not?



Find and install google drive package






If an application doesn’t install, how to troubleshoot it?

If for instance you were trying to install a package or app and that doesn’t work or get stuck then you can navigate to the Chocolately directory and delete any package that you tried to install but were suspended for any reason.



You can simply delete the whole directory or the file that ends with extension .nupkg and try again to install…



These are instructions that demonstrate how to change WordPress to match your replaced or changed Public domain. as this occurs in case if you are already using WordPress and have it published on let’s say and then you transferred this domain to

When you try to reach wordpress website from your new public domain. you might not reach it or wordpress might try to redirect you to your old instead.

In order to fix this, we’ll have to use a tool called wp-cli which fixes this configuration problem. to do so please open your SSH shell or get in your UBuntu server and do the following.

  1. sudo curl -O

2. From User@UbuntuServer:/var/www/html$ I will run the following command to make sure that the command is working

sudo php wp-cli.phar –info


3. I’ll move the file to a new path and location so I can access it from anywhere using only the command WP.

First I will give the required permissions

moh10ly@Ubunut-Mohammed:/var/www/html$ sudo chmod +x wp-cli.phar


Next I will move the file

sudo mv wp-cli.phar /usr//local/bin/wp


3. Check if the file is working properly after moving?


4. Final step is to change the domain of your wordpress site to a new domain.

My previous domain was and now I changed it to

So I only used two commands to change the domain name to the new on

5. moh10ly@Ubunut-Mohammed:/var/www/html$ wp option update home “


6. moh10ly@Ubunut-Mohammed:/var/www/html$ wp option update siteurl “


Now I tested my website and it’s working perfectly…

What to have in your Linux Desktop?

The tools that a Must have on Linux Desktop are

1- Variety

(Automatic desktop wallpaper downloader and customizer), Variety also displays quotes on your desktop along with wallpapers.


2- Cairo dock (shortcut bar to Applications)


3- Shutter (Graphic tool)

Shutter is a graphic tool that can take snapshots, desktop screenshots and edit them or send them to your e-mail.

it’s very powerful and every button on it can be customized with a shortcut by the keyboard. for example if you want to create a shortcut for screen selection (Like the OneNote on Windows) you can simply open the keyboard shortcuts app (mate-keybinding-properties)


Once you have launched the keyboard shortcuts utility, you can customize a new shortcut to take a screenshot for you with Shutter by selection.


You will have to click on Add and create a new shortcut as following


Once you click apply, you can assign the shortcut for this command.

For example, I am using the shortcut CTRL + SHIFT + S


4- Remote Desktop tools

A- NoMachine

NoMachine is a free and very powerful remote desktop utility that works on all Operating systems and supports all kinds of features that are available in other remote desktop utlities like (Radmin, Teamviewer, RDP).


5- OneDrive for Linux.

Install onedrive-d on Linux

While onedrive-d was originally developed for Ubuntu/Debian, it now supports CentOS/Fedora/RHEL as well.

Installation is as easy as typing the following.

$ git clone

$ cd onedrive-d

$ ./inst install

First-Time Configuration

After installation, you need to go through one-time configuration which involves granting onedrive-d read/write access to your OneDrive account.

First, create a local folder which will be used to sync against a remote OneDrive account.

$ mkdir ~/onedrive

Then run the following command to start the first-time configuration.

$ onedrive-d

It will pop up a onedrive-d’s Settings window as shown below. In “Location” option, choose the local folder you created earlier. In “Authentication” option, you will see “You have not authenticated OneDrive-d yet” message. Now click on “Connect to” box.


It will pop up a new window asking you to sign in to


After logging in to, you will be asked to grant access to onedrive-d. Choose “Yes”.


Coming back to the Settings window, you will see that the previous status has changed to “You have connected to”. Click on “OK” to finish.


Sync a Local Folder with OneDrive

There are two ways to sync a local folder with your OneDrive storage by using onedrive-d.

One way is to sync with OneDrive manually from the command line. That is, whenever you want to sync a local folder against your OneDrive account, simply run:

$ onedrive-d

onedrive-d will then scan the content of both a local folder and a OneDrive account, and make the two in sync. This means either uploading newly added files in a local folder, or downloading newly found files from a remote OneDrive account. If you remove any file from a local folder, the corresponding file will automatically be deleted from a OneDrive account after sync. The same thing will happen in the reverse direction as well.

Once sync is completed, you can kill the foreground-running onedrive-d process by pressing Ctrl+C.


Another way is to run onedrive-d as an always-on daemon which launches automatically upon start. In that case, the background daemon will monitor both the local folder and OneDrive account, to keep them in sync. For that, simply add onedrive-d to the auto-start program list of your desktop.

When onedrive-d daemon is running in the background, you will see OneDrive icon in the desktop status bar as shown below. Whenever sync update is triggered, you will see a desktop notification.


6- Evolution Email Client for Exchange accounts.

If you ever thought of using an e-mail client that supports your account on Microsoft Exchange Email server’s protocol which is known as (RPC over HTTP) then you have probably used Mozilla thunderbird or kmail, geary..etc but all those clients don’t support Exchange’s most flexible connectivity which is RPC over HTTP that will sync all your emails, contacts, tasks, calendars ..etc

To Install evolution, all you have to do is open Linux Terminal and type the following

Sudo apt-get install evolution


Since I already have Evolution installed it won’t proceed and will tell me that it’s already installed. but that’s not all!

In order to setup an Exchange account on Evolution you will have to install an Evolution plugin that will support the web services for the RPC over http connectivity which is known as (EWS = Exchange Web Services).

In order to install this plugin you will have to type the following command

Sudo apt-get install Evolution-ews


Once you install the plugin, you can launch the program and setup your account as following.

Click on Add as in the picture


When you click add you should be welcomed by a message saying “Welcome to Evolution wizard ..etd”

Click Continue and then type in your name and email address in the next window

You can skip the automatic configuration as Evolution still doesn’t support Exchange Autodiscover mechanism for auto configuration of the account. so you must manually provide all the configuration of your exchange as following


In the host URL you will have to provide your Exchange server’s EWS URL which usually looks like this

In my case I am using an Office 365 account so instead I’ll use Microsoft’s EWS url.

For the OAB (Offline Address Book) you also need to provide the configured URL of the OAB on your Exchange Server. which in my case again it’s Microsoft Office 365.

you will need to make sure that the correct authentication method is set (NTLM) in my case, this can vary though on Exchange server’s Outlook Anywhere configuration. it can be Basic as well. so it’s up to your configuration to choose but for Office 365 it’s NTLM.


Once you finish the configuration you can continue and you’ll get prompted to enter your Credentials. as soon as you finish typing your Password hit enter and your e-mails will start syncing. as in the following snapshot


That’s it, you’re setup here either if it’s an exchange on-premises or Office 365 for Linux desktop client.

Here’s another guide for the new mapi connectivity for Evolution, probably the same steps

7- For Office (Word, Powerpoint ..etc) I prefer to use Kingsoft’s community version along with LibreOffice

Since Libre office provide more tools or the full package I still use it on Linux but Kingsoft’s WPS tools have a user friendly and rich of tools GUI.


In order to download WPS software you will have to navigate to the link below and download the suitable version with your Linux OS. or use the terminal to download latest available version with the following command

sudo apt-get install wps-office

8- For media there are various available software and tools that you can use on Linux to either listen to music or edit mp3s or convert media types.

A- Audacity (Convert and Edit audio files).

B- Spotify (listen to music online)

C- Clementine (Listen to Music on your computer)

D- VLC (Watch Videos on your PC) or use it as a streaming server.

There are other useful tools and things to do on Linux OS as it’s a very flexible and customizable OS but I’ll end this article here and write a new one about how to decorate your welcome screen and your desktop with beautiful pictures and tools.

Hope you find this useful