Find the answer to your Linux question:
Results 1 to 10 of 10
Hello, When I do a ssh on my machine and I try to run an application, it gives me the following error : cannot connect to x server. What can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    cec
    cec is offline
    Just Joined!
    Join Date
    Apr 2010
    Posts
    6

    cannot connect to x server


    Hello,

    When I do a ssh on my machine and I try to run an application, it gives me the following error :

    cannot connect to x server.

    What can I do?

    Thank you for your help

  2. #2
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    You are logging into this machine from another via ssh? The address of the server has to be preceded with either -Y or -X. Log into the server with:
    *Example*
    Code:
    ssh -Y bob@bobsnetwork
    Then, run the command for the app or utility you wish to run. If -Y doesn't work, try -X. If you still cannot get X forwarded you will likely have to edit /etc/ssh/sshd_config. Open sshd_config on the server with your favourite editor and look for:
    Code:
    #X11Forwarding no
    ...and change to:
    Code:
    X11Forwarding yes
    Restart sshd on the server or reboot and X forwarding should then be enabled.
    Last edited by Dapper Dan; 04-14-2010 at 01:52 PM.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  3. #3
    cec
    cec is offline
    Just Joined!
    Join Date
    Apr 2010
    Posts
    6
    I've connected with -X but I always have the same error.

    My sshd_config already had X11Forwarding to yes.

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Did you try -Y ? Are you by chance trying to run the application as root or su?
    Linux Mint + IceWM Registered: #371367 New Members: click here

  6. #5
    cec
    cec is offline
    Just Joined!
    Join Date
    Apr 2010
    Posts
    6
    I tried -Y but it does the same.

    No I am not running the application as root.

  7. #6
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Perhaps a few more dumb questions... Is the X server actually running on the server machine? Are you trying to run an application remotely or are you trying to run a desktop environment from the server to a client machine? Please give more detail about what you are attempting to do and the commands you are using to do it.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  8. #7
    cec
    cec is offline
    Just Joined!
    Join Date
    Apr 2010
    Posts
    6
    The X server isn't actually running on the server machine.

    I'm doing a ssh -X mymachine and then I'm trying to run my application remotly.

  9. #8
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Then there's your problem. You cannot forward X from a server machine to a client if X isn't running on the server.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  10. #9
    cec
    cec is offline
    Just Joined!
    Join Date
    Apr 2010
    Posts
    6
    but when I run X server on my server, it doesn't change anything. I always have my error.

  11. #10
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Is this a headless server or does it have a monitor? If a monitor, are you able to bring up xwindows from it and it works satisfactorily?
    Linux Mint + IceWM Registered: #371367 New Members: click here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •