Google Cloud Platform : Enable Authentication with SSH and Password using AuthenticationMethods option

Here I am going to explain, how to enable Key and Password based authentication in linux instances of Google Cloud. This can be applied on other Cloud or standalone Linux instances. But do check manuals 🙂

When i say Key + Password, I am not referring passphrase which we give while created Private/Publich SSH key. I am referring to multiple auth methods where system will be first authenticated via PubKey and then via Password.

If your Pubkey is not matching it won’t allow you to login. If password not matching then also it won’t allow you to login. You must use exact same credentials which you configured.

I am not explaining here how to create SSH keys or password, I am assuming you already know that.

Continue reading “Google Cloud Platform : Enable Authentication with SSH and Password using AuthenticationMethods option”

UNIX: How to Automate SSH Login

Yesterday, I was working on some shell script piece for my project and I came across a situation where I have to copy some files from one server to another using ‘scp’ command and also some time have to execute some command on other server.  One requirement was we don’t need to pass the password of functional id inside the script.

User should be able to login to other server without password using command  “ssh -l username remotehost”.

For this I used SSH public key based authentication as below:-

Continue reading “UNIX: How to Automate SSH Login”

: bad interpreter: No such file or directory

Today I was running a Shell Script on linux server that I uploaded from windows OS to Solaris machine.When I initiated that script I get ": bad interpreter: No such file or directory" error on the command line.

Some History behind this issue will make you understand this clearlly :-

Text files are often incompatible across operating systems. Why? Because each operating systems use different markers to indicate the end of a line. This will really create a big mess you up if you are trying to transfer files from one operating system to another.

The carriage return is often referred to by the capital letters CR. On a Macintosh, every line has a CR (^M – 13) at the end.

Under Linux (a variant of Unix), the end of a line is indicated by a line feed. Every line ends with a line feed or LF (^J – 10).

These are 2 characters with 2 very separate numeric representations on a computer. A CR is a 13 in the ASCII table of characters and an LF is a 10 in the ASCII table of characters.

Contributing to the confusion is that fact that Microsoft Windows does things yet another way. Under Microsoft Windows, lines end with a combination of 2 characters — a CR followed by a LF. Symbolically, this is represented as CRLF or carriage return, line feed.

Solution:
I am having ultraedit editor. In this editor when ever you open any file in the status bar it shouws you its type (DOS/MAC/UNIX)
if you  want to convert a file from DOS to UNIX

File > Conversions > DOS to UNIX

And if you want to make each file bydefault to DOS/MAC/UNIX  Advanced > Configuration > General Tab inside Editing go to "Default file types for new file" and select desired default type.

You can also refer Ultraedit FAQs http://www.ultraedit.com/support/faq.html

OR

Just create a new file inside UNIX and copy paste your DOS type content. When you save it, it will be converted to UNIX.