There are various ways to do this, but in generally you are going about this problem backwards. Copy your emacs configs to the remote machine and use emacs local to the files you are editing.
The "various ways to do this" would fall into two categories. First would be ways of mounting a remote drive locally through something like sshfs, some fuse file system, samba, nfs, or any number of other mounting systems to bring file level access to your machine. Second would be various programs that allow you to login and browse a remote system, then operate on files by transferring a copy of them to a local temp file, editing it, then transferring it back. Several programs make that process look pretty seamless, but it's a hack.
First of all, you don't need to connect to your machine in order to display remote programs locally. In fact, it's harder to do it that way. In order to log into a remote server and run a graphical program and see its GUI on your local machine, you will need to activate ssh X forwarding which is done by either the -X
or -Y
options of ssh
:
-X Enables X11 forwarding. This can also be spec‐
ified on a per-host basis in a configuration
file.
X11 forwarding should be enabled with caution.
Users with the ability to bypass file permis‐
sions on the remote host (for the user's X
authorization database) can access the local
X11 display through the forwarded connection.
An attacker may then be able to perform activi‐
ties such as keystroke monitoring.
For this reason, X11 forwarding is subjected to
X11 SECURITY extension restrictions by default.
Please refer to the ssh -Y option and the
ForwardX11Trusted directive in ssh_config(5)
for more information.
-Y Enables trusted X11 forwarding. Trusted X11
forwardings are not subjected to the X11 SECU‐
RITY extension controls.
So, simply connect to the remote server and rn your application (using xclock
as an example`):
user@local$ ssh -Y user@remote
user@remote$ xclock
That should cause a clock to appear on your local computer screen.
Now, the rest of your problems are probably due to your using your phone as a modem. The IP you get from whatismyip.com is the IP of your telephone, not of your computer. Your telephone is not configured to allow ssh
access so you can't connect to it.
Now, I've never connected through a phone but if I understand your ifconfig
output correctly, your phone's IP is 10.224.108.37
and your computer's local IP is 10.6.6.6
. This means that in order to connect to your computer you would have to somehow configure your phone to forward incoming connections on the ssh port (usually 22) to your IP. I have no idea if this is possible, have a look at your phone's manual.
An alternative would be to set up an ssh
tunnel that goes through your phone. This will only be possible if you have ssh
access to the phone though and that does not seem to be the case.
Anyway, the basic message here is that you almost certainly don't need to connect back to your computer, this looks like a classic XY problem. So, put down the chocolate covered banana... :)
Best Answer
You can actually do this using tramp:
Add these lines to your
~/.emacs
file (source):You should then be able to open the remote file like this:
Specifically for use with the
psql
command you would need something different though. Don't have a way of testing this now but perhaps setting emacs as an alias to your local emacs might work. Add this line to your remote.bashrc
file: