less than 1 minute read

1. Install and Configure OpenSSH Server

  1. Install the SSH server:
    sudo apt-get install openssh-server
    
  2. Edit the SSH server configuration file:
    sudo subl /etc/ssh/sshd_config
    
  3. Restart the SSH service to apply changes:
    sudo service ssh restart
    

2. Enable GUI Forwarding

On the Server

Modify the SSH server configuration file /etc/ssh/sshd_config:

  • Set the following options:
    X11Forwarding yes
    X11DisplayOffset 10
    X11UseLocalhost no
    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes
    
On the Client
  1. Connect to the remote host with X11 forwarding:
    ssh -X remote_host(ip)
    
  2. Test the GUI forwarding by running a graphical application like xclock:
    ssh -X user@host_ip
    xclock
    

    If the graphical clock appears, X11 forwarding is correctly configured.


3. File Transfer with SCP

Use the scp command to securely copy files or directories between local and remote systems:

  • Copy a single file:
    scp <file> <username>@<IP address or hostname>:<Destination>
    
  • Copy a directory recursively to the local system:
    scp -r username@server:(remote location) (local location)
    
  • Copy a directory recursively to the remote system:
    scp -r (local location) username@server:(remote location)
    

With these steps, you can configure an SSH server, enable GUI forwarding, and securely transfer files between systems.

Comments