I am using the internet server of university and trying to log in to my account on system from my laptop, using ssh -X username@server. It says connection timed out. when i tried from another system i was able to log in. i use system for pretty basic work and dont know much about the internal coding and all... From some of he pages online i think the problem is firewall or something similar. I have checked the status for open ssh server which is shown as active. Kindly guide me through how to solve this problem.

  • Ubuntu 18.04. and connecting from with in university. and using the address provided by the officilas... the same address works if i am doing it through another system that has the same version of ubuntu. – jessica danish Apr 11 '19 at 17:07
  • i havent done anything to have firewall. "ufw" shows an active status, if thats related? – jessica danish Apr 11 '19 at 17:15

I believe your problem is with your ssh configuration, nothing to do with firewall for outgoing SSH session. See your /etc/ssh/ssh_config file and make sure you enable both the following:

ForwardX11 yes
ForwardX11Trusted yes

For some situation, you might have to turn off trusted mode for things to work (all depends on the SSH setup in your university.

ForwardX11Trusted no

Hope this helps.


In cases where you can't edit the configuration in /etc/ssh/ssh_config, copy the file to your home directory and modify it there.

mkdir $HOME/.ssh
cp /etc/ssh/ssh_config $HOME/.ssh/config

Modify ~/.ssh/config to enable X11 forwarding.

| improve this answer | |
  • Thank you for your help. i think that is actually the problem, "ForwardX11 no" i found this in the file you mentioned, but it is not allowing for the editing. what i mean is i cant save it after editting. can you kindly guide me about that... – jessica danish Apr 12 '19 at 12:21
  • See if you can make a copy of the configuration file to your home directory as my.config make the modification there and then launch it with ssh -X -F my.config username@server – Bernard Wei Apr 12 '19 at 18:46
  • I have updated the answer on how to have a user specific configuration. – Bernard Wei Apr 12 '19 at 19:45
  • I tried the both methods. "~/.ssh/config" says permission denied and ssh -X -F my.config username@server is still connection timed out. Thank you for your time and kind help. i think i might be doing it the wrong way. – jessica danish Apr 13 '19 at 4:01
  • Perhaps you can include -vvv when you try to make the ssh connection. Add the debug output to your question. I'm curious to see what other things causing the timeout. – Bernard Wei Apr 13 '19 at 8:15

Install ufw It will handle the firewall.

This guide will help you go through the basics of firewalls.


Run these commands on the ssh-server machine

sudo apt-get install ufw
sudo ufw allow ssh
sudo ufw enable
sudo ufw status

These will get you through.

Let me know what happened.

| improve this answer | |
  • ufw is already working. and status is also active. – jessica danish Apr 11 '19 at 17:09
  • what does the status show? when you press sudo ufw status is it something like 22/tcp ALLOW ANYWHERE – Godfather Apr 11 '19 at 17:13
  • That it is active. – jessica danish Apr 11 '19 at 17:15
  • I can understand it's active but does it say that port 22 is allowed when you ask for the status? – Godfather Apr 11 '19 at 17:16
  • yes it does. port 22 allowed anywhere. – jessica danish Apr 11 '19 at 17:17

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.