Runme for VS Code SSH & Remote
Runme is committed to delivering an exceptional experience right from the start. By using Runme, and VS Code's native-SSH capabilities you can easily connect to an instance and carry out specific instructions using Markdown docs. Before exploring various ways to utilize Runme through SSH, it's important to make sure that you have installed Runme for VS Code or CLI by referring to the installation guide, as well as ensuring that you have access to the remote server you need.
VS Code Remote Development
Using runme on a remote server with VS Code enhances efficiency by streamlining the execution of tasks. It minimizes the need for manual commands, automating repetitive tasks, thereby saving time and reducing errors. This approach also optimizes performance by ensuring consistent and reliable execution of scripts and processes, ultimately improving the development workflow.
💡 Note: Runme harnesses VS Code's Remote Development extensions to attach VS Code to remote SSH hosts.
SSH Connection
To set up your SSH key configuration, follow the steps below:
- Generate an SSH key if you haven't already.
- Identify the remote host you want to connect to and make sure you have the necessary login credentials.
- Ensure that you have Visual Studio Code installed on your local machine.
- Install the Runme extension in Visual Studio Code.
- Use the Visual Studio Code Remote - SSH extension to connect to the remote host via SSH.
- Install the Runme extension on the remote server and leverage the notebook UX to execute what you want.
- Create a block of code called
command
to execute the desired actions on the remote host.
Example: how to use Runme attached to SSH host
mkdir Vsc
cd Vsc
touch example.txt
Key-Based Authentication
To enhance security when using Runme, it is recommended to use SSH keys for authentication. This eliminates the need for password transmission and reduces the risk of brute-force attacks.
To execute commands on a remote server using Runme, follow these steps:
- Set up your SSH key configuration by following the instructions here.
- Remote server: Make sure you have access to the remote server and the necessary permissions to execute commands.
- Create a Markdown file: Create a
.md
file that will connect to the remote server and execute the desired commands. - In the
.md
file, create a block of code that uses the SSH command to connect to the remote server and execute the desired command.
Example: how to use ssh inside of notebooks
ssh user@remote.server.com 'bash -s' < script.sh
This command will run a bash script called script.sh
on the remote server. Make sure to replace user
and remote.server.com
with your own username and the server's hostname or IP address.
By following these steps and using SSH keys for authentication, you can enhance the security of your Runme commands and reduce the risk of unauthorized access or attacks.
- Execute the Runme command:
# short for "runme tui" is
runme
- Select the Markdown file
.md
you want to execute (if you have multiple.md
files or different codeblocks and instruction in a.md
)
Example: how ssh into remote hosts from a notebook
If you need to securely copy files between your local machine and the remote server, you can install SCP on your machine.
Setup SSH Connection
scp /path/to/bash/script user@host:/path/on/remote/server
ssh user@host 'bash /path/on/remote/server/script.sh'
This is an example of running bash script in a server.