I'm using Ubuntu machine remotely over vnc (vino). Sometimes x server stop responding anymore (screen is not updating), so only manual restart ("sudo service lightdm restart" over tty when I do have a physical access to that machine) works. Is there any way to restart x server when I do not have a physical access to that machine (remotely)?

EDIT: Thank you for all your help. I would give you an upvote if I could.

  • Is it really X that stops responding or is it the vnc viewer that stops to display the distant X server ? Is restarting vino doing any good ? May be looking for a way to fix that lock-up would be an option ? – solsTiCe Nov 29 '14 at 14:36
  • I'm sure that was X problem because I meet this problem many times before (when I used that machine directly). In case reconnection to the vino server returns back to freezed screen. – user1724911 Nov 30 '14 at 20:38

Sure just install a ssh server. You should also probably route the vnc over the ssh but i am not gonna focus on that.

The ssh server does basically what the vnc does but for tty (not for the gui). It is capable of many things but is mostly use as a way to display a terminal window to a remote computer so you can use commands from the remote computer.

You can install it by using sudo apt-get install openssh-server and the server/service should start automatically after the installation (and at startup)

The server listens to port 22 and to login you only have to use your username and password as you would in a tty.

to test the server from any linux installation just open a terminal and type:

ssh 'your username'@'your ip'

and then type your password. If the ssh client is not installed you can install it by

sudo apt-get install openssh-client if you want to connect to your pc from a windows installation you can use the program putty (free, google it :P)

  • Thanks for SSH tip. I'm already using SSH as tunnel of machine #1 (SSH server) to connect to the vino server (machine on which I am working on). So, I guess I should to install ssh server on that machine too to be able to restart X server when this problem happen again. – user1724911 Nov 30 '14 at 20:56
  • well normally you just install the ssh server to the machine you want to vnc to and you create a tunnel so 1. you dont have to use a million different ports 2. secure connection (and a cheap one too) – Νίκος Φυτίλης Dec 1 '14 at 5:15

Use SSH. If you can access the machine over vnc I guess you could login over SSH too.

If you never did this befor here is, how to:

First check if openssh-server daemon is running:
ps -A | grep sshd

You should see sshd listed.
If not, continue here: install openssh-server

If your system has the default ssh configuration for ububntu, you should be abled to login from a remote machine with
ssh username@server-ip -> authenticate

Then you can do sudo service lightdm restart remotley

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.