Author: Sahil Suri

Enabling passwordless authentication for chrooted sftp users in Linux

Introduction In one of our previous articles we demonstrated how to setup chrooted sftp accounts. You may have certain application users which need to connect to the sftp server to transfer files in an automated manner without manual intervention. An enterprise infrastructure may comprise of many scripts as well which might need to transfer files to the sftp server in an automated fashion without having the need to enter credentials. Configuration of password less authentication for chrooted sftp user accounts is similar to that of ssh user accounts but involves an additional step. In this article we will demonstrate how to setup passwordless authentication for a chrooted sftp user account. In order to make this post easy to follow for our readers and maintain continuity we will setup passwordless sftp authentication for the chrooted sftp user named sahil which we created in our earlier article where we explained the setting up of chrooted sftp users. Step 1: Ensure destination user credentials are working Before we setup passwordless authentication let’s first try to login to the server as the user sahil with it’s password to make sure that the user account is working and has been setup correctly. [root@linuxnix ~]# sftp sahil@linuxnix Connecting to linuxnix... sahil@linuxnix's password: sftp> ls sftp> pwd Remote working directory: /myhome sftp> quit [root@linuxnix ~]# Step 2: Setup ssh keys for the source user For the purpose...

Read More

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/ 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 -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

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

Email Subscribe


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.