Monday, April 6, 2020

Udaljeni pristup Linux serveru u punoj desktop grafici X11 sa Windows 10 i mac kompjutera

Use X forwarding on a personal computer to securely run graphical applications installed on IU's research supercomputers

On this page:

Overview

The X Window System (also known as X11, or just X) is a software package and network protocol that lets you interact locally, using your personal computer's display, mouse, and keyboard, with the graphical user interface (GUI) of an application running on a remote networked computer.
You can use X forwarding in an SSH session on your personal computer to securely run graphical applications (X clients) installed on the Indiana University research supercomputers.

Requirements

For X forwarding in SSH to work, your personal computer must be running an X server program. The X server program manages the interaction between the remote application (the X client) and your computer's hardware.
Most Linux distributions have the X server installed, but if your personal computer is running Windows or macOS, you will most likely need to install and run an X server application, for example:
  • For Windows, download and install Xming. For X forwarding to work, you'll need to start Xming before connecting to the remote system with your SSH client (for example, PuTTY).
  • For macOS, download and install XQuartz. For X forwarding to work, you'll need to start XQuartz before making an SSH connection to the remote system. Once XQuartz launches, you can use X forwarding with SSH from the Terminal or from the xterm application in XQuartz.
Additionally, your personal computer's SSH terminal application must have X11 forwarding enabled:
  • In Linux, the SSH terminal supports X forwarding by default.
  • In macOS, you may need to edit your sshd_config file (typically found at /etc/sshd_config or /etc/ssh/sshd_config) if you have trouble using X forwarding. If sshd_config includes #X11Forwarding no (or just X11Forwarding no), uncomment out the line (remove the leading #), and change it to X11Forwarding yes.
  • In PuTTY for Windows, you can enable X forwarding in new or saved SSH sessions by selecting Enable X11 forwarding in the "PuTTY Configuration" window (Connection > SSH > X11).
Also, the remote computer's SSH application must be configured to accept X server connections. The IU research supercomputers all have SSH configured to allow X forwarding (trusted mode only).

Use SSH with X forwarding

Linux or macOS

To use SSH with X forwarding on your Linux or macOS personal computer to run an X client application installed on an IU research supercomputer:
  1. Open your SSH terminal client.
  2. On the command line, enter (replacing username with your IU username):
    • For Big Red 3:
      ssh -Y username@bigred3.uits.iu.edu
      
    • For Carbonate:
        ssh -Y username@carbonate.uits.iu.edu
    • For Karst:
        ssh -Y username@karst.uits.iu.edu
    Note:
    The -Y option turns on trusted X forwarding. You should use it only when connecting to secure systems, such as the IU research computers.
  3. Log in with your IU passphrase.
To test if X forwarding is working, try running xclock; on the command line, enter:
  xclock
If X forwarding is working, the xclock graphical clock will appear on your personal computer's desktop.

PuTTY for Windows

To use SSH with X forwarding in PuTTY for Windows:
  1. Launch your X server application (for example, Xming).
  2. Make sure your connection settings for the remote system have Enable X11 forwarding selected; in the "PuTTY Configuration" window, see Connection  > SSH > X11.
  3. Open an SSH session to the desired remote system:
    SystemHostname
    Big Red 3bigred3.uits.iu.edu
    Carbonatecarbonate.uits.iu.edu
    Karstkarst.uits.iu.edu
  4. Log in normally with your IU username and passphrase.
To test if X forwarding is working, try running xclock; on the command line, enter:
  xclock
If X forwarding is working, the xclock graphical clock will appear on your personal computer's desktop.

Use X forwarding for interactive sessions

On Carbonate or Karst

On Carbonate or Karst, if your interactive session requires:
  • Less than 20 minutes of processor time: Connect via SSH with X forwarding enabled, and then launch the X client from the command line.
  • More than 20 minutes of processor time: Submit a request for an interactive job via the batch system.
    To do so, connect via SSH with X forwarding enabled, and then:
    1. Use the TORQUE qsub command to submit an interactive job request. Add the -I (for interactive) and -X (for X forwarding) flags; for example (on Karst):
        [username@h2 ~]$ qsub -I -X -q interactive -l nodes=1:ppn=1,walltime=1:00:00
        qsub: waiting for job 371037.m2 to start
        qsub: job 371037.m2 ready
        . . . . 
        [username@c5 ~]$ 
    2. If the X client is not already added to your user environment, load the appropriate module; for example:
        [username@c5 ~]$ module load matlab
    3. From the command prompt, launch the X client; for example:
        [username@c5 ~]$ matlab

On Big Red 3

On Big Red 3, submit a request for an interactive job with X11 forwarding in the debug or general partition, and then launch your X application from a compute node:
  1. SSH to Big Red 3 with X forwarding enabled.
  2. On the command line, use the Slurm srun command with the --x11 flag to request an X11-enabled interactive session in the debug or general partition; for example:
    srun -p general --x11 --pty bash
    
    For more about using the Slurm srun command, see Use Slurm to submit and manage jobs on high-performance computing systems.
  3. Once you are placed on a compute node, you can launch graphical X applications (for example, xterm), as well as your own binaries, from the command line. Depending on the application and your ~/.modules file, you may need to load the module for the desired X client before launching the application.

Get help

Support for IU research supercomputers, software, and services is provided by the Research Technologies  division of UITS. To ask a question or get help, contact UITS Research Technologies .
For more about using Modules to configure your user environment, see Use Modules to manage your software environment on IU's research supercomputers.

ORIGINAL:

No comments:

Post a Comment

Коментар: