About Sundararajan narasiman
View all posts by Sundararajan narasiman
There are times, we want to collaborate with other stakeholders in Github in a private manner. Meaning, we need to work and collaborate on a private Github repository. If you have a private Github private repository ready for collaboration, the most proven way to work with that is to leverage one of the following two options.
- Leverage SSH keys at the Github account level. So that you can work with Github private repository using SSH keys. The whole idea is that you will be generating an RSA key pair using SSH Key gen utility, add the private key portion of the key pair to the SSH agent and upload the public key portion of the key pair to the Github account settings. The advantage of this approach is that you have one SSH key defined at the Github account level to manage or work with all the private Github repositories created under that account.
- Leverage Deploy Keys at the individual repository level. I have learnt that a Deploy Key can be associated with only one Github repository at this point in time.
The advantage of the second approach is that you can have a dedicated key or set of deploy keys for individual repositories.
In this post, i’ll be covering the option #1. Basically i will leverage bash on windows 10 to work with private github repository using SSH keys. My windows 10 is already set up with Ubuntu 18.0.4 for Windows sub-system for linux. I’m not covering the steps for setting up bash on Windows 10 using Windows subsystem for linux. You can refer microsoft documenation for that. Let’s move to the SSH set up process for Github.
Navigate to the directory in windows 10, where you want to generate SSH key pair.
Type ‘bash’ on the command prompt. It will launch the bash shell on windows 10. Basically the Windows folder that you have pointed will be mounted to the ubuntu 18.0.4 bash shell.
Now you can generate the SSH key pair using ‘ssh-keygen’ utility.
ssh-keygen -t rsa -b 4096 -C “email@example.com“
Enter the name of the file for saving the key pair and provide any arbitrary passphrase when prompted.
Start the ssh on the bash shell. We need to explicty start it, because the run levels of this is different from a standard ubuntu desktop OS. I have learnt that the SSH agent does not get started automatically when you invoke bash on windows 10, unlike a standard ubuntu desktop OS.
eval $(ssh-agent -s)
Add the private key portion of the generated key pair to the SSH agent.
If you getting a permission error for the generated key pair, the key will not get added successfully to the agent.
Even if you try to modify the permission of the key using ‘chmod 400’ or ‘chmod 600’ on the mounted directory, it won’t be successful. Becuase i’ve learnt that changing file permissions using chmod on the mounted directory (from windows 10) does not work.
The best way to fix this is to copy the key to a folder under the ubuntu user root directory, not to any windows mounted directory on bash.
Check if the directory ~/.ssh already exists on the bash shell. If not, explicitly create a directory ~/.ssh and exit the bash shell.
Again, navigate to the directory in windows 10 where the key pairs are generated and launch bash from there.
copy private key to ~/.ssh
Navigate to ~/.ssh and change permissions using any one of the following commands.
chmod 400 sundargitsshkey
chmod 600 sundargitsshkey
Copy the public key of the generated key pair (with ‘.pub’ suffix) to New –> SSH Key under Github account settings. Basically copy the content of the public key using any of the text editors and paste there in textbox available in New –> SSH Key under Github account settings.
Navigate to the SSH config file located in ‘/etc/ssh/ssh_config’ and add an entry for ‘IdentityFile ~/.ssh/sundargitsshkey’
sudo nano ssh_config
Start the SSH agent explicitly.
eval $(ssh-agent -s)
Verify the connectivity to Github using this command ‘SSH -T firstname.lastname@example.org’. You need to user the Github user name as ‘git’. If you try to use your actual Github user name, you’ll get errors.
It will ask you to confirm to accept the warning on authenticity of github.com. Accept it and provide passphrase for private key file when prompted. You’ll get the confirmation for successful authentication to make SSH calls into Github account from your bash shell.
Now you do git clone, commit and push to any number of repositories under your Github account using SSH, be it a private repository or public repository. This completes the post on working with Github private repository using bash on Windows 10.
I’m exploring a lot on .NET cross platform development these days. One of the option other than .NET core, is to leverage Mono framework. Mono framework and MonoDevelop IDE also helps us to develop cross-platfrom .NET applications. Here are the steps i followed to set up Mono framework and MonoDevelop IDE on Ubuntu 18.0.4.
a)Set up mono repository for ubuntu 18.0.4
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo “deb https://download.mono-project.com/repo/ubuntu stable-bionic main” | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
b)Install required packages
Install the package mono-devel to compile the code.
sudo apt install mono-devel
Install the package mono-complete to install everything.
sudo apt install mono-complete
Install the package mono-dbg to get the debugging symbols for framework libraries.
sudo apt install mono-dbg
Install package referenceassemblies-pcl for PCL compilation support (this gets installed if your install mono-complete).
sudo apt install referenceassemblies-pcl
Install package ca-certificates-mono to get SSL certificates for https connection (this gets installed if your install mono-complete).
sudo apt install ca-certificates-mono
Install pakage mono-xsp4 to run ASP.NET applications.
sudo apt install mono-xsp4
c)Install monodevelop IDE
The pre-requisite for installing MonoDevelop IDE is to set up the mono repository for ubuntu 18.0.4 (mentioned in step #a). Then proceeed to IDE installation using apt-get package manager.
sudo apt-get install monodevelop
I have set up a virtual box guest VM running ubuntu 18.0.4. I tried to SSH into the ubuntu guest VM from host. It did not work. Here are the simple steps to enable SSH to access ubuntu guest VM from host.
By default, when we create a virtual machine in virtual box, it will come up with a pre-configured NAT adapter.
This will provide the internet connection to the guest VM. This is not enough for enabling SSH. Power off the virutal machine, open network settings in virtual box and add a host only adapter.
Go to File –> Host Network Manager and make sure that the selected network adapter for host only network is enabled with DHCP configuration.
The virtual machine that is configured with this Host only network adapter can receive static ip addresses in the range of lower bound and upper bound mentioned in this configuration. In this case, it is between 192.168.57.3 and 192.168.57.254 (both bounds inclusive).
Switch on the virtual machine and log in.
We need to make changes to the network interfaces file of ubuntu, to reflect the host only adapter and the static ip for the VM.
Navigate to /etc/network/interfaces and add the following lines.
iface enp0s8 inet static
In mycase the host only network adapter is assigned as enp0s8 in the guest VM. In your case, it may be same or different. Based on that set it appropriately.
The next step is to install the openssh server. Run the following commands in the terminal.
iface eth1 inet static
Restart VM and we can the static IP address of 192.168.57.4 assigned to it.
SSH from host. It should be successful.
This completes the post of enabling SSH for ubuntu 18.04 guest VM running in virtual machine.
I was trying to set up Docker in my machine running ubuntu 18.0.4. I got this error “Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)”, while issuing ‘Docker login’ command from the terminal.
I have learnt that the fix for this issue is to add couple of more entires in the resolve.conf file.
Navigate to /etc/resolv.conf
Add the following nameserver entries
After making this change, i was able to successfuly login to docker hub from the terminal.
AWS Simple Storage Service (S3) offers one of the powerful capability to host static websites. In this post let’s cover the steps for the same.
Create a sample bucket by name ‘mytestdomain.com’. The convention is that bucket name should match with the website domain name.
In this case the domain name for the static website is mytestdomain.com. The S3 bucket should match that name.
Enable public read access to this bucket.
Enable static web site hosting for the bucket by selecting ‘Use this bucket to host a static website’ and specifying the index document and error document.
Upload the index.html and error.html file and grant the public read access to it. Now access the static website url
provided by S3. It should be in this format.
It should render the index.html in the browser
To render this website with the actual domain name, we need to leverage Route 53 DNS service offered by AWS.
Create a hosted zone for our custom domain.
Once the hosted zone is created, S3 presents with list of name servers. It should be mapped with the domain registrar for routing the request through Route 53.
The next step is to create a Record Set for the Hosted Zone bye selecting the Alias Target to the S3 bucket enabled for static website hosting.
It takes few minutes for the record set changes to get propagated. After that try accessing the website domain url. It should render the index page. This completes this article.
I was trying to pull some docker images from DockerHub. I got this error message “Client.Timeout exceeded while waiting headers”.
After doing a bit of debugging and going through online forums, i tried this option of changing the DNS server to Fixed and restarted the Docker engine.
After that I was able to execute all the Docker commands successfully.
For almost three years I have not used this space for sharing my thoughts on technology. I could not do this for various reasons. In a span of three years lot has happened in my professional life and I’ve switched planes and nowadays I’ve diversified myself by exploring into open source technologies as well. We live an interesting time where we see a tremendous explosion in new technologies especially Artificial Intelligence, Big Data, Machine Learning etc. I will be sharing my experiences on what i work and learn from a developer standpoint. Stay tuned !!!