Great Power with Little Effort?
Welcome To MiniLinux
Tell Me More

About

What is MiniLinux?

  • Run Linux

    Virtualbox

    Emulate a computer that runs a linux based operating system to use any command-line application you want!

  • Incorporate it in Windows

    Cmder & linux.bat

    Combine a powerful console emulator and a script that let's you manage your linux virtual machine easily, in order to create a comfortable experience.

  • Use linux based applications on windows

    Whatever you want

    Enjoy to run linux based applications on your windows system and create new workflows that make you even more efficient than you are already.

  • give

    feedback

How it works

MiniLinux in a nutshell

VirtualBox

Oracle VM VirtualBox is a software that let's you create a virtual machine - that is essentially a computer inside your computer. This VM in turn can run our beloved linux based applications.

Cmder

Cmder is a neat console emulator that supports many features the default windows console lacks. (e.g. shortcuts, aliases, and many more)

Batch Script

Getting multiple programs to work together can be a frustratingly tedious process. That is why I have created a batch script that let's you control your linux VM easily.

Setup Guide

Follow these steps to set MiniLinux up on your machine

Install necessary programs

To make MiniLinux work, these programs are important:

VirtualBox

VirtualBox will emulate a computer (=virtual machine) running a linux operating system, that will run the beloved linux based console applications.

cmder

Cmder is a console emulator for windows. It provides a neat looking console that is, in many ways (shortcuts, ...), superior to the default windows command-line (cmd). It comes in two flavours, of which I prefer the full version that comes with built in tools like git, ssh and many more.

ssh

The full version of cmder comes with ssh, therefore it's not necessary to install it seperately.

Create the virtual machine

The VM is the core of MiniLinux as this is what really executes the linux command line applications.

Install the operating system

To use as little system resources as possible, I chose to use the minimal version of Ubuntu as operating system on the VM.

Short summary:
VM Name MiniLinux
Hostname minilinux
Full name for User MiniLinux
Username for account user
Password for account password

Screenshots of the Ubuntu 14.04 minimal installation:

Open Oracle VM VirtualBox Manager and click on 'New' Click on 'Expert Mode' Choose values and click on 'Create' Choose values and click on 'Create' Select the VM in the list and click on 'Start' Select an iso image and click on 'Start' You can select packages here, but I suggest to install them afterwards When you reboot the VM after the installation you will be greeted with this screen Remove the iso image from your VM's drive Reset your VM Click on 'Reset' The VM should now boot to linux Try to login with your user credentials

Make sure the OS is up to date

sudo apt-get update && sudo apt-get upgrade

Setup a ssh connection

The setup of the ssh connection can be broken down to three parts:

  1. Install openssh

    sudo apt-get install openssh-server openssh-client
  2. Establish a virtual connection between the windows host and the linux guest

    Open the preferences Switch to the 'Network' tab Switch to the 'Host-only Networks' tab Click on the screwdriver icon to view details Copy the ip address, you will need it later. And click on 'Ok' to close the dialog Right click the VM and choose 'Settings' Switch to the 'Network' tab Click on 'Advanced' Click on 'Port Forwarding' Add a port forwarding rule and click on 'Ok' to close the dialog Switch to the 'Adapter 2' tab Select 'Enable Network Adapter' and choose 'Host-only Adapter' for 'Attached to' Click 'Ok' to close the dialog
  3. Connect via ssh

    Use the following command (in windows & cmder) to connect:

    ssh user@192.168.56.1 -p 4022

    The authenticity of host '[192.168.56.1]:4022 ([192.168.56.1]:4022)' can't be established.

    ECDSA key fingerprint is SHA256:VdtF0c7Ptik3rGZMXAqjH+OFocq9Kj2NIdYXh7QEYvE.

    Are you sure you want to continue connecting (yes/no)? yes

    Warning: Permanently added '[192.168.56.1]:4022' (ECDSA) to the list of known hosts. user@192.168.56.1's password:

    Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-86-generic x86_64)

    * Documentation: https://help.ubuntu.com/

    Last login: Sat May 14 14:31:09 2016

    user@minilinux:~$

Install VirtualBox Guest Additions

  1. Start VM
  2. Install Guest Additions

    sudo apt-get install virtualbox-guest-utils

Deny other machines access

Unless you deny other machines access to the VM, anyone could connect. Because I don't really appreciate anyone except myself connecting to my MiniLinux VM, I'll refuse ssh-connections that do not come from my machine.
Restart the VM, before you continue with this procedure!

The first step is to figure out the host IP:

grep ssh /var/log/auth.log -a | tail | grep Accepted

This should give you something similiar to this output (line count may vary - as long as there is at least one line):

Jul 12 07:54:25 minilinux sshd[916]: Accepted publickey for user from 10.0.2.2 port 65199 ssh2: RSA SHA256:3GycrTkwpgsGsQc3Fpt6UWqMhooEvhCthztogo/xY4g

Jul 12 08:18:59 minilinux sshd[1037]: Accepted publickey for user from 10.0.2.2 port 49930 ssh2: RSA SHA256:3GycrTkwpgsGsQc3Fpt6UWqMhooEvhCthztogo/xY4g

Jul 12 08:38:42 minilinux sshd[1201]: Accepted publickey for user from 10.0.2.2 port 50507 ssh2: RSA SHA256:3GycrTkwpgsGsQc3Fpt6UWqMhooEvhCthztogo/xY4g

The host IP is 10.0.2.2 in my case. If your host-IP differs, replace all occurances of 10.0.2.2 in this segment with your host-IP.

Now simply add sshd: 10.0.2.2 to /etc/hosts.allow and sshd: ALL to /etc/hosts.deny.

echo "sshd: 10.0.2.2 # Host PC" | sudo tee -a /etc/hosts.allow
echo "sshd: ALL" | sudo tee -a /etc/hosts.deny

Connect to the VM without password

  1. Create a ssh-key

    I do not want to use my main ssh-key for this purpose, as it is password-protected (which you should do too). Therefore I will create a second ssh-key without password protection that will only be used to connect to the VM. Remember to specify a location to save the key. Otherwise it will overwrite your existing one! Then leave the passphrase empty.

    ssh-keygen

    Enter file in which to save the key (/c/Users/MyUser/.ssh/id_rsa): C:\Users\MyUser.ssh\id_rsa_minilinux

    Enter passphrase (empty for no passphrase):

  2. Enter the ".ssh" directory of your windows machine

    cd /c/Users/MyUser/.ssh
  3. Copy the public key to the VM

    ssh-copy-id -i id_rsa_minilinux.pub localhost

    The authenticity of host 'localhost (::1)' can't be established.

    ECDSA key fingerprint is d2:0d:83:f4:21:95:3c:63:6f:bc:f1:5f:0e:96:c1:e8.

    Are you sure you want to continue connecting (yes/no)? yes

    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

    user@localhost's password:

    Number of key(s) added: 1

    Now try logging into the machine, with: "ssh 'localhost'" and check to make sure that only the key(s) you wanted were added.

  4. Disable GSSAPIAuthentication

    Authenticating with the public key took up to 15 seconds for me. After I disabled GSSAPIAuthentication with the following command, connecting worked in under a second!

    echo "GSSAPIAuthentication no" > config
  5. Try connecting via ssh

    On Windows:

    ssh user@192.168.56.1 -p 4022 -i C:\Users\MyUser\.ssh\id_rsa_minilinux

Access hard drive from within the VM

  1. Create Shared Folder
    Open Oracle VM VirtualBox Manager Rightclick the VM and choose 'Settings' Switch to the 'Shared Folders' tab Click on the icon with the + symbol (top right corner) to add a new shared folder Insert values and click 'OK' Click 'OK' to close the dialog
  2. Start VM
  3. Mount Shared Folder

    1. Create folder where the shared folder should be mounted

      mkdir /c
    2. Mount shared folder

      sudo mount -t vboxsf -o rw,uid=1000,gid=1000 C_DRIVE /c
    3. Check whether mount worked

      1. Enter the folder

        cd /c
      2. Create a folder

        mkdir MiniLinuxTest
      3. Check if the folder was created

        ls -la
      4. Remove the folder:

        rmdir MiniLinuxTest
    4. Automatically mount the folder at startup

      add sudo mount -t vboxsf -o rw,uid=1000,gid=1000 C_DRIVE /c to "/etc/rc.local"

    5. Restart the VM
    6. Repeat 3.3

Use sudo without password prompt

Do note that may not want to do this, as you are likely less hesitant to write sudo in front of a command before revalidating that you typed the command correctly, if you do not have to enter a password. Nevertheless, I consider it a good balance between having to type a password every time i want do use sudo and using the super user per default (sudo -i)

Write user ALL=(ALL) NOPASSWD: ALL in the last line to the file opened by sudo visudo.

sudo visudo

Use a batch script to control the VM easily

Download the script and the config file and add the folder they reside in to your windows PATH variable, in order to access it with linux anywhere. Instead of only downloading the scripts seperately, you can also clone the entire MiniLinux repository to get eventual updates.

Edit the minilinuxconfig.bat before you run linux.bat or it will not work!

Contact Us

Give feedback, propose improvements and ask for support