X11 Forwarding and Remote Copy with SSH 

Secure Shell (SSH)

Secure Shell encrypts all traffic, and provides a high level of protection against hacker attacks. It's intended as a (more) secure alternative to the likes of telnet, ftp, rsh, rlogin and rexec - and one which requires much less effort to set up than Kerberos or IPSEC currently do. Using the tunnelling feature, every non-secure application protocol like ftp can get made secure.

More Tips to the Secure Shell SSH can be found here.

In this article, we want to present two helpful utilities

  • X11 Forwarding with SSH

  • Remote Copy using SSH and/or SCP

X11 Forwarding

Provided that your SSH server has X11 Forwarding set on and you have an X server running on your local machine, you can even display X11 through the SSH connection.

The SSH server will set your DISPLAY environment variable when connecting. It will be set to <servername>:<some_high_number>:0. The SSH server will then forward the X11 protocol to your local X server that you have specified in the settings (see More options... in the SSH Connection... option of the Settings menu). In this example we use TeraTerm to forward any X11 application.

  • Start TeraTerm, click Setup, SSH Forwarding ..., make sure "X Forwarding" is active. After this save the setup (Setup, Save Setup ...), exit TeraTerm and restart it.

  • Login to the Remote Host and check the DISPLAY variable

# echo $DISPLAY
  ux-web1.plenaxx.ch:10.0

The DISPLAY variable is managed by SSH, you don't have to set it. Now you can start the desired X11 application, it will appear on your local terminal (make sure your X11-Server is running and "xhost +" has been executed).

# xterm

Remote Copy using RSH (Remote Shell)

You know the trick with remote shell (rsh) don't you ? ... OK, here again the method to copy a remote file from remote to local using the good old remote shell.

  • Make sure that the Remote Shell Daemon is activated in /etc/inetd.conf

shell stream tcp nowait root /usr/sbin/tcpd in.rshd

  • Next, make sure your $HOME/.rhosts is setup and has the correct permissions.

paragon
rabbit

  • Copy the file using cat or tar with RSH

# rsh rabbit "cat /home/zahn/oracle.tar.gz" > oracle.tar.gz
# rsh rabbit "tar cf - /home/zahn/oracle.tar.gz" | tar xvf -

Remote Copy using SSH (Secure Shell) or SCP (Secure Copy)

The same can be done with SSH, without the hassle of $HOME/.rhosts

# ssh rabbit "cat /home/zahn/oracle.tar.gz" > oracle.tar.gz
# ssh rabbit "tar cf - /home/zahn/oracle.tar.gz" | tar xvf -
# scp rabbit:/home/zahn/oracle.tar.gz .