Multiple ssh keys under one username on one machine.

Following on from the ssh config file post, you might think it wise as many do to not just one key for everything but instead use multiple keys.

Above we have a config for a host named johngeenproj which maps to john.geeproj.com. When you run:

SSH will by default pass the id_rsa  key set.

To specific a specific key, or in other words specific an identity file simply add:

As you might not have that key yet, just run ssh-keygen again and when it asks for the key name, just specific and hit enter (doesn’t need to be the full path name just the file name).

 

ssh config files

The following is an acceptable ssh line:

Improved with ssh keys looks like:

Making it even easier, create a file named config:

Within config place you shortcut, eg:

Now ssh is just:

Running apache2 vhost as different user & group to the default

Running apache2 as a different user and group from the default is great for dev environments. If you rsync to your dev build then your files will likely be set as the user that ssh’d them in: rsync from windows with cwrsync with komodo edit

So when this happens just set the vhost in question to have apache run as said user:

  1. install http://mpm-itk.sesse.net/:
  2. Restart apache
  3. Add the following to your vhost config file:   /etc/apache2/sites-available/mydomain.com:

That is it, your files palced on your dev build via your rsync command can now be read by apache.

cwrsync from drive other than drive c

If your files are not kept on the operating system drive, aka drive c you would need to map you rsync local path through a virtual path call: /cygdrive/

As an example, an address seen in windows explorer:

Would become:

So the whole rsync command might look like:

 

rsync from windows with cwrsync with komodo edit

Following from a previous post: http://webconfiguration.blogspot.co.uk/2014/07/ssh-keys-between-windows-and-unix.html

You should now be able to ssh into a destination without being prompted for a password.

For development environment you should now be able to rsync from your windows machine to said server.

In komodo edit, in the right hand column add a new macro by right clicking on the project toolbox:

I chose javascript as the language to write the macro:

 

Now move over to the triggers section and select your new macro to run after each file save.

The result should be your working copy will be kept in sync with your dev server as you work.

Webmin install on FreeBSD

  1. login as root 
  2. portsnap fetch update  
  3. cd /usr/ports/sysutils/webmin 
  4. make install clean  
  5. pico /etc/rc.conf  
  6. append the following line: webmin_enable=”YES” 
  7. a – /usr/local/lib/webmin/setup.sh  
  8. Accept the defaults (choose no for ssl, runs slower & not needed here, ensure you note down the admin username you choose and password you choose)  
  9. Give webmin a bit of a kick:  /usr/local/etc/rc.d/webmin restart 
  10. Log in to webmin ssl on = https://mydomain.co.uk:10000 ssl off= http://mydomain.co.uk:10000

SSH keys between windows and unix

SSH windows to unix with tools:  cwRsync, Rsync, Cygwin, OpenSSH

  1. Download and unzip cwrsync from: http://www.rsync.net/resources/howto/windows_rsync.html 
  2. run the .exe file and leave everything set the default options  
  3. cwrsync (or rsync) and ssh etc etc is not automatically made available to cmd and must be added to the system wide environment variables to do so:
    • control panel > system > click “advanced system settings” on the left col
    • click the “environment variables” button
    • In the system variables, find “Path” and click edit
    • Path is a semi colon separated string, simply add the path to cwrsync bin folder:
      • c://bin
  4. now all the .exe programs from within the bin directory are available from cmd, including ssh-keygen. 
  5. now you need to create a set of keys for ssh: 
    • run from cmd: ssh-keygen 
    • as we don’t want the key to be protected by a password just accept all the options as blank or default.  
    • in the current users folder there should now be a .ssh folder with a few files in, those are the keys
  6. Now on your unix box you need to place the id_rsa.pub contents into a file named “authorized_keys”:
    • the following need to be owned by the user that you intend to login as, so the easiest thing to do here is create them as said user.
    • In the user’s home folder, create a folder named ‘.ssh’ eg on freeBSD (it is the same on a linux box too): /home//.ssh/ 
    • within the .ssh folder create the ‘authorized_keys’ file (using pico this will auto create a new file): “pico /home//.ssh/authorized_keys” 
    • Go back to your windows box and copy the contents of the id_rsa.pub file 
    • paste into you new auth keys file, save and close. 
    • the .ssh folder permissions need to be 0700 
    • the key file needs to be 0600 
  7. You should now be able to ssh without a password into the unix box from cmd.

Node.js on Ubuntu/Debian

NB This post is now outdated and node should be available straight from apt-get

Adding Chris Lea’s Repo

Using Launchpad repo by Chris Lea just run following commands

node.js install

Check node.js version

Outputs

npm install

Above command should install npm.
Check npm version

Outputs

If for some reason, if you see npm is not installed, you may try running: