From UABgrid Documentation
To use the the SSH extension to access files on Cheaha, please follow the instructions in the documentation for installation. Once it is installed, follow these instructions to set up the SSH config file. The following assumes SSH is installed locally, and that a config file exists in the usual location for your operating system. The commands assume you have an open Visual Studio Code window.
- Open the command palette, default hotkey "Ctrl + Shift + P".
- Locate "Remote-SSH: Connect to Host..." by typing part of the command at the prompt.
- Click the command in the palette prompt.
- Click "Configure SSH Hosts...".
- Choose the location of the existing config file.
- In the new editor window that opened, add the following lines then save the file.
Host cheaha HostName cheaha.rc.uab.edu User <username>
The text <username> should be replaced by the user name you use to access Cheaha. The "User" line is not necessary but can save some time.
IMPORTANT! The Remote-SSH extension of Visual Studio Code runs on the login node! All subprocesses spawned by Visual Studio Code will also run on the login node by default. This is due to a limitation with the deployment of the extension server code used to transfer data from Cheaha to your local machine. As always, avoid using computation-heavy processes on the login node. This includes working within repositories with many files, with large files, debugging programs, or using the Python extension for accessing or running code within Jupyter notebooks. Issue #1722 has been opened on the relevant GitHub repository. Please click the thumbs-up emoji on the first post there to increase visibility and priority of the issue.
First, ssh into VM like normal:
If you are trying to edit file on VM, not Cheaha, make sure you have tmux installed on system.
# Ubuntu sudo apt install tmux # CentOS sudo yum install tmux
Now, create a tmux session and detach right away.
tmux new # Ctrl+B then D ^B d
You can exit this ssh connection now.
Now ssh with the following command:
ssh -t firstname.lastname@example.org "tmux attach"
or you can setup in your ssh config(
Host cheaha HostName cheaha.rc.uab.edu User <username> RequestTTY force RemoteCommand tmux attach
With the setting you can ssh with:
Everytime you finish you editing on remote, either Cheaha or VM, use the detach command:
# Ctrl+B then D ^B d
With tmux Control Mode
Note: It only works with iTerm2 on MacOS
ssh with remote command and special option
-t Force pseudo-terminal allocation.
ssh -t email@example.com "tmux -CC attach"