using gedit through ssh connection - should I have gedit installed on the server?

The correct command is

ssh -p 2222 -X user@host

where I suppose the server listen on 2222 port number. Also note that the case of X option is important, it must be uppercase.

You need to have the program you want to run installed on the server (gedit in this case). Also you may install gedit without installing X, just because you can run gedit on a remote X server, as you are trying to do.


I think that the question is not about how to use the ssh console command, but some way to use gedit over ssh connections. Well there is a way.. you can mount the remote file system in a local directory through sshfs, then you can use gedit to edit those files, or whatever application running in the local machine to edit the files in the local ssh mapping.