Tag Archives: SSH

SSH config files – Windows DOS or Powershell prompt

A local configuration files for ssh where you have all the “shortcuts” you need to contact another computer with openssh server installed. In my example it’s Linux and Windows Servers that I need to manage.

A shortcut could be

ssh node1

to manage node1.pvangsgaard.com

Here is How To setup SSH and config file

You can use powershell prompt or DOS promt, but i will recommend using Hyper Terminal, you can download and install it from https://hyper.is/

if you haven’t used SSH before then generate a key-pair with

ssh-keygen

It will look like this

ssh-keygen on windows (Hyper Terminal)

Now the ssh-keygen have made a directory containing a ssh-keypair

The directory is in your path and in my case C:\Users\peter\.ssh\

ssh key and config directory in windows path

go to the .ssh directory and list content with

cd .ssh
dir
ssh directory content

now start notepad or any editor and write a config for a server, in this example it’s node1.pvangsgaard.com

Host node1
     HostName node1.pvangsgaard.com
     User root
     Port 22
     IdentityFile c:\users\peter\.ssh\id_rsa
ssh config file

If you have another RSA key that is provided by your company then just alter id_rsa filename to the one that you need also remember to change path and servername 😉

Now save the config file in your ssh dir like C:\Users\peter\.ssh\

save config file

It’s very important that the file is named config and NOT config.txt 😉

Now tryout the new config by connecting

ssh node1

Note that is is only working in DOS or Powershell, if you need it in a Linux container in Windows then you have to alter the path and then it will work.

If you use Hyper there is a little bug when exiting the terminal, you need to close all connections and type exit in the last one to close the app.

SSH – warning setlocale: LCC_ALL

If you are getting an error like this when you try to login trough ssh

bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)

Then it can be the fixed by enable the locale on the remote system.

1. edit the file locale.gen and uncommend the line with the locale you are getting in your error message, in my example it is en_DK.UTF-8

sudo nano /etc/locale.gen

2. generate the new extra locale

sudo locale-gen