Access an xterm window open on local machine , remotely via ssh - ssh

I have an xterm window open on a computer. I want to access this xterm window remotely using ssh. Is it possible? By access I mean, I should be able to run commands on that open shell.

I'm not sure if it is possible to access an xterm window that's already been opened, while being over ssh. However, you can certainly open an ssh connection with X11 forwarding capabilities. Once X11 is forwarded, you can just run the program in ssh's command line, and it'll open in your forwarded X11 screen.
Here's a good article that explains in detail what you need to accomplish this: http://www.math.umn.edu/systems_guide/putty_xwin32.html
For example, after completing the details in the above article, and assuming you have Gnome Desktop installed, you could run gnome-terminal over ssh and have a Unix terminal open and forwarded over the ssh connection. Pretty much any application that has a GUI is runnable this way.

Related

Does replit uses ssh?

Replit's terminal provides a lot of features that are very similar to any Linux terminal. At first, I thought the site was using SSH to link a remote terminal to the website but when I ran the following command service ssh status, then the output was
* sshd is not running. This indicates that the site is not using SSH to link the terminal.
Does this mean the developers have created a custom terminal for their website or is there a way to show this output for remote users for security purposes?

Cygwin X11 forwarding using Xming

i am connected with cygwin to a ssh server
there i want to open a application via x11-forwarding
i use xming as x11 server on my windows machine
now in putty i had the possibility to automatically forward x11 and so i dont need to export my DISPLAY, thats not a problem i can set it every time i connect to the server.
but if i export my DISPLAY, it wont start the application it always says:
Error: Can't open display: xxx.xx.xx.xx
i really liked the way putty worked and want to user cygwin.
i tried Cygwin/X but there always opens another terminal which i dont really like. i like to open my application from my existing standart cygwin terminal where i also connect to the server
is there any way doing this?!
i startet the xserver with the following command and after that i could start the programms automatically on my remote ssh server and it was forwarded automatically to my xserver
startxwin -- -listen tcp &
after this i even didnt have to set the DISPLAY

How to block applications from using SSH tunnel

I am using Little Snitch to control my local applications' internet connection. But when I am at the University, I have to tunnel via ssh to a network-server in order to get an internet connection there.
The problem: If I do so, Little Snitch is not able to control my applications anymore, because then every application uses my ssh tunnel. What's the best way to handle that? Should I block ports on my ssh or is Little Snitch able to manage this?
I am using a Mac and open the ssh connection over the terminal with the following line:
ssh -D 2001 -o ServerAliveInterval=60 username#servername.com
If you use mac MacProxy and for Windows Proxifier are easiest solutions with more benefits. in addition to blocking any program from connecting to your SSH Tunnel you can also set direct access to your internet for some other programs.
Also you can specify ports and/or IPs for each program and lots more...

How to exectute a Mathematica Script through ssh

here is my problem: i would like to run a Mathematica script through ssh on a remote machine so that i can close the terminal on my computer and keep it running on the remote one.
My problem arises because the script acts in interacting mode, and so when i close the terminal the process is shut down too.
Thanks.
Use tmux or GNU screen.
Workflow:
ssh into remote machine
start tmux/screen, e.g. tmux or screen
start Mathematica script inside tmux/screen session
detach tmux/screen session, e.g. Ctrl+B d (tmux) or Ctrl+A d (screen)
close ssh connection
Then later:
ssh into remote machine
reattach to tmux/screen session, e.g. tmux attach or screen -d -R
view completed Mathematica script output
Several cases:
If you don't need to interact with it or need to visualize the notebook during evaluation
Log in to the machine with ssh
Then, to run a kernel in the background and detach it from the current session, use nohup tool (the standard output of the command will be dumped to myNotebook.out):
nohup math < myNotebook.nb > myNotebook.out &
At this point, the ssh session can be closed without killing Mathematica
Optionally you can monitor mathcommand output with the tail command (use CTRL-C to exit the tail monitoring)
tail -f myNotebook.out
If you need to see what's going on, visualize graphs during calculation or to be able to interact graphically, use remote desktop (vnc) and tunnel your communication with remote machine. Details depends a bit on the Linux distribution (vnc clients & servers may differ). You can even from Windows or Mac connect with remote desktop to your linux box and manipulate it. I suggest you to search the web for remote desktop ssh tunnel + your distro for tutorials.

call a program from local terminal while in an ssh session

Is there some way to call on a local program while using an ssh connection to a remote host? I'd like to have access to the environment on both sessions, so opening another terminal isn't ideal.
Edit: specifically the uses would center around scp or local programs that use it (i.e. the emacs extension tramp). The two things I had in mind:
to be able to type download x.png on a remote machine and have the file pulled to my computer.
something like emacs-local file.py that would open emacs on my local computer and use tramp to edit file.py.