X11 Forwarding and Clipboard Configuration

Guide to Install, Configure, and Use X11 with Clipboard Support

Install and Configure X11 Forwarding

Steps to install X11 server, enable X11 forwarding on SSH, and configure clipboard management.

  • 1

    Install X Server

    Ensure you have an X Server installed and running on your system. For Linux, it is generally pre-installed. For Windows, install an X Server like Xming or VcXsrv. For macOS, XQuartz is recommended.
  • 2

    Enable X11 Forwarding on SSH

    Edit the SSH configuration file to enable X11 Forwarding:

    sudo nano /etc/ssh/sshd_config

    Add or modify the following lines:

    X11Forwarding yes
    X11DisplayOffset 10
    X11UseLocalhost yes
    			

    Restart the SSH service to apply changes:

    sudo systemctl restart sshd
  • 3

    Install Required Packages

    Update your package list and install required packages for Linux:

    sudo apt update && sudo apt install x11-apps xclip xsel

    For macOS, install the required tools using Homebrew:

    brew install xsel
  • 4

    Clipboard Management

    To paste clipboard content into a file, use:

    xsel --clipboard --output > file

    To copy the output of a command to your local clipboard:

    ip a | xsel --clipboard --input