Skip to content

Commit

Permalink
Added authorized keys steps in getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
atteggiani committed Aug 7, 2023
1 parent 6b246df commit 16fa4bc
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 169 deletions.
235 changes: 92 additions & 143 deletions docs/get_started/index.md → docs/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
hide:
- navigation
---
# Get Started
# Getting Started

If you are new to climate science or <a href="../models/">ACCESS models</a>, and you want to:

Expand Down Expand Up @@ -98,58 +98,58 @@ You will be asked for your NCI password and then you will get connected to <i>Ga
### Automate the log in step
To simplify the log in step and avoid having to always insert your NCI password, there are a few steps we suggest you to follow:

<!-- Tab labels -->
<div class="tabLabels" label="systems">
<button>MacOS</button>
<button>Linux / Windows</button>
</div>
<!-- Tab content -->
<div class="tabContents" label="systems">
<!-- MacOS -->
<div>
<ol>
<li>
<b>Create an SSH key</b>
<br>
To create an SSH key, in your terminal, run:
<pre><code>ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</code></pre>
You will be asked to create a passphrase linked to the SSH key, and insert it twice:
<terminal-animation>
<terminal-line data="input">ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</terminal-line>
<terminal-line>Generating public/private rsa key pair.</terminal-line>
<terminal-line>Enter passphrase (empty for no passphrase):</terminal-line>
<terminal-line lineDelay=3000>Enter same passphrase again:</terminal-line>
<terminal-line lineDelay=3000>Your identification has been saved in &lt;$HOME&gt;/.ssh/id_gadi</terminal-line>
<terminal-line>Your public key has been saved in /Users/davide/.ssh/id_gadi.pub</terminal-line>
<terminal-line lineDelay=0>The key fingerprint is:</terminal-line>
<terminal-line lineDelay=0>SHA256:&lt;fingerprint-code&gt; &lt;$USER@hostname&gt;</terminal-line>
<terminal-line lineDelay=0>The key's randomart image is:</terminal-line>
<terminal-line lineDelay=0>+---[RSA 4096]----+</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>+----[SHA256]-----+</terminal-line>
</terminal-animation>
<div class="note">
We suggest you don't leave the passphrase empty for security reason.
<br>
As you will see in the next step, you will not need to insert the passphrase every time you log in to <i>Gadi</i>.
</div>
</li>
<li>
<b>Add the SSH key to the ssh-agent</b>
<br>
An ssh-agent is an SSH key manager that avoids you having to type a passphrase every time you connect to a server.
<br>
To add the SSH key to the ssh-agent:
<ol>
<li>
<b>Create an SSH key</b>
<br>
To create an SSH key, in your machine's local terminal, run:
<pre><code>ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</code></pre>
You will be asked to create a passphrase linked to the SSH key, and insert it twice:
<terminal-animation>
<terminal-line data="input">ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</terminal-line>
<terminal-line>Generating public/private rsa key pair.</terminal-line>
<terminal-line>Enter passphrase (empty for no passphrase):</terminal-line>
<terminal-line lineDelay=3000>Enter same passphrase again:</terminal-line>
<terminal-line lineDelay=3000>Your identification has been saved in &lt;$HOME&gt;/.ssh/id_gadi</terminal-line>
<terminal-line>Your public key has been saved in /Users/davide/.ssh/id_gadi.pub</terminal-line>
<terminal-line lineDelay=0>The key fingerprint is:</terminal-line>
<terminal-line lineDelay=0>SHA256:&lt;fingerprint-code&gt; &lt;$USER@hostname&gt;</terminal-line>
<terminal-line lineDelay=0>The key's randomart image is:</terminal-line>
<terminal-line lineDelay=0>+---[RSA 4096]----+</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>+----[SHA256]-----+</terminal-line>
</terminal-animation>
<div class="note">
We suggest you don't leave the passphrase empty for security reason.
<br>
As you will see in the next step, you will not need to insert the passphrase every time you log in to <i>Gadi</i>.
</div>
</li>
<li>
<b>Add the SSH key to the ssh-agent</b>
<br>
An ssh-agent is an SSH key manager that avoids you having to type a passphrase every time you connect to a server.
<br>
To add the SSH key to the ssh-agent:
<!-- Tab labels -->
<div class="tabLabels" label="systems">
<button>MacOS</button>
<button>Linux / Windows</button>
</div>
<!-- Tab content -->
<div class="tabContents" label="systems">
<!-- MacOS -->
<div>
<ol>
<li>
In your terminal, start the ssh-agent by running:
In your machine's local terminal, start the ssh-agent by running:
<pre><code>eval "$(ssh-agent -s)"</code></pre>
<terminal-animation>
<terminal-line data="input">eval "$(ssh-agent -s)"</terminal-line>
Expand All @@ -170,75 +170,12 @@ To simplify the log in step and avoid having to always insert your NCI password,
</div>
</li>
</ol>
</li>
<li>
<b>Create/Update the SSH config file</b>
<br>
The <code>~/.ssh/config</code> file is a file where you can store labelled SSH configurations for different servers so you don’t have to remember them.
<br>
To create your ssh config file, in your terminal, run:
<pre><code>touch ~/.ssh/config</code></pre>
<div class="note">
If you already have an existing <code>~/.ssh/config</code> file, the command above will not have any effect.
</div>
To store the SSH configurations for <i>Gadi</i> in the SSH config file, you can add the following lines to your <code>~/.ssh/config</code> file:
<pre><code>Host gadi
&emsp;Hostname gadi.nci.org.au
&emsp;User &lt;your-NCI-username&gt;
&emsp;ForwardX11 true
&emsp;ForwardX11Trusted yes
&emsp;IdentityFile ~/.ssh/id_gadi
&emsp;AddKeysToAgent yes
&emsp;UseKeychain yes
</code></pre>
</li>
</ol>
</div>
<!-- Linux/Windows -->
<div>
<ol>
<li>
<b>Create an SSH key</b>
<br>
To create an SSH key, in your terminal, run:
<pre><code>ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</code></pre>
You will be asked to create a passphrase linked to the SSH key, and insert it twice:
<terminal-animation>
<terminal-line data="input">ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_gadi</terminal-line>
<terminal-line>Generating public/private rsa key pair.</terminal-line>
<terminal-line>Enter passphrase (empty for no passphrase):</terminal-line>
<terminal-line lineDelay=3000>Enter same passphrase again:</terminal-line>
<terminal-line lineDelay=3000>Your identification has been saved in &lt;$HOME&gt;/.ssh/id_gadi</terminal-line>
<terminal-line>Your public key has been saved in /Users/davide/.ssh/id_gadi.pub</terminal-line>
<terminal-line lineDelay=0>The key fingerprint is:</terminal-line>
<terminal-line lineDelay=0>SHA256:&lt;fingerprint-code&gt; &lt;$USER@hostname&gt;</terminal-line>
<terminal-line lineDelay=0>The key's randomart image is:</terminal-line>
<terminal-line lineDelay=0>+---[RSA 4096]----+</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>|xxxxxxxxxxxxxxxxx|</terminal-line>
<terminal-line lineDelay=0>+----[SHA256]-----+</terminal-line>
</terminal-animation>
<div class="note">
We suggest you don't leave the passphrase empty for security reason.
<br>
As you will see in the next step, you will not need to insert the passphrase every time you log in to <i>Gadi</i>.
</div>
</li>
<li>
<b>Add the SSH key to the ssh-agent</b>
<br>
An ssh-agent is an SSH key manager that avoids you having to type a passphrase every time you connect to a server.
<br>
To add the SSH key to the ssh-agent:
</div>
<!-- Linux/Windows -->
<div>
<ol>
<li>
In your terminal, start the ssh-agent by running:
In your machine's local terminal, start the ssh-agent by running:
<pre><code>eval "$(ssh-agent -s)"</code></pre>
<terminal-animation>
<terminal-line data="input">eval "$(ssh-agent -s)"</terminal-line>
Expand All @@ -256,31 +193,43 @@ To simplify the log in step and avoid having to always insert your NCI password,
</terminal-animation>
</li>
</ol>
</li>
<li>
<b>Create/Update the SSH config file</b>
<br>
The <code>~/.ssh/config</code> file is a file where you can store the SSH configurations for different servers, labeled so you don't have to remember them.
<br>
To create your ssh config file, in your terminal, run:
<pre><code>touch ~/.ssh/config</code></pre>
<div class="note">
If you already have an existing <code>~/.ssh/config</code> file, the command above will not have any effect.
</div>
To store the SSH configurations for <i>Gadi</i> in the SSH config file, you can add the following lines to your <code>~/.ssh/config</code> file:
<pre><code>Host gadi
&emsp;Hostname gadi.nci.org.au
&emsp;User &lt;your-NCI-username&gt;
&emsp;ForwardX11 true
&emsp;ForwardX11Trusted yes
&emsp;IdentityFile ~/.ssh/id_gadi
&emsp;AddKeysToAgent yes
</code></pre>
</li>
</ol>
</div>
</div>
<!-- End of tab -->
</div>
</div>
</li>
<li>
<b>Create/Update the SSH config file</b>
<br>
The <code>~/.ssh/config</code> file is a file where you can store labelled SSH configurations for different servers so you don’t have to remember them.
<br>
To create your ssh config file, in your machine's local terminal, run:
<pre><code>touch ~/.ssh/config</code></pre>
<div class="note">
If you already have an existing <code>~/.ssh/config</code> file, the command above will not have any effect.
</div>
To store the SSH configurations for <i>Gadi</i> in the SSH config file, you can add the following lines to your <code>~/.ssh/config</code> file:
<pre><code>Host gadi
&emsp;Hostname gadi.nci.org.au
&emsp;User &lt;your-NCI-username&gt;
&emsp;ForwardX11 true
&emsp;ForwardX11Trusted yes
&emsp;IdentityFile ~/.ssh/id_gadi
&emsp;AddKeysToAgent yes
&emsp;UseKeychain yes
</code></pre>
</li>
<li>
<b>Add the SSH key to the Authorized Keys</b>
<br>
To enable automatic connection to a server, that server needs to recognise the SSH key as an <i>authorized</i> one. The list of authorised keys for a certain server, is stored inside the file <code>~/.ssh/authorized_keys</code>.
<br>
To add the newly created SSH key as an <i>authorized</i> key for Gadi, in your local machine's terminal, run:
<pre><code>var=$( cat ~/.ssh/id_gadi.pub ) && ssh gadi "echo $var >> .ssh/authorized_keys"</code></pre>
<div class="note">
Make sure you use double quotes (") in the previous command.
</div>
You will be asked for your password, and if you did all the previous steps correctly, this will be the last time you will have to insert it.
</li>
</ol>
Once you complete all the above steps, you will be able to connect to <i>Gadi</i> simply by running:
<pre><code>ssh gadi</code></pre>

Expand Down
2 changes: 1 addition & 1 deletion docs/model_evaluation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ACCESS-NRI's "Model Evaluation and Diagnostics" work is a critical facet of clim

If you are new to model evaluation and diagnostics, we recommend you read our [Getting Started with MED page](./model_evaluation_getting_started/index.md):
<div class="card-container">
<a href="../get_started" class="vertical-card aspect-ratio1to1">
<a href="../getting_started" class="vertical-card aspect-ratio1to1">
<div class="vertical-card-image-container">
<img src="..//assets/model_evaluation/Gadi-19-2.jpg" alt="Computing Access" class="img-cover"></img>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Welcome to Model Evaluation and Diagnostics!
Here, we provide you the important information to give you access to the large data that we curate at NCI's storage and show you how you can use it to figure out how fit for purpose specific models are, in particular when you compare them to osbervational data:

<div class="card-container">
<a href="../../get_started" class="vertical-card aspect-ratio1to1">
<a href="../../getting_started" class="vertical-card aspect-ratio1to1">
<div class="vertical-card-image-container">
<img src="../../assets/model_evaluation/Gadi-19-2.jpg" alt="Computing Access" class="img-cover"></img>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Model Evaluation Environment at NCI's Gadi

At this stage of *Getting Started*, we assume that you already have access to NCI's Gadi. If this is not the case, please go to our instructions on how to get [access to NCI's Gadi](../../get_started/index.md).
At this stage of *Getting Started*, we assume that you already have access to NCI's Gadi. If this is not the case, please go to our instructions on how to get [access to NCI's Gadi](../../getting_started/index.md).

Here we describe the additional information to get started with model evaluation that is supported by ACCESS-NRI.

Expand Down Expand Up @@ -30,7 +30,7 @@ You are now able to use the scripts of our currated environment, including `pyth

## 3 Interactive computing on NCI via the Australian Research Environment (ARE)

NCI also supports an interactive coding environment called the Australian Research Environment (ARE). It's use is quite similar to submitting a computing job via `qsub -I`, but it comes with dedicated graphical user interfaces for jupyter notebooks. To use it, you need an NCI account and be part of a project that gives you computing resources (see our [getting started](../../get_started/index.md)).
NCI also supports an interactive coding environment called the Australian Research Environment (ARE). It's use is quite similar to submitting a computing job via `qsub -I`, but it comes with dedicated graphical user interfaces for jupyter notebooks. To use it, you need an NCI account and be part of a project that gives you computing resources (see our [getting started](../../getting_started/index.md)).

You can then easily go to [https://are.nci.org.au](https://are.nci.org.au) and login. After you are logged in, you can click on the featured app button "JupyterLab" to start a JupyterLab instance. This will progress you to a window with many input fields. You need to at least fill in the following (we show default values, but you need to adjust them for your given use case and projects):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To have the huge amount of data from different experiments on the NCI storage at the palm of your hand, we provide a ("meta") catalog for you to query via python as part of the `#!python intake` package with our curated catalog plugin `#!python intake.cat.access_nri` .

To use this catalog, you need access to NCI's Gadi. Check out our [Get Started with ACCESS at NCI](../model_evaluation_getting_started/index.md) guide on how to get access.
To use this catalog, you need access to NCI's Gadi. Check out our [Getting Started with ACCESS at NCI](../model_evaluation_getting_started/index.md) guide on how to get access.

Once logged in to Gadi, you will need to add the `#!python access-nri-catalog` to your `#!python conda` environments and start an [ARE JupyterLab Session](https://are.nci.org.au/pun/sys/dashboard). Check out our [ACCESS-NRI Intake Catalog](https://github.com/ACCESS-NRI/access-nri-intake-catalog/blob/main/docs/getting_started/index.rst) guide for the specific setup (note that you can only read in data from specific experiments if they are loaded through the *Storage* keyword).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The COSIMA Cookbook is a framework for analysing output from ocean-sea ice model

## Getting Started

The easiest way to use the COSIMA Cookbook is through the [Australian Research Environment (ARE)](https://are.nci.org.au) access of the [National Computational Infrastructure](https://nci.org.au). Here, we assume that you already [got started](../../get_started/index.md), that is, you have an NCI account and can log onto Gadi via secure shell (ssh).
The easiest way to use the COSIMA Cookbook is through the [Australian Research Environment (ARE)](https://are.nci.org.au) access of the [National Computational Infrastructure](https://nci.org.au). Here, we assume that you already [got started](../../getting_started/index.md), that is, you have an NCI account and can log onto Gadi via secure shell (ssh).

To use the COSIMA Cookbook that is preinstalled in the `conda/analysis3` of NCI proejct `hh5`, you need to [join NCI project `hh5`](https://my.nci.org.au/mancini/project/hh5).

Expand Down
2 changes: 1 addition & 1 deletion docs/models/run-a-model/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Run a Model
If you are new to climate science or ACCESS Models, check [how to get started](../../get_started).
If you are new to climate science or ACCESS Models, check [how to get started](../../getting_started).

If you are not sure which ACCESS Model is the right one for your needs, check out our
[ACCESS Models overview](../).
Expand Down
Loading

0 comments on commit 16fa4bc

Please sign in to comment.