<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux / Ubuntu Archives - Tech Antidote</title>
	<atom:link href="https://techantidote.com/category/technology/linux-ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>‎ &#124; LINUX &#124; Tech &#124; Security &#124;</description>
	<lastBuildDate>Tue, 29 Oct 2024 22:48:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://techantidote.com/wp-content/uploads/2016/02/cropped-google-plus-profile-picture-32x32.png</url>
	<title>Linux / Ubuntu Archives - Tech Antidote</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">106369530</site>	<item>
		<title>Increase OS Disk Size of an Azure Linux VM</title>
		<link>https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/</link>
					<comments>https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Wed, 06 Dec 2023 21:35:00 +0000</pubDate>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[azure cli]]></category>
		<category><![CDATA[Changes to the disk size can be made only when the disk is unattached or the managing virtual machine(s) are deallocated.]]></category>
		<category><![CDATA[resize os disk]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=3704</guid>

					<description><![CDATA[<p>If you try to expand the disk without stopping/de-allocating the VM, depending on disk config it may not allow your to change the size and a banner with message &#8220;Changes to the disk size can be made only when the disk is unattached or the managing virtual machine(s) are deallocated.&#8221; would be displayed. To increase &#8230; <a href="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/" class="more-link">Continue reading <span class="screen-reader-text">Increase OS Disk Size of an Azure Linux VM</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/">Increase OS Disk Size of an Azure Linux VM</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you try to expand the disk without stopping/de-allocating the VM, depending on disk config it may not allow your to change the size and a banner with message &#8220;<em>Changes to the disk size can be made only when the disk is unattached or the managing virtual machine(s) are deallocated.</em>&#8221; would be displayed. To increase the disk size of a Linux VM, you can perform the following:</p>
<p>In my environment, the VM OS disk size was smaller than 4TB and could not be resized using the online method that could be done without downtime(it requires some special configuration which I didnt really get deep into). This method will involve shutting down the VM, de-allocating the VM, increasing the disk and then bringing the disk back online. So, there would be some downtime.<br />
Another thing:</p>
<p><strong>Note</strong>: Replace text in blue with your environment specific values.</p>
<p><strong>1. Stop the VM:</strong></p>
<p>az vm stop &#8211;resource-group <span style="color: #0000ff;"><strong>Resource-Group-Name</strong></span> &#8211;name <span style="color: #0000ff;"><strong>VM-NAME</strong></span> &#8211;subscription <strong><span style="color: #0000ff;">SUBSCRIPTION-ID</span></p>
<p></strong>2. <strong>De-allocate the VM:</strong> (This may take a few minutes)</p>
<p>az vm deallocate &#8211;resource-group <span style="color: #0000ff;"><strong>Resource-Group-Name</strong></span> &#8211;name <span style="color: #0000ff;"><strong>VM-NAME</strong></span> &#8211;subscription <strong><span style="color: #0000ff;">SUBSCRIPTION-ID</span></p>
<p>3. Increase the Disk (from the UI):</strong></p>
<p>-Navigate to the VM in Azure. Click on &#8220;Disks&#8221;</p>
<p>&nbsp;</p>
<p><img fetchpriority="high" decoding="async" data-attachment-id="3705" data-permalink="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/1-az-disks/" data-orig-file="https://techantidote.com/wp-content/uploads/2023/12/1-az-disks.png" data-orig-size="226,475" data-comments-opened="1" data-image-title="1-az-disks" data-image-description="&lt;p&gt;Navigate to the Azure VM and click on &amp;#8220;Disks&amp;#8221;&lt;/p&gt;
" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2023/12/1-az-disks.png" class="alignnone size-full wp-image-3705" src="https://techantidote.com/wp-content/uploads/2023/12/1-az-disks.png" alt="" width="226" height="475" srcset="https://techantidote.com/wp-content/uploads/2023/12/1-az-disks.png 226w, https://techantidote.com/wp-content/uploads/2023/12/1-az-disks-143x300.png 143w" sizes="(max-width: 226px) 100vw, 226px" /></p>
<p>-Select the disk that you need to resize.</p>
<p>&nbsp;</p>
<p><img decoding="async" data-attachment-id="3706" data-permalink="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/2-disk/" data-orig-file="https://techantidote.com/wp-content/uploads/2023/12/2-disk.png" data-orig-size="788,191" data-comments-opened="1" data-image-title="2-disk" data-image-description="&lt;p&gt;Click on the OS Disk to be resized.&lt;/p&gt;
" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2023/12/2-disk.png" class="alignnone size-full wp-image-3706" src="https://techantidote.com/wp-content/uploads/2023/12/2-disk.png" alt="" width="788" height="191" srcset="https://techantidote.com/wp-content/uploads/2023/12/2-disk.png 788w, https://techantidote.com/wp-content/uploads/2023/12/2-disk-300x73.png 300w, https://techantidote.com/wp-content/uploads/2023/12/2-disk-768x186.png 768w" sizes="(max-width: 788px) 100vw, 788px" /></p>
<p>Click on &#8220;Size + performance&#8221; and select the disk size to which you want to increase to and then click on &#8220;Save&#8221;<br />
<img decoding="async" data-attachment-id="3707" data-permalink="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/3-select-disk-size/" data-orig-file="https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size.png" data-orig-size="1034,708" data-comments-opened="1" data-image-title="3-select-disk-size" data-image-description="&lt;p&gt;Click on &amp;#8220;Size + Performance&amp;#8221; and then resize the disk and save&lt;/p&gt;
" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size-1024x701.png" class="alignnone size-large wp-image-3707" src="https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size-1024x701.png" alt="" width="640" height="438" srcset="https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size-1024x701.png 1024w, https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size-300x205.png 300w, https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size-768x526.png 768w, https://techantidote.com/wp-content/uploads/2023/12/3-select-disk-size.png 1034w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<p><strong>4. Start the VM:</strong></p>
<p>az vm start &#8211;resource-group <span style="color: #0000ff;"><strong>Resource-Group-Name</strong></span> &#8211;name <span style="color: #0000ff;"><strong>VM-NAME</strong></span> &#8211;subscription <span style="color: #0000ff;"><strong>SUBSCRIPTION-ID</strong></span></p>
<p>My Azure VM was based on Ubuntu 20.04.x and did not need additional changes in the OS. After the VM booted backup, it did automatically expand to the new allocated size.</p>
<p><strong>Some of my thoughts on Azure Naming and resizing: </strong><br />
For some wierd reason, Azure does not make things easy for resizing disks. Ideally, you should be able to shutdown the VM and increase the disk, BUT Azure needs you to de-allocate the VM before you can make any changes to the disk. Another strange thing Azure decided to do is to label &#8220;de-allocate VM&#8221; instead of some sane label as at first it sound as if going to delete the VM and all its data when when in reality it does not.</p>
<p><strong>Sources/References:</strong><br />
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks?tabs=ubuntu</p>
<p>If you have any queries/feedback regarding this, feel free to leave a comment below and will get back to you as soon as I can.</p>
<p>The post <a href="https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/">Increase OS Disk Size of an Azure Linux VM</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/increase-os-disk-size-of-an-azure-linux-vm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3704</post-id>	</item>
		<item>
		<title>Enable promiscuous mode in VMware Workstation</title>
		<link>https://techantidote.com/promiscuous-mode-vmware-workstation/</link>
					<comments>https://techantidote.com/promiscuous-mode-vmware-workstation/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Fri, 23 Dec 2022 19:11:41 +0000</pubDate>
				<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[mirror port]]></category>
		<category><![CDATA[promiscuous]]></category>
		<category><![CDATA[promiscuous mode]]></category>
		<category><![CDATA[suricata]]></category>
		<category><![CDATA[Vmware workstation]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=3626</guid>

					<description><![CDATA[<p>Below are the steps to enable promiscuous mode for a VM in Vmware Workstation. Shutdown the VM and edit the .vmx file. This is in the directory where your VM&#8217;s hard disks were configured to be sure. vim /home/extr3me/vmware/pfsense/pfsense.vmx Tip: You can right click on the VM and select option &#8220;Open VM Directory&#8221; that will &#8230; <a href="https://techantidote.com/promiscuous-mode-vmware-workstation/" class="more-link">Continue reading <span class="screen-reader-text">Enable promiscuous mode in VMware Workstation</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/promiscuous-mode-vmware-workstation/">Enable promiscuous mode in VMware Workstation</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Below are the steps to enable promiscuous mode for a VM in Vmware Workstation.</p>
<p>Shutdown the VM and edit the .vmx file. This is in the directory where your VM&#8217;s hard disks were configured to be sure.</p>
<pre><strong>vim /home/extr3me/vmware/pfsense/pfsense.vmx</strong></pre>
<p>Tip:<br />
You can right click on the VM and select option &#8220;<em>Open VM Directory</em>&#8221; that will take you to the directory where the .vmx file is located.</p>
<p>Add the below line to the file:</p>
<pre><strong>ethernet0.noPromisc = "FALSE"</strong></pre>
<p>-If you have multiple interfaces, then add another line and replace the value 0 with 1 etc. Below is an example for two interfaces:</p>
<pre><strong>ethernet0.noPromisc = "FALSE"
ethernet1.noPromisc = "FALSE"

<span style="text-decoration: underline;">Source/Credits/Reference:</span></strong></pre>
<p>https://superuser.com/questions/1209497/how-do-you-enable-promiscuous-mode-in-vmware-workstation#1270695</p>
<p>The post <a href="https://techantidote.com/promiscuous-mode-vmware-workstation/">Enable promiscuous mode in VMware Workstation</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/promiscuous-mode-vmware-workstation/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3626</post-id>	</item>
		<item>
		<title>Setup Wireguard VPN Server and Client in Ubuntu 20.04</title>
		<link>https://techantidote.com/wireguard-vpn-server-setup-ubuntu/</link>
					<comments>https://techantidote.com/wireguard-vpn-server-setup-ubuntu/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Fri, 01 Jul 2022 20:12:46 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu 20.04]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[wireguard]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=3599</guid>

					<description><![CDATA[<p>This a guide on how to setup Wireguard VPN on Ubuntu and setting up a Wireguard client. Requirements: 1. Ubuntu Server 20.04 used in my lab. (20.04 or higher is required for Policy routing) 2. Ubuntu Client (Ubuntu 20.04) 3. Root access to the server. 4. Network Access Note: This should also work on Linux &#8230; <a href="https://techantidote.com/wireguard-vpn-server-setup-ubuntu/" class="more-link">Continue reading <span class="screen-reader-text">Setup Wireguard VPN Server and Client in Ubuntu 20.04</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/wireguard-vpn-server-setup-ubuntu/">Setup Wireguard VPN Server and Client in Ubuntu 20.04</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This a guide on how to setup Wireguard VPN on Ubuntu and setting up a Wireguard client.</p>
<p><span style="color: #3366ff;"><strong>Requirements:</strong></span></p>
<p>1. Ubuntu Server 20.04 used in my lab. (20.04 or higher is required for Policy routing)</p>
<p>2. Ubuntu Client (Ubuntu 20.04)</p>
<p>3. Root access to the server.</p>
<p>4. Network Access</p>
<p><strong>Note:</strong> This should also work on Linux Mint 20.04</p>
<h3><span style="color: #3366ff;">Setting up the Wireguard Server</span></h3>
<p>Login to the In my lab, I have set up a EC2 instance and below is the current IP configuration before setting up Wireguard.</p>
<pre>root@ip-172-31-20-229:~# <strong>ip a
</strong>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: <strong>eth0</strong>: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 9001 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:ca:92:5f:0e:80 brd ff:ff:ff:ff:ff:ff
    inet <strong>172.31.20.229/20</strong> brd 172.31.31.255 scope global dynamic eth0
       valid_lft 2617sec preferred_lft 2617sec
    inet6 fe80::ca:92ff:fe5f:e80/64 scope link 
       valid_lft forever preferred_lft forever
</pre>
<p>From above, I have a single interface with IP 172.31.20.229 assigned to eth0.</p>
<pre><strong>sudo apt update &amp;&amp; sudo apt upgrade -y
sudo apt install wireguard -y
</strong></pre>
<p>-Switch to root and run the following:</p>
<p><strong> sudo su &#8211; </strong></p>
<p>Below are the default permissions on the wireguard dir:</p>
<pre>root@ip-172-31-20-229:~# <strong>ls -l /etc/ | grep wireguard
</strong>drwx------ 2 root root       4096 Aug  4  2020 wireguard
</pre>
<p>-You could set permissions to the directory as follows:</p>
<pre><strong>chmod 0700 /etc/wireguard/</strong>
root@ip-172-31-20-229:~# <strong>ls -l /etc/ | grep wireguard
drwx------</strong> 2 root root       4096 Aug  4  2020 wireguard
</pre>
<p>To check the version of Wireguard installed:</p>
<pre>root@ip-172-31-20-229:/etc/wireguard# <strong>wg --version
</strong>wireguard-tools v1.0.20200513 - https://git.zx2c4.com/wireguard-tools/
</pre>
<p>-Generate public and private key pairs:</p>
<pre><strong>cd /etc/wireguard/
umask 077; wg genkey | tee privatekey | wg pubkey &gt; publickey
</strong></pre>
<p>This should generate the private and the public key:</p>
<pre>root@ip-172-31-20-229:/etc/wireguard# <strong>ls -l
</strong>total 8
-rw------- 1 root root 45 Jun 30 20:23 <strong>privatekey</strong>
-rw------- 1 root root 45 Jun 30 20:23 publickey
</pre>
<p>-Take a note of the private key &#8220;<strong>privatekey</strong>&#8221; <strong>cat privatekey</strong> . You will need to add this to the WG server&#8217;s conf file.</p>
<p><strong>Setting up the Wireguard Server&#8217;s configuration file</strong></p>
<pre><strong>vim /etc/wireguard/wg0.conf</strong></pre>
<p>Add below content. (Here, I chose the IP as <strong>192.168.6.1</strong> which is the new VPN private address that will be assigned to the interface)</p>
<pre><em>[Interface]
## My VPN server private IP address ##
Address = <strong>192.168.6.1
</strong> 
## My VPN server port ##
ListenPort = 41194
 
## VPN server's private key i.e. string from /etc/wireguard/privatekey ##
PrivateKey = <strong>ADD_PRIVATE_KEY_HERE
</strong></em></pre>
<p>-Allow the port in the Server&#8217;s Firewall:</p>
<pre>root@ip-172-31-20-229:~# <strong>sudo ufw allow 41194/udp</strong>
Rules updated
Rules updated (v6)
</pre>
<p>-To check the status:</p>
<pre><strong>sudo ufw status
</strong></pre>
<p>&#8211; Enable wireguard service on boot on the server and start the service:</p>
<pre>ubuntu@ip-172-31-20-229:~$ <strong>sudo systemctl enable wg-quick@wg0</strong>
Created symlink /etc/systemd/system/multi-user.target.wants/wg-quick@wg0.service → /lib/systemd/system/wg-quick@.service.

ubuntu@ip-172-31-20-229:~$ <strong>sudo systemctl start wg-quick@wg0
</strong></pre>
<p>To check the status of the wireguard service, use the following:</p>
<pre>root@ip-172-31-20-229:~# <strong>sudo systemctl status wg-quick@wg0
</strong>● wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
     Loaded: <strong>loaded</strong> (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)
     Active: <strong>active</strong> (exited) since Thu 2022-06-30 21:29:01 UTC; 8min ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
    Process: 2230 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=0/SUCCESS)
   Main PID: 2230 (code=exited, status=0/SUCCESS)

Jun 30 21:29:01 ip-172-31-20-229 systemd[1]: wg-quick@wg0.service: Succeeded.
Jun 30 21:29:01 ip-172-31-20-229 systemd[1]: Stopped WireGuard via wg-quick(8) for wg0.
Jun 30 21:29:01 ip-172-31-20-229 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Jun 30 21:29:01 ip-172-31-20-229 wg-quick[2230]: [#] <strong>ip link add wg0 type wireguard</strong>
Jun 30 21:29:01 ip-172-31-20-229 wg-quick[2230]: [#] wg setconf wg0 /dev/fd/63
Jun 30 21:29:01 ip-172-31-20-229 wg-quick[2230]: [#] <strong>ip -4 address add 192.168.6.1/24 dev wg0</strong>
Jun 30 21:29:01 ip-172-31-20-229 wg-quick[2230]: [#] ip link set mtu 8921 up dev wg0
Jun 30 21:29:01 ip-172-31-20-229 systemd[1]: Finished WireGuard via wg-quick(8) for wg0.
</pre>
<p>Checking the ifconfig output, you would see a <strong>new interface</strong> <strong>wg0 </strong>is created automatically which is expected.</p>
<pre>root@ip-172-31-20-229:~# <strong>ip a
</strong>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: <strong>eth0</strong>: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 9001 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:ca:92:5f:0e:80 brd ff:ff:ff:ff:ff:ff
    inet <strong>172.31.20.229/20</strong> brd 172.31.31.255 scope global dynamic eth0
       valid_lft 2235sec preferred_lft 2235sec
    inet6 fe80::ca:92ff:fe5f:e80/64 scope link 
       valid_lft forever preferred_lft forever
5: <strong>wg0</strong>: &lt;POINTOPOINT,NOARP,UP,LOWER_UP&gt; mtu 8921 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none 
    inet <strong>192.168.6.1/24</strong> scope global wg0
       valid_lft forever preferred_lft forever

</pre>
<p>&#8211; You can check wireguard information/stats using the below command:</p>
<pre>ubuntu@ip-172-31-20-229:~$ <strong>sudo wg
interface</strong>: <strong>wg0</strong>
  public key: pHrkGojLiNZy2GwshmdEXMaaOmowXXXXXXXXXXXXXXX=
  private key: (hidden)
  listening port: 41194
</pre>
<h3><span style="color: #3366ff;"><strong>Configuring the VPN Client</strong></span></h3>
<ul>
<li>Login to the client and install Wireguard.</li>
</ul>
<pre><strong>sudo apt install wireguard -y
</strong></pre>
<p>&#8211; Create the configuration file</p>
<pre>root@wg-client:~# <strong>sudo sh -c 'umask 077; touch /etc/wireguard/wg0.conf'
</strong>
root@wg-client:~# <strong>ls -l /etc/wireguard/wg0.conf 
</strong>-rw------- 1 root root 0 Jun 30 20:58 /etc/wireguard/wg0.conf</pre>
<ul>
<li><strong>Create a key pair in the client</strong></li>
</ul>
<p>&#8211; In the client machine, create a key pair:</p>
<pre>root@wg-client:~# <strong>cd /etc/wireguard/
</strong>
root@wg-client:/etc/wireguard# <strong>umask 077; wg genkey | tee privatekey | wg pubkey &gt; publickey
</strong>
root@wg-client:/etc/wireguard# <strong>ls -l 
</strong>total 8
-rw------- 1 root root 45 Jun 30 21:01 privatekey
-rw------- 1 root root 45 Jun 30 21:01 publickey
-rw------- 1 root root  0 Jun 30 20:58 wg0.conf
root@wg-client:/etc/wireguard# 
</pre>
<p>&#8211; Take a note of the client&#8217;s public key. (This will be added in the server&#8217;s config later)</p>
<p>-Take a note of the private key from the client. This will be added in its own config file.</p>
<pre><strong>cat privatekey</strong></pre>
<ul>
<li><strong>Edit config</strong></li>
</ul>
<blockquote><p><strong>vim /etc/wireguard/wg0.conf</strong></p></blockquote>
<p>&#8211; On the client, create the wireguard config file as below:</p>
<pre>[Interface]
## Add the client's private key which is from /etc/wireguard/publickey ##
PrivateKey = <strong>CLIENT_PRIVATE_KEY_HERE</strong>
 
## Client ip address that will be set by this Client ##
Address = <strong>192.168.6.2/24
</strong>  
[Peer]
## Ubuntu 20.04 server public key ##
PublicKey = <strong>SERVER_PUBLIC_KEY_HERE</strong>
 
## set ACL ##
AllowedIPs = 192.168.2.0/24
  
## Your Ubuntu 20.04 LTS server's public IPv4/IPv6 address and port ##
Endpoint = <strong>PUBLIC_IP_OF_YOUR_WIREGUARD_SERVER</strong>:41194
   
##  Key connection alive ##
PersistentKeepalive = 15

</pre>
<p>-On the client, enable and start the Wireguard service:</p>
<pre>root@wg-client:/etc/wireguard# <strong>sudo systemctl enable wg-quick@wg0
</strong>Created symlink /etc/systemd/system/multi-user.target.wants/wg-quick@wg0.service -&gt; /lib/systemd/system/wg-quick@.service.

root@wg-client:/etc/wireguard# <strong>sudo systemctl start wg-quick@wg0
</strong></pre>
<p>&#8211; Check the status of the service in the client:</p>
<pre>root@wg-client:~# <strong>sudo systemctl status wg-quick@wg0
</strong>* wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
     Loaded: <strong>loaded</strong> (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)
     Active: <strong>active</strong> (exited) since Thu 2022-06-30 21:35:17 UTC; 5min ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
    Process: 123 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=0/SUCCESS)
   Main PID: 123 (code=exited, status=0/SUCCESS)
        CPU: 28ms

Jun 30 21:35:17 wg-client systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Jun 30 21:35:17 wg-client wg-quick[123]: [#] <strong>ip link add wg0 type wireguard
</strong>Jun 30 21:35:17 wg-client wg-quick[123]: [#] wg setconf wg0 /dev/fd/63
Jun 30 21:35:17 wg-client wg-quick[123]: [#] <strong>ip -4 address add 192.168.6.2/24 dev wg0
</strong>Jun 30 21:35:17 wg-client wg-quick[123]: [#] ip link set mtu 1420 up dev wg0
Jun 30 21:35:17 wg-client systemd[1]: Finished WireGuard via wg-quick(8) for wg0.
</pre>
<p>-From the above output, we can see that the <strong>wireguard</strong> service has <strong>created</strong> the <strong>interface</strong> <strong>wg0</strong> and assigned the IP <strong>192.168.6.2/24</strong> to it. You could also verify this by checking by checking the device ip conf as below:</p>
<pre>root@wg-client:~# <strong>ip a
</strong>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0@if114: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether aa:3c:37:57:21:8a brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.143/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 86010sec preferred_lft 86010sec
    inet6 fe80::a83c:37ff:fe57:218a/64 scope link 
       valid_lft forever preferred_lft forever
3: <strong>wg0</strong>: &lt;POINTOPOINT,NOARP,UP,LOWER_UP&gt; mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none 
    inet <strong>192.168.6.2/24</strong> scope global wg0
       valid_lft forever preferred_lft forever
</pre>
<p>So far, we can configured the client to talk to the server. But the Server does not know about the client. So, next we need to update the Server&#8217;s Wireguard configuration file with the details of the wireguard client.</p>
<p>-Login to the Wireguard Server and add the below block to the server&#8217;s wireguard conf:</p>
<pre>[Peer]
## Desktop/client VPN public key ##
PublicKey = <strong>CLIENT_PUB_KEY_HERE</strong>

## client VPN IP address (note  the /32 subnet) ##
AllowedIPs = <strong>192.168.6.2/32
</strong></pre>
<p>-So, your Wireguard server&#8217;s configuration file will be as follows:</p>
<pre>[Interface]
## My VPN server private IP address ##
Address = <strong>192.168.6.1
</strong> 
## My VPN server port ##
ListenPort = 41194
 
## VPN server's private key i.e. /etc/wireguard/privatekey ##
PrivateKey = <strong>ADD_PRIVATE_KEY_HERE</strong>

[Peer]
## Desktop/client VPN public key ##
PublicKey = <strong>CLIENT_PUB_KEY_HERE</strong>

## client VPN IP address (note  the /32 subnet) ##
AllowedIPs = <strong>192.168.6.2/32
</strong></pre>
<p>&#8211; Start the service again on the server:</p>
<pre><strong>sudo systemctl start wg-quick@wg0
</strong></pre>
<p><span style="color: #3366ff;"><strong>Verify connectivity from the client =&gt; server:</strong></span></p>
<p>&#8211; If the server is in the cloud, then update the security groups tallow the port.</p>
<p>&#8211; From the client, ping the server 192.168.6.1</p>
<pre>root@wg-client:~# <strong>ping 192.168.6.1
</strong>PING 192.168.6.1 (192.168.6.1) 56(84) bytes of data.
64 bytes from 192.168.6.1: icmp_seq=1 ttl=64 time=81.9 ms
64 bytes from 192.168.6.1: icmp_seq=2 ttl=64 time=82.5 ms
^C
--- 192.168.6.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 81.886/82.172/82.458/0.286 ms
</pre>
<p><strong>Checking active connections from Wireguard server:</strong></p>
<p>&#8211; To see which clients are connected to the server and the statistics, you can run the below:</p>
<pre>root@ip-172-31-20-229:~# <strong>sudo wg
</strong>interface: wg0
  public key: pHrkGojLiNZy2GwshmdEXMaaOmowXXXXXXXXXXXXXXX=
  private key: (hidden)
  listening port: 41194

<strong>peer</strong>: 8Zp7Cji5Aseew3L0P3c35sUzJNIPYYYYYYYYYYYYYYY=
  endpoint: <strong>1.2.3.4</strong>:33395
  allowed ips: 192.168.6.2/32
  latest handshake: 1 minute, 12 seconds ago
  transfer: 3.94 KiB received, 1.47 KiB sent
</pre>
<p><span style="color: #3366ff;"><strong>Additional Information:</strong></span></p>
<p>For debugging issue with wireguard, you could check the logs:</p>
<pre><strong>sudo journalctl -eu wg-quick@wg0</strong></pre>
<p>Here is a little cronjob to monitor the tunnel via ping and restart tunnel: (Credits to linuxbabe)</p>
<pre><strong>sudo crontab -e</strong></pre>
<p>-Add the below:</p>
<pre>SHELL=/bin/bash
* * * * * for ((i=1; i&lt;=6; i++)) do (ping -c9 192.168.6.1 &gt; /dev/null || systemctl restart wg-quick@wg0) done
</pre>
<p>Hope this helps! Cheers!</p>
<p><strong>Sources/References:</strong></p>
<p>https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/</p>
<blockquote class="wp-embedded-content" data-secret="32BYiyMmZq"><p><a href="https://www.linuxbabe.com/ubuntu/wireguard-vpn-server-ubuntu">Set Up Your Own WireGuard VPN Server on Ubuntu 24.04/22.04</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Set Up Your Own WireGuard VPN Server on Ubuntu 24.04/22.04&#8221; &#8212; LinuxBabe" src="https://www.linuxbabe.com/ubuntu/wireguard-vpn-server-ubuntu/embed#?secret=fha41Gk5Ja#?secret=32BYiyMmZq" data-secret="32BYiyMmZq" width="474" height="267" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>The post <a href="https://techantidote.com/wireguard-vpn-server-setup-ubuntu/">Setup Wireguard VPN Server and Client in Ubuntu 20.04</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/wireguard-vpn-server-setup-ubuntu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3599</post-id>	</item>
		<item>
		<title>Install Docker on Ubuntu 18.04.1</title>
		<link>https://techantidote.com/install-docker-on-ubuntu-18-04-1/</link>
					<comments>https://techantidote.com/install-docker-on-ubuntu-18-04-1/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sun, 03 Feb 2019 19:52:06 +0000</pubDate>
				<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[18.04.1]]></category>
		<category><![CDATA[convenience script]]></category>
		<category><![CDATA[install docker]]></category>
		<category><![CDATA[linux mint 19]]></category>
		<category><![CDATA[ubuntu 18.04]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=2923</guid>

					<description><![CDATA[<p>This is a tutorial on how to install Docker on Ubuntu 18.04. [Works on Ubuntu 16.04 / 17.04 / 18.04.1 ] Before we install docker, verify if you had installed any older versions of docker. If so, we need to remove them. Run the following to remove any old versions of docker: sudo apt-get remove &#8230; <a href="https://techantidote.com/install-docker-on-ubuntu-18-04-1/" class="more-link">Continue reading <span class="screen-reader-text">Install Docker on Ubuntu 18.04.1</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/install-docker-on-ubuntu-18-04-1/">Install Docker on Ubuntu 18.04.1</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is a tutorial on how to install Docker on Ubuntu 18.04. [Works on Ubuntu 16.04 / 17.04 / 18.04.1 ]</p>
<p>Before we install docker, verify if you had installed any older versions of docker. If so, we need to remove them.</p>
<p>Run the following to remove any old versions of docker:</p>
<pre>sudo apt-get remove docker docker-engine docker.io containerd runc -y</pre>
<p><span style="text-decoration: underline; color: #3366ff;"><strong>Install Prerequisites:</strong></span></p>
<pre>sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y</pre>
<p><span style="text-decoration: underline; color: #3366ff;"><strong>Install docker using convenience script</strong></span></p>
<pre>curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh</pre>
<p><span style="text-decoration: underline; color: #3366ff;"><strong>Add current user to docker group</strong></span></p>
<pre>sudo usermod -aG docker $USER</pre>
<p><span style="text-decoration: underline;"><span style="color: #3366ff;"><strong>Enable Docker service on boot:</strong></span></span></p>
<p>To enable docker service to run on boot, run the following:</p>
<pre>sudo systemctl enable docker</pre>
<p>Now, we need to exit out of the terminal and open a new terminal so that we can start using docker. Else, you may get a permission error. [You could either type &#8220;<span style="color: #3366ff;">exit</span>&#8221; and re-login to your ubuntu server or open a new terminal session].</p>
<p>After re-logging in, we can start using docker.</p>
<p>To start with, you can check the version of docker installed on your system.</p>
<pre>docker version</pre>
<p>Here is a screenshot of the outputs for reference:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2932" data-permalink="https://techantidote.com/install-docker-on-ubuntu-18-04-1/docker-version/" data-orig-file="https://techantidote.com/wp-content/uploads/2019/02/docker-version.png" data-orig-size="709,444" data-comments-opened="1" data-image-title="docker-version" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2019/02/docker-version.png" class="alignnone size-full wp-image-2932" src="https://techantidote.com/wp-content/uploads/2019/02/docker-version.png" alt="docker version" width="709" height="444" srcset="https://techantidote.com/wp-content/uploads/2019/02/docker-version.png 709w, https://techantidote.com/wp-content/uploads/2019/02/docker-version-300x188.png 300w, https://techantidote.com/wp-content/uploads/2019/02/docker-version-192x120.png 192w" sizes="auto, (max-width: 709px) 100vw, 709px" /></p>
<p>When I got this, I&#8217;ll was like&#8230;</p>
<p><iframe loading="lazy" class="giphy-embed" src="https://giphy.com/embed/3ohzdIuqJoo8QdKlnW" width="480" height="222" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>
<p>Now, lets run a  docker container, you can use the following:</p>
<pre>docker run -it <span style="color: #ff0000;">hello-world</span></pre>
<p>You should ideally see docker downloads a docker image and provide you with a hello world message as shown below:</p>
<p><iframe loading="lazy" class="giphy-embed" src="https://giphy.com/embed/VeBeB9rR524RW" width="480" height="201" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>
<p>Just kidding, you should see something outputs as below:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2931" data-permalink="https://techantidote.com/install-docker-on-ubuntu-18-04-1/docker-run/" data-orig-file="https://techantidote.com/wp-content/uploads/2019/02/docker-run.png" data-orig-size="1139,745" data-comments-opened="1" data-image-title="docker run" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2019/02/docker-run-1024x670.png" class="alignnone wp-image-2931 size-full" src="https://techantidote.com/wp-content/uploads/2019/02/docker-run.png" alt="" width="1139" height="745" srcset="https://techantidote.com/wp-content/uploads/2019/02/docker-run.png 1139w, https://techantidote.com/wp-content/uploads/2019/02/docker-run-300x196.png 300w, https://techantidote.com/wp-content/uploads/2019/02/docker-run-768x502.png 768w, https://techantidote.com/wp-content/uploads/2019/02/docker-run-1024x670.png 1024w, https://techantidote.com/wp-content/uploads/2019/02/docker-run-192x126.png 192w" sizes="auto, (max-width: 1139px) 100vw, 1139px" /></p>
<p>Thats all for this tutorial. Do Leave a comment down below if you docker installed successfully.</p>
<p>Do bookmark my website/follow for future docker tutorials.</p>
<p>#PeaceOut</p>
<p><span style="text-decoration: underline;"><span style="color: #3366ff; text-decoration: underline;"><strong>References/Sources:</strong></span></span></p>
<p><a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/" target="_blank" rel="noopener">Docker Install</a></p>
<p><a href="https://giphy.com" target="_blank" rel="noopener">Gify</a></p>
<p>The post <a href="https://techantidote.com/install-docker-on-ubuntu-18-04-1/">Install Docker on Ubuntu 18.04.1</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/install-docker-on-ubuntu-18-04-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2923</post-id>	</item>
		<item>
		<title>Check partition information in Linux</title>
		<link>https://techantidote.com/check-partition-information-in-linux/</link>
					<comments>https://techantidote.com/check-partition-information-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Thu, 29 Nov 2018 18:21:13 +0000</pubDate>
				<category><![CDATA[Linux / Redhat]]></category>
		<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[18.04]]></category>
		<category><![CDATA[fdisk example]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux mint]]></category>
		<category><![CDATA[parted]]></category>
		<category><![CDATA[partition information]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://techantidote.com/?p=2246</guid>

					<description><![CDATA[<p>To show currently mounted partition in human readable format, use: df -h Another way to check partition information using parted. sudo parted /dev/sda print Here, we can see that the disk size is 120GB along with the partition information. To view the list of partitions using fdisk, use: fdisk -l To view the list of block &#8230; <a href="https://techantidote.com/check-partition-information-in-linux/" class="more-link">Continue reading <span class="screen-reader-text">Check partition information in Linux</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/check-partition-information-in-linux/">Check partition information in Linux</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To show currently mounted partition in human readable format, use:</p>
<pre><strong>df -h</strong></pre>
<p><img loading="lazy" decoding="async" data-attachment-id="2786" data-permalink="https://techantidote.com/check-partition-information-in-linux/df-h/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/11/df-h.jpg" data-orig-size="535,341" data-comments-opened="1" data-image-title="" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/11/df-h.jpg" class="alignnone size-full wp-image-2786" src="https://techantidote.com/wp-content/uploads/2018/11/df-h.jpg" alt="df -h sample output screenshot" width="535" height="341" srcset="https://techantidote.com/wp-content/uploads/2018/11/df-h.jpg 535w, https://techantidote.com/wp-content/uploads/2018/11/df-h-300x191.jpg 300w, https://techantidote.com/wp-content/uploads/2018/11/df-h-192x122.jpg 192w" sizes="auto, (max-width: 535px) 100vw, 535px" /></p>
<p>Another way to check partition information using parted.</p>
<pre><strong>sudo parted /dev/sda print</strong></pre>
<p><img loading="lazy" decoding="async" data-attachment-id="2787" data-permalink="https://techantidote.com/check-partition-information-in-linux/parted/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/11/parted.jpg" data-orig-size="711,246" data-comments-opened="1" data-image-title="" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/11/parted.jpg" class="alignnone size-full wp-image-2787" src="https://techantidote.com/wp-content/uploads/2018/11/parted.jpg" alt="parted sample output screenshot" width="711" height="246" srcset="https://techantidote.com/wp-content/uploads/2018/11/parted.jpg 711w, https://techantidote.com/wp-content/uploads/2018/11/parted-300x104.jpg 300w, https://techantidote.com/wp-content/uploads/2018/11/parted-192x66.jpg 192w" sizes="auto, (max-width: 711px) 100vw, 711px" /></p>
<p>Here, we can see that the disk size is 120GB along with the partition information.</p>
<p>To view the list of partitions using fdisk, use:</p>
<pre><strong>fdisk -l</strong></pre>
<p>To view the list of block devices:</p>
<pre><strong>lsblk</strong></pre>
<p>Hope this helps! Cheers <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://techantidote.com/check-partition-information-in-linux/">Check partition information in Linux</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/check-partition-information-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2246</post-id>	</item>
		<item>
		<title>A Simple Bash Script for deploying an EC2 instance in AWS</title>
		<link>https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/</link>
					<comments>https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Fri, 20 Jul 2018 20:33:17 +0000</pubDate>
				<category><![CDATA[aws]]></category>
		<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[aws cli]]></category>
		<category><![CDATA[bash script]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[ec2 bash script]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=2689</guid>

					<description><![CDATA[<p>Below is a sample bash script that I created to deploy an EC2 instance in AWS. What does this script do? -Load the at the user defined values for VPC,Subnet, Security Policy. -Use aws cli to interact with AWS with the IAM user configured. -Create a new AWS key named &#8220;devenv-key&#8221; and store the corresponding &#8230; <a href="https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/" class="more-link">Continue reading <span class="screen-reader-text">A Simple Bash Script for deploying an EC2 instance in AWS</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/">A Simple Bash Script for deploying an EC2 instance in AWS</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Below is a sample bash script that I created to deploy an EC2 instance in AWS.</p>
<p><strong>What does this script do?</strong></p>
<p>-Load the at the user defined values for VPC,Subnet, Security Policy.<br />
-Use aws cli to interact with AWS with the IAM user configured.<br />
-Create a new AWS key named &#8220;devenv-key&#8221; and store the corresponding key in your local machine.<br />
-Deploy an t2.micro ubuntu EC2 instance.<br />
-Upon deployment, it will wait for 60 seconds and SSH directly into the newly deployed ubuntu ec2 instance.</p>
<p><span style="text-decoration: underline;"><strong>Prerequisites:</strong></span></p>
<p>-An Amazon <strong>AWS account</strong>.(Free or Paid account)<br />
-An <strong>IAM user</strong> with Access Key and secret access key.<br />
&#8211;<strong>Pre-configured</strong> <strong>VPC</strong>, <strong>Subnets</strong>, Routes, Internet gateways, <strong>Security policy</strong>.<br />
-Any <strong>Linux</strong> <strong>Machine</strong> with <strong>aws cli utlity</strong> installed.<br />
[Refer to my previous blog post on how to install AWS CLI tool.]<br />
<strong>Link</strong>: <a href="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/">https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/</a></p>
<p>&#8211; In host machine, run &#8220;<strong>aws configure</strong>&#8221; to <strong>configure</strong> your <strong>IAM user details</strong>.</p>
<p>[ PS: I am not a expert in scripting. ]</p>
<p><strong>Variables to be set before running the script:</strong></p>
<p>-I have added the following variables in the script:</p>
<pre>"vpc_id"
"sub_id"
"route_table"
"internet_gateway"
"sec_id"
"aws_image_id"
"i_type".
</pre>
<p>-Substitute values for these variables from that of your AWS environment in the script.</p>
<p><strong>How do I run the script?</strong></p>
<p><strong>Option 1: Git clone and run it<br />
</strong></p>
<p>-I have setup a public project in gitlab. You can clone and run the script (You would require git to clone the project.)</p>
<pre>git clone https://gitlab.com/techantidote/aws-bash.git
cd aws-bash</pre>
<p>-Edit the script getaws.sh and update values for vpc_id, sub_id and sec_id.<br />
-Once done, run the script:</p>
<pre>./getaws.sh</pre>
<p><strong>Option 2</strong>:<br />
-Create a file (getaws.sh), make it executable, copy the below contents to this file and run the script.</p>
<p><strong>Bash Script starts here:</strong></p>
<pre>#!/bin/bash
echo -e "\e[33m ========= AWS Automation Project =========\033[0m"

#AWS variables - Modify these as per your account
# Enter your VPC ID
vpc_id="vpc-12345"

# Enter your Subnet ID.
sub_id="subnet-12345"

#Enter your route table ID - Optional
#route_table="rtb-12345"

#Enter internet gateway - Optional
#internet_gateway="igw-12345"

# Enter your security group ID
sec_id="sg-12345"

# Enter the AWS Image ID you would like to deploy. The below image ID is for an Ubuntu EC2 instance.
aws_image_id="ami-41e9c52e"

#Set the type of instance you would like. Here, I am specifying a T2 micro instance.
i_type="t2.micro"

# Create an optional tag.
tag="Wakanda"

#Create the key name what you want
aws_key_name="devenv-key"
ssh_key="devenv-key.pem"

#Generate a random id - This is optional
uid=$RANDOM

# Generate AWS Keys and store in this local box
echo "Generating key Pairs"
aws ec2 create-key-pair --key-name devenv-key --query 'KeyMaterial' --output text 2&gt;&amp;1 | tee $ssh_key

#Set read only access for key
echo "Setting permissions"
chmod 400 $ssh_key

echo "Creating EC2 instance in AWS"
#echo "UID $uid"

ec2_id=$(aws ec2 run-instances --image-id $aws_image_id --count 1 --instance-type $i_type --key-name $aws_key_name --security-group-ids $sec_id --subnet-id $sub_id --associate-public-ip-address --tag-specifications 'ResourceType=instance,Tags=[{Key=WatchTower,Value="$tag"},{Key=AutomatedID,Value="$uid"}]' | grep InstanceId | cut -d":" -f2 | cut -d'"' -f2)

# Log date, time, random ID
date &gt;&gt; logs.txt
#pwd &gt;&gt; logs.txt
echo $ec2_id &gt;&gt; logs.txt
echo ""

echo "EC2 Instance ID: $ec2_id"
#echo "Unique ID: $uid"
elastic_ip=$(aws ec2 describe-instances --instance-ids $ec2_id --query 'Reservations[0].Instances[0].PublicIpAddress' | cut -d'"' -f2)
echo -e "Elastic IP: $elastic_ip"
echo $elastic_ip &gt;&gt; logs.txt
echo "=====" &gt;&gt; logs.txt

#echo "Copy paste the following command from this machine to SSH into the AWS EC2 instance"
#echo ""
#echo -e "\e[32m ssh -i $ssh_key ubuntu@$elastic_ip\033[0m"
echo ""
countdown_timer=60
echo "Please wait while your instance is being powered on..We are trying to ssh into the EC2 instance"
echo "Copy/paste the below command to acess your EC2 instance via SSH from this machine. You may need this later"
echo ""
echo "\033[0;31m ssh -i $ssh_key ubuntu@$elastic_ip\033[0m"

temp_cnt=${countdown_timer}
while [[ ${temp_cnt} -gt 0 ]];
do
printf "\rYou have %2d second(s) remaining to hit Ctrl+C to cancel that operation!" ${temp_cnt}
sleep 1
((temp_cnt--))
done
echo ""

ssh -i $ssh_key ubuntu@$elastic_ip
</pre>
<p>&nbsp;</p>
<p><strong>Note | Disclaimer:</strong></p>
<p>-I build this very basic script to learn about aws cli (Probably the hard way :P).</p>
<p>-There are way more easier ways to achieve the same result using templates.</p>
<p>-The intention of this script was to learn about AWS CLI and in the future implement methods to control to which VPC/Subnet/IG/Security policy that an EC2 instance needs to be attached on the fly.</p>
<p>-This is strictly to be run on test environments and not for production.</p>
<p>-Terminate your EC2 instance and its resources after testing so that you do not get charged. If you are using the AWS Free tier and within the trial period, you should be fine.</p>
<p>Do let me know your feedback (Good / Bad)in the comments section down below.</p>
<p>Happy Cloud computing <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/">A Simple Bash Script for deploying an EC2 instance in AWS</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/a-simple-bash-script-for-deploying-an-ec2-instance-in-aws/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2689</post-id>	</item>
		<item>
		<title>How to install AWS CLI in Linux +  Auto command completion</title>
		<link>https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/</link>
					<comments>https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Fri, 20 Jul 2018 17:39:21 +0000</pubDate>
				<category><![CDATA[aws]]></category>
		<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[aws autocompletion]]></category>
		<category><![CDATA[aws cli]]></category>
		<category><![CDATA[awscli]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mint]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=2641</guid>

					<description><![CDATA[<p>This is a guide on how to install aws cli utlity in Linux along with screenshots. Requirements: &#8211; Linux. &#8211; Python 2.6.5 or higher. [Tested on Linux Mint with bash shell. should work on Ubuntu as well.] Update your system and its packages: sudo apt update &#38;&#38; sudo apt upgrade -y Install Pip: sudo apt &#8230; <a href="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/" class="more-link">Continue reading <span class="screen-reader-text">How to install AWS CLI in Linux +  Auto command completion</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/">How to install AWS CLI in Linux +  Auto command completion</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is a guide on how to install aws cli utlity in Linux along with screenshots.</p>
<p><strong>Requirements:</strong></p>
<p>&#8211; Linux.<br />
&#8211; Python 2.6.5 or higher.</p>
<p>[Tested on Linux Mint with bash shell. should work on Ubuntu as well.]</p>
<p><span style="text-decoration: underline;"><strong>Update your system and its packages:</strong></span></p>
<pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre>
<p><span style="text-decoration: underline;"><strong>Install Pip:</strong></span></p>
<pre>sudo apt install python-pip -y
sudo pip install --upgrade pip</pre>
<p><span style="text-decoration: underline;"><strong>Install the following modules:</strong></span></p>
<pre>sudo pip install setuptools
sudo pip install wheel</pre>
<p><span style="text-decoration: underline;"><strong>Install AWS CLI:</strong></span></p>
<pre>sudo pip install awscli</pre>
<p>To verify that the installation went well, you can run the following command.</p>
<pre>aws --version</pre>
<p>If the output shows the aws version, then you are all set.</p>
<p><span style="text-decoration: underline;"><strong>Enable AWS commands Auto completion:</strong></span></p>
<p>-To enable auto completion of sub commands, run the following to check where your &#8220;aws&#8221; and &#8220;aws_completer&#8221; are located.</p>
<pre>which aws
which aws_completer</pre>
<p>-Copy the output of &#8220;which aws_completer&#8221;. This would the path.</p>
<p>For example, if the output of &#8220;which aws_completer&#8221; was &#8220;/usr/local/bin/aws_completer&#8221;, then enter the following:</p>
<pre>complete -C '<span style="color: #ff0000;">/usr/local/bin/aws_completer</span>' aws</pre>
<p>Heres a screenshot reference:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2673" data-permalink="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/aws-complete/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/07/aws-complete.png" data-orig-size="530,132" data-comments-opened="1" data-image-title="aws cli" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/07/aws-complete.png" class="alignnone wp-image-2673 size-full" src="https://techantidote.com/wp-content/uploads/2018/07/aws-complete.png" alt="setup aws awscli aws_completer setup for bash" width="530" height="132" srcset="https://techantidote.com/wp-content/uploads/2018/07/aws-complete.png 530w, https://techantidote.com/wp-content/uploads/2018/07/aws-complete-300x75.png 300w" sizes="auto, (max-width: 530px) 100vw, 530px" /></p>
<p><span style="text-decoration: underline;"><strong>Verify if AWS command auto completion works:</strong></span></p>
<p>-Run the following command and press press TAB on your keyboard after typing &#8220;ec&#8221; and it should give you the possible options:</p>
<p>aws ec</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2672" data-permalink="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/aws-command-compleion/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/07/aws-command-compleion.png" data-orig-size="556,103" data-comments-opened="1" data-image-title="aws-command-compleion" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/07/aws-command-compleion.png" class="alignnone wp-image-2672 size-full" src="https://techantidote.com/wp-content/uploads/2018/07/aws-command-compleion.png" alt="aws awscli autocompletion installation on linux mint" width="556" height="103" srcset="https://techantidote.com/wp-content/uploads/2018/07/aws-command-compleion.png 556w, https://techantidote.com/wp-content/uploads/2018/07/aws-command-compleion-300x56.png 300w" sizes="auto, (max-width: 556px) 100vw, 556px" /></p>
<pre><span style="text-decoration: underline;"><strong>Add path to your .bashrc or .bash_profile:</strong></span></pre>
<p>To make the changes persistant for aws command completion, you can add the following to your &#8220;.bashrc&#8221; or &#8220;.bash_profile.</p>
<pre>echo "complete -C ‘<span style="color: #ff0000;">/usr/local/bin/aws_completer</span>’ aws" &gt;&gt; ~/.bashrc</pre>
<p>Hope this helps! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Regards,<br />
<strong>ΞXΤЯ3МΞ</strong></p>
<p>The post <a href="https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/">How to install AWS CLI in Linux +  Auto command completion</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/how-to-install-aws-cli-in-linux-auto-command-completion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2641</post-id>	</item>
		<item>
		<title>Tmux not displaying bash prompt colors</title>
		<link>https://techantidote.com/tmux-not-displaying-bash-prompt-colors/</link>
					<comments>https://techantidote.com/tmux-not-displaying-bash-prompt-colors/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 16 Jun 2018 14:38:12 +0000</pubDate>
				<category><![CDATA[Linux / Ubuntu]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[colours]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[PS1]]></category>
		<category><![CDATA[tmux]]></category>
		<guid isPermaLink="false">https://techantidote.com/?p=2610</guid>

					<description><![CDATA[<p>Here is a screenshot of my terminal when I open tmux: Note: Here, my shell displays my username@hostname but it does not display it in colors  🙁 To make tmux read your bash colors, edit your tmux configuration file: vim ~/.tmux.conf Add the following line to the tmux config file: set -g default-terminal "screen-256color" Exit &#8230; <a href="https://techantidote.com/tmux-not-displaying-bash-prompt-colors/" class="more-link">Continue reading <span class="screen-reader-text">Tmux not displaying bash prompt colors</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://techantidote.com/tmux-not-displaying-bash-prompt-colors/">Tmux not displaying bash prompt colors</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Here is a screenshot of my terminal when I open tmux:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2612" data-permalink="https://techantidote.com/tmux-not-displaying-bash-prompt-colors/tmux-before/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/06/tmux-before.png" data-orig-size="766,367" data-comments-opened="1" data-image-title="" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/06/tmux-before.png" class="alignnone size-full wp-image-2612" src="https://techantidote.com/wp-content/uploads/2018/06/tmux-before.png" alt="tmux PS1 prompt before" width="766" height="367" srcset="https://techantidote.com/wp-content/uploads/2018/06/tmux-before.png 766w, https://techantidote.com/wp-content/uploads/2018/06/tmux-before-300x144.png 300w, https://techantidote.com/wp-content/uploads/2018/06/tmux-before-210x101.png 210w" sizes="auto, (max-width: 766px) 100vw, 766px" /></p>
<p><span style="color: #00ccff;"><strong>Note</strong></span>: Here, my shell displays my <strong>username@hostname</strong> but it does not display it in colors  <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f641.png" alt="🙁" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To make tmux read your bash colors, edit your tmux configuration file:</p>
<pre><strong>vim ~/.tmux.conf</strong></pre>
<p>Add the following line to the tmux config file:</p>
<pre><strong>set -g default-terminal "screen-256color"</strong></pre>
<p>Exit and save the file. Close and re-open tmux.</p>
<p>Now, when you open tmux you should be able to get your regular bash prompt colors. Here is a screenshot after re-opening tmux:</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" data-attachment-id="2613" data-permalink="https://techantidote.com/tmux-not-displaying-bash-prompt-colors/tmux-after/" data-orig-file="https://techantidote.com/wp-content/uploads/2018/06/tmux-after.png" data-orig-size="766,370" data-comments-opened="1" data-image-title="" data-image-description="" data-image-caption="" data-large-file="https://techantidote.com/wp-content/uploads/2018/06/tmux-after.png" class="alignnone wp-image-2613 size-full" src="https://techantidote.com/wp-content/uploads/2018/06/tmux-after.png" alt="tmux $PS1 bash prompt color after modying tmux.conf" width="766" height="370" srcset="https://techantidote.com/wp-content/uploads/2018/06/tmux-after.png 766w, https://techantidote.com/wp-content/uploads/2018/06/tmux-after-300x145.png 300w, https://techantidote.com/wp-content/uploads/2018/06/tmux-after-210x101.png 210w" sizes="auto, (max-width: 766px) 100vw, 766px" /></p>
<p>Hope this helps! Cheers!</p>
<p>&nbsp;</p>
<p>Source: <a href="https://askubuntu.com/questions/125526/vim-in-tmux-display-wrong-colors" target="_blank" rel="noopener">Link</a></p>
<p>The post <a href="https://techantidote.com/tmux-not-displaying-bash-prompt-colors/">Tmux not displaying bash prompt colors</a> appeared first on <a href="https://techantidote.com">Tech Antidote</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techantidote.com/tmux-not-displaying-bash-prompt-colors/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2610</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: techantidote.com @ 2026-10-25 05:02:08 by W3 Total Cache
-->