# Accessing the File System

## Introduction
This tutorial will walk you through connecting to a NEPI device's File System through an SSH connected terminal from a PC.

## What you will need
**1)** NEPI-enabled device with internet access. This tutorial uses an edge-compute processor box that includes an NVIDIA Jetson Xavier NX embedded GPU with NEPI Engine software installed.

**NOTE**: See available off-the-shelf NEPI enabled edge-compute options at: [/hardware/](https://www.nepi.com/hardware/)

**2)** **1x** PC with internet access and configured to access the NEPI device's RUI browser-based interface. This tutorial uses a Windows 11 PC and a USB GigE Ethernet adapter and Ethernet cable.

**NOTE**: Instructions for configuration a PC and connecting to a NEPI device are provided in the NEPI Engine Getting Started tutorial at: [/tutorials/connecting-setup/](https://www.nepi.com/tutorials/connecting-setup/)

## Hardware Setup
Connect the NEPI device to your PC's Ethernet adapter using an Ethernet cable, then power your NEPI device.

## Accessing the NEPI File System
Download the NEPI default SSH Key

**1)** Download the default NEPI private SSH key "nepi_engine_default_private_ssh_key" from:

[https://github.com/nepi-engine/nepi_engine/blob/ros1_main/nepi_env/ssh_keys/nepi_engine_default_private_ssh_key](https://github.com/nepi-engine/nepi_engine/blob/ros1_main/nepi_env/ssh_keys/nepi_engine_default_private_ssh_key)

The NEPI default SSH account credentials are:
1. username: **`nepi`**
2. password (for sudo): **`nepi`**

### Setting up and using your NEPI SSH Key
SSH password login is disabled for NEPI devices, so you'll need to install the NEPI device's private SSH key and configure your PC following the instructions in this section.

### For Linux PCs
Follow the setup instructions at:

https://github.com/nepi-engine/nepi_setup/blob/main/NEPI_USER_PC_SETUP.md

**NOTE**: After completing setup, a number of useful command line shortcuts will be installed. You can view all of these by typing _**nepihelp**_ in your PC's terminal.

You can ssh and sftp into a running nepi software using **_sshn_** and _**sftpn**_ command line shortcuts.

If you nepi software is running in a container, you can ssh into the container host's OS using _**sshnh**_ command line shortcut.

### For Mac PCs
Both Linux and Mac PC operating systems support direct SSH connections from system terminals. Follow the instructions below to SSH into your NEPI system from either of these platforms.

1. Create a new folder on your PC to store the NEPI ssh key you downloaded and copy the ssh key into that folder (the remaining instructions assume "~/ssh_keys"), then copy the downloaded key to that new folder, then open terminal in the folder you copied the key to, directory and change permissions for the key

```bash
   mkdir ~/ssh_keys
   cd ~/ssh_keys
   wget 'https://www.dropbox.com/scl/fi/t1qcizpfjohqhlwls8il7/nepi_engine_default_private_ssh_key?rlkey=tunjq4u0qim6u2qzfwjnizui3&st=t6m7a6fe&dl=0' -O nepi_engine_default_private_ssh_key
   sudo chmod 600 nepi_engine_default_private_ssh_key
   ```

3) in the same terminal, start an SSH session to your NEPI device by entering the text below:

```bash
   ssh -o StrictHostKeyChecking=no -p 2222 -i ~/ssh_keys/nepi_engine_default_private_ssh_key nepi@192.168.179.103
   ```

You can add useful aliases to your system that make connecting faster and easier with the following instructions:

4) Add the following line to your PC's "hosts" file by opening a terminal on your PC and typing:

```bash
   sudo nano /etc/hosts
   ```
   a) Add the following line to your file, replacing the items in yellow with your actual system values:

```bash
   <IP Address of your NEPI-enabled device> <Name of your NEPI device>
   ```
   b) The factory IP address for NEPI devices is "192.168.179.103"

```bash
   192.168.179.103 nepi
   ```

**NOTE**: If you have multiple nepi devices on the network with different IP addresses, add a line for each with a unique name (i.e.

```bash
192.168.179.103 nepi-robot1
192.168.179.104 nepi-robot2
```

6) Open a new terminal and the test ssh and sftp shortcuts:

```bash
sshn
sftpn
```

**NOTE**: While the 'sftpn' function will log in at the nepi home folder, their are a number of specific sftp shortcuts that will log in to a specific folder on the device, making it easier to 'get' 'put' files located in common nepi folders. A few of these are listed below:

- #### Common Nepi User Driver Folders

|     |     |
  | --- | --- |
  | cfg | /mnt/nepi_storage/user_cfg |
  | ai  | /mnt/nepi_storage/ai_models |
  | auto | /mnt/nepi_storage/automation_scripts |
  | data | /mnt/nepi_storage/data |
  | installs | /mnt/nepi_storage/installs |
  | src | /mnt/nepi_storage/nepi_src |
  | tmp | /mnt/nepi_storage/tmp |

- #### Common Nepi File System Folders

|     |     |
  | --- | --- |
  | aifs | /opt/nepi/ros/share/nepi_aifs |
  | api | /opt/nepi/ros/lib/python3/dist-packages/nepi_api |
  | apps | /opt/nepi/ros/share/nepi_apps |
  | drivers | /opt/nepi/ros/lib/nepi_drivers |
  | etc | /opt/nepi/ros/etc |
  | lib | /opt/nepi/ros/lib |
  | managers | /opt/nepi/ros/lib/nepi_managers |
  | ros | /opt/nepi/ros |
  | nfi | /mnt/nepi_storage/nepi_full_img |
  | nfia | /mnt/nepi_storage/nepi_full_img_archive |
  | python | /opt/nepi/ros/lib/python3/dist-packages/ |
  | rui | /opt/nepi/nepi_rui/src/rui_webserver/rui-app/src |
  | sdk | /opt/nepi/ros/lib/python3/dist-packages/nepi_sdk |

## Customizing the File System

See the tutorials below for information about customizing your NEPI File System and Resident User Interface (RUI):

[https://www.nepi.com/nepi-tutorials/nepi-engine-customizing-the-nepi-file-system/](https://www.nepi.com/nepi-tutorials/nepi-engine-customizing-the-nepi-file-system/index.html)

[https://www.nepi.com/nepi-tutorials/nepi-engine-customizing-the-nepi-rui-system/](https://www.nepi.com/nepi-tutorials/nepi-engine-customizing-the-nepi-rui-system/index.html)
