Author: Sahil Suri

GitHub and git integration: using ssh instead of https

Introduction In our last article, we demonstrated how we could mirror our repository from our local computer to GitHub and use https to push our repository data from our local computer to GitHub. In this article, we will demonstrate how we may use the ssh protocol to authenticate with GitHub and push changes to it. Demonstration: First, we will need to generate our ssh keys on our local computer. We will be using these keys to authenticate with GitHub. [sahil@git-ansible ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/sahil/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/sahil/.ssh/id_rsa. Your public key has been saved in /home/sahil/.ssh/id_rsa.pub. The key fingerprint is: b3:b4:0c:ad:44:a2:c4:7b:46:52:1e:5d:c9:14:7c:d0 sahil@git-ansible The key's randomart image is: +--[ RSA 2048]----+ | o. === | | . o .. + E | | + + . . | | . = o . | | o o o S | | o . = + | | . + | | | | | +-----------------+ [sahil@git-ansible ~]$ ls -l /home/sahil/.ssh total 24 -rw-r--r--. 1 sahil sahil 658 Dec 28 04:03 authorized_keys -rw-------. 1 sahil sahil 668 Dec 17 20:26 id_dsa -rw-r--r--. 1 sahil sahil 601 Dec 17 20:26 id_dsa.pub -rw------- 1 sahil sahil 1679 Jun 12 09:44 id_rsa -rw-r--r-- 1 sahil sahil 399...

Read More

How to use bash aliases over ssh in Linux

Introduction In a previous article we explained along with practical examples what are aliases in bash and how they work. In that article we also demonstrated how we could create create more complex aliases in the form of functions and how we could unset or remove and alias. I’ve you’ve tried to run an alias over an ssh session you would’ve noticed that they do not work by default. In this article we will explain how to run aliases over a remote ssh session. What is a bash shell alias? Although we’ve defined aliases in our previous article but we’ll explain them again briefly in this article for the sake of completeness. I’ve you’ve worked on the command line for a while you would be aware that on many occasions we have to chain commands i.e. execute multiple commands together in a single line separated by semicolons as delimiters  and pipe the output of one command to the input of another command. Although the creators of shell commands have made an effort to ensure that command names are short and precise. But chaining or piping commands which we use frequently can result in a lot of typing on the users’ part. Bash allows us to create our own shortcuts of such long combination of commands by using aliases. Syntax for declaring an alias The syntax for declaring an alias...

Read More

Troubleshooting chrooted sftp account setup in Linux

Introduction In a previous article we demonstrated the process involved in configuring a chrooted sftp account on a Linux system. Although the process is fairly straightforward you might face issues during the setup if you do not follow the steps exactly to the tee or if you are consulting multiple sources. In this article, we’ll describe three common troubleshooting scenarios due to which your chrooted sftp configuration might fail. Scenario 1: Incorrect ownership and permissions: A chrooted setup demands that the user home directory must be owned by root. Let us consider the user we tested in our previous article. The user name was sahil for which the chrooted home directory was /chroots/sahil/ and the directory accessible to the user as it’s home directory was /chroots/sahil/myhome. For the setup to work correctly the directory /chroots/sahil/ should be root owned.  In case the owner of the chrooted home directory is the user itself as shown below then the setup will not work: [root@linuxnix ~]# ls -ld /chroots/sahil/ drwxr-xr-x. 3 sahil root 4096 Jul 19 22:42 /chroots/sahil/ [root@linuxnix ~]# If we try to login as the user sahil using sftp we face the following error: [root@linuxnix ~]# sftp sahil@linuxnix Connecting to linuxnix... sahil@linuxnix's password: Write failed: Broken pipe Couldn't read packet: Connection reset by peer [root@linuxnix ~]# If we take a look at the /var/log/secure file we’ll find the following error message...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.