Blog Archives

Using TRAMP to connect to remote server from Emacs on OCI Instance

For this post I will use the Ubuntu 24.04 release with Emacs 29 on wsl-2.6 and will provide the below steps.

I have already created an OCI Instance and we usually connect with key file directly by below command

ssh -i 'C:\Users\Gowtham\Downloads\<prviate-key-file>' opc@<public-ip-address>

Step 1 : Install Tramp

Installed Tramp by using ELPA. M-x list-packages searched tramp and pressed I for Install and then x to apply. Then recompiled the below using the command

M-x package-recompile RET tramp

Step 2 : Configure ssh

create a file in .ssh folder ~/.ssh/config

Inside the folder I have given below as my configuration

Host UbuntuTest001
     Hostname <IP/Hostname of the System>
     User ubuntu
     Port 22
     IdentityFile ~/.ssh/Ubuntu-20251214-Test001.key
     # Add keep-alive to prevent session hangs
     ServerAliveInterval 5
     ServerAliveCountMax 2

Step 3 : Test ssh

$ ssh UbuntuTest001

Once you put the command to connect the host you should be able to do it. Else the ssh config should be checked

Step 4 : Connect to remote file

To Connect to remote file go to dired mode C-x C-f and then type the below

/ssh:<host_alias_specified_ssh_config>:<remote directory/file to be opened>
;;I connect by the below for testing 
/ssh:UbuntuTest001:/home/ubuntu
Design a site like this with WordPress.com
Get started