Enable SSH on Raspbian OS without Desktop UI (Headless)

Step 1

Whichever storage you’re using for your Raspbian OS either SD Card, SSD, or HDD; remove it from your board and mount the storage to your computer. Look for the boot partition and push an empty file with a filename ssh

Step 2

Put your storage back in the board and start your Raspberry Pi.

Step 3

Connect to your Raspberry Pi with SSH ssh [USERNAME]@[YOUR PI IP OR DOMAIN HERE]

Note: The default username and password for Raspbian is pi for username and raspberry as password, in case you didn’t add a new user or you didn’t change it.


  1. Raspberry Pi Documentation: SSH Remote Access
  2. Raspberry Pi Documentation: Linux User Management

Written with StackEdit.

Setting JAVA_HOME Dynamically on Linux

There are two flavor of JDK you can get from any Linux distros, OpenJDK or from Oracle. These software can be installed manually, assigning the static path on JAVA_HOME. What if you installed it directly from yum or apt, how can you assign the correct Java directory for a managed installation?

Note: This how-to assumes you’re using bash as your shell. Feel free to apply it based on what shell you’re using.

User Implementation


Open your .bashrc file using your favorite editor. In this case, I’m using vim.

vi ~/.bashrc


At the end of your .bashrc place the following snippets.

export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))

Then save.


Source your .bashr and check if your JAVA_HOME‘s set.

source ~/.bashrc
printenv JAVA_HOME

Your JAVA_HOME should contain the directory of you JDK installation.

System-wide Implementation

Almost same with our previous steps, but instead of editing our .bashrc we’ll be creating a script file on /etc/profile.d


Create a script file on /etc/profile.d and open the file, or you can do both in one go. But for the sake of this tutorial will do the long one.

touch java.sh
vi java.sh

Note: If you’re not root, you have to sudo on the commands.


Place this on the file

#!/usr/local/env bash

export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))

Then save.


Source the java.sh and check if JAVA_HOME‘s set. You can also logout then log back-in again to check if the script’s loaded.

source java.sh
printenv  JAVA_HOME

Once done, make sure the output shows the location of your Java or JDK installation.