Posted on Leave a comment

Elevate sudo privileges through winSCP for sudoers

If a Linux user has sudo privileges ( for example with a sudoers file) they can be elevated to root through winscp with the below procedure:

Create an entry on your sudoers.d directory and allow user to execute sudo commands without password.

Select advanced settings on winscp (scp connection)

on shell tab select the one shown below

By doing the above you will login as root (elevated privileges on your specific user – myuser in my case)

Posted on Leave a comment

Disk Conversion Hyper-V vhd to vhdx – Cannot attach new disk on Virtual machine

Hyper-V includes a tool that can convert vhd disks to vhdx which is the newer version and should be used on production environments.

Sometimes the below error can occur which prevents one from attaching the new disk (vhdx) to the virtual machine needed. It seems as the new disk after the conversion to be locked and only by rebooting host the disk can be attached.

The process cannot access the file because it is being used by another process

This issue happens because the original disk is attached on the virtual machine during the conversion. The disk device should be attached as stated from Microsoft (link below). After the conversion the new disk can be attached and will not be locked from the host.

https://docs.microsoft.com/en-us/powershell/module/hyper-v/convert-vhd?view=win10-ps

Posted on Leave a comment

Map Network drive location on Windows Server

The easiest way to perform massive identical installations on web servers that are located on the same network (VLAN) is through a network map of the remote location. With only two steps you can perform remote installations.

Firstly select map a network drive and assign a drive letter to the remote location.

Select map network drive

Select your preferred drive letter.

Map your network location server to a Drive letter
Open a terminal and just go to the specified location. In my case it was Z:

change directory to your remote location through a cmd or GUI and perform your installations.

Posted on Leave a comment

Ansible playbook – variable files must contain either a dictionary or a list

Recently I faced the below error when I tried to use some variables which I initialized on a ansible vault file.

My code is shown below. It just prints some values retrieved from a vault.

playbook code. using debug module values are printed.
ansible-playbook vault.yml --vault-password-file=vault_key

While deploying the playbook the below error appears:

ERROR! variable files must contain either a dictionary of variables, or a list of dictionaries. Got: user_password:password database_password:password ( <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>)

Dictionary file

ansible vault variables

In order to resolve issue, you should just leave a blank between dictionary key and value.

Deploy again your playbook and the result will be successful.