Editing files remotely

mjia

Registered
I would like to be able to edit text files on a remote server. I am able to access my account on a remote Sun Solaris UNIX server over SSH and upload and download files, but I would like to be able to directly edit text files without having to download them and then upload them back. I would rather not have to use vi or emacs, so is it possible to edit the files with a text editor that has a GUI? I have heard that I need to "forward X11" but I have no idea how to do this (or what X11 is).
 
If your Solaris box has it installed, you may want to try using the editor "pico", which is much simpler than vi or emacs (although not as powerful). It doesn't have a gui, but it's very easy yo use. If you've ever used pine, you can probably figure out pico.

X11 is the windowin system used by most Unices. It is not native on OS X, but it is possible to install it and use it, although I'm not sure on the details. I'm sure there is more information about this in the forums here (but it isn't something I have a use for, so I haven't been paying attention).
 
Here's how I would go about using a gui editor over an ssh connection:

First, install X11, and a window manager.

Now, you gotta enable X11 tunneling over ssh. I believe the configuration is client-side, but I'm not posative. you can find informatino about this via:
man ssh
I believe the best way to do this is to:
pico /etc/ssh_config
uncoment the following lines:
Code:
# Host *   
#   ForwardX11 no
then change the 'no' to a 'yes' :)

next,
locate a binary on the solaris computer similar to osx's text edit. You may wish to just ask them where it is - solaris is kinda strange sometimes.
But its probably in the same directiry as the solaris xterm.

The next step is to allow x11 clients to connect to your mac. here's how you do that:
launch your X11 server on the mac. Open an xterm (a regular macintosh terminal will NOT work from here on - its got to be within the x server).
type:
Code:
xhost +[i]hostIamConnectingTo[/i]

if you are not worried about hackers and stuff, just type:
xhost +
to disable everything you've done, type:
xhost -hostIamConnectingTo
or xhost -
to remove all the entries.

Ok, we're almost set.
now, from an xterm (or aterm or gnoterm or kterm... :) ) ssh to the server:
ssh hostIamConnectingTo
log in, and set your DISPLAY variable:
in the bash, type:
DISPLAY=myhost:0.0
in tcsh or csh:
setenv DISPLAY myhost:0.0
(you may need to swap DISPLAY with $DISPLAY in tcsh, I'm not posative).

now, load your text editor like this:
./TextEdit -DISPLAY myhost:0.0

I might have that a little wrong, you can check on it in the manual page for almost any X11 app.

btw, this is alot easier with telnet - you don't have to edit your ssh config files.

if you are feeling crazy, there is a way to launch solaris's window manager on your mac remotely - just figure out the command on the server, and launch an x11 'failsafe' session. ssh in, etc.

hope this works, please tell if it does/doesn't, I'm interested.

EDIT:
I don't think its needed, but after you edit that ssh file in /etc, you may need to re-init or reboot.
 
One great X11 visual editor is 'nedit'.


You might want to try it as well.


I've you never heard of X11, you'd better start small and once you are comfortable with each step (which kilowatt has outlined very well) you can begin with the next.

First of all, install X11 locally and be comfortable with it, I recommend Fink to do that but it's not compulsory. Then you can move on with connecting remotely and stuff.

dani++
 
You'd be best off using emacs and
the 'ange-ftp' module.

It transparently moves remote files back
and forth.
 
noooo emacs....
....bad!



ok so its a stupid debate :)



cheers!

btw I think bb edit can do this too
 
Back
Top