Can I speed up SSH-connection with the webserver?

I have made a connection with the webserver that serves my websites using SSH port 2078, I can connect and browse and even edit with gedit but it's slow, it takes about 30 seconds to load the files and folders and the same when I want open a file or a folder.
I have been searching for solutions but there are not many that could apply to me, I have done this:

cd /etc/ssh
sudo nano ssh_config

and set GGSAPIAuthentication to no but no change, I can still connect but slow.

There's another option to set UseDNS to no either in sshd_config but that file doesn't even exist.

I have no idea what to do.

Strangely: in Windows (it's called Webdisk) it's much faster, like 10 times, 30 seconds in Linux is three in Windows and that's what's puzzling me the most: the webserver runs on Ubuntu and you might expect that Zorin and the webserver would communicate flawlessly. Also because Windows can connect with good speed I suspect this has nothing to do with settings on the webserver otherwise Windows can not be that fast either (I think).

I am fully willing to ask the Webhost, but I don't think that's where the problem lies.

Anybody has any ideas how to do this?

One more thing: I can only edit online using gedit, no other apllication seems to be allowed, I use two IDE's to build the sites now: Geany and Netbeans, both can not edit online, this puzzles me too. Is there a way to give permissions to these applications just like gedit seems to have?

Btw: the firewall is not running (yet)

UPDATE: (about 3 hours after posting), I now can open the files with an IDE if I go from the IDE itself to the webserver using "open file" and choosing the SSH-link to the server. But this is even slower than gedit.

It's strange that this file doesn't exist but you must have something similar where you can edit your configuration. But either way you can still create this file manually, and restart the service for changes to take effect.

Okay, I made the file using nano and set UseDNS to no, restarted and tried, no change.
Tried all 4 possible combinations, UseDNS yes with GGSAPIAuthentication no seems to be the fastest but still almost 30 seconds to load the files and entering public_html is even worse, longest I waited was two minutes, then I broke off.

So quickly back to Windows, see how it goes there and full first directory-load in 3 seconds, public_html in 2 seconds.

I added a screenshot from the terminal in geany (yes awesome: it comes with a built-in terminal) and it shows the full path to the index.php file on the webserver, as I can see it this is a normal ssh-connection.

Beats me...

Have you seen this?

1 Like

Is it slow only when using an IDE or graphical text editor? How about connecting directly from the terminal, does that work normally?

And on that note, I would suggest not editing production files directly. Instead, use some form of version control and use that to make as many changes as you want, commit them, and deploy your files from version control.
Consider using something like scp to upload the files from your development machine, at the very least.

Yes, I tried from the terminal but Linux-noob as I am I can't find the right command or path, it just doesn't come up with anything or can't find the url, so if you can tell me please how to do that then I would be much obliged and try ofcourse.

You know: I love editing online, it's thrilling and I don't depend on any matter on my websites for income or whatever, I am retired and it's just a hobby. But I have an online testenvironment that's an exact copy of the production-environment in which I do all the complicated stuff first to be sure that I don't break the production-site. But just for adding text or quickly blocking a bad-bot I edit the files directly online in production and if it brakes I click undo in the editor and save and then all is back to normal :wink:

So I would love to hear how to type in the url and command to get the login-console popping up from the server...

Thanks in advance!

The reason I mentioned editing offline was not only to avoid any potential mistakes editing live files, but also because you can write your code in your own machine and later upload it. It would completely avoid this slow connectivity problem (assuming it's caused by some of the IDE's you are using).

For uploading files you can use FileZilla (available for Linux and Windows), which is a graphical interface for the SFTP protocol and it would pretty much look and feel like a drag-n-drop interface from your machine to your server. It's simple, fast and reliable.

Coming back to that terminal test you can search for "Terminal" in the application menu and type:

ssh <username>@<your_server_ip_address> \
 -p 2078 \
 -i <path_to_private_key>
  • If your local username matches the username on your remote server you can omit the username@ part.
  • The -p option is to specify the connection port since you are using a non-standard one.
  • The -i is the identity file or private key which is typically located in your user's home directory, under the hidden directory .ssh. If you are not using this already, I highly encourage you do so.
Tip: use a configuration file

You may also be interested in creating a configuration file to avoid having to type this all the time. Inside /home/username/.ssh/config:

Host <name_of_server>
Hostname <domain_name_or_ip_address>
User <username_of_server>
Identityfile /home/<username>/.ssh/<name_of_private_key>
ServerAliveInterval 60
ServerAliveCountMax 120

This way, you can simply type it much easier your terminal. For example, let's assume you named your server "watermelon" (you can choose whatever name you want).

ssh watermelon

And it will connect using those parameters. If you happen to have multiple servers, leave an empty line and repeat the configuration entries as appropriate.

If this works well, you should now have a terminal window connected to your server. You can edit files with cd (change directory) and to list the current files use ls to list which files and folders you can access and change into. It looks like your web server is, or at least most likely is, inside /var/www/html/public_html so to edit your index.php file you can type:

nano /var/www/html/public_html/index.php

Of course, the experience will not be nearly the same as an actual IDE but we're only interested in seeing any delays for now.

PS: I sometimes also jump in real quick to make changes on the fly "cowboy style" :cowboy_hat_face: (but only when I know it's safe).

To react to the other things too: I know filezilla yes, I used CoreFTP but never managed to get SFTP to work so if I needed to bulk-upload I used the filemanager in Cpanel which is extremely fast, for smaller uploads I just SSH'd
But yes: I need to install a good SFTP-client, just wasn't that far yet, I want all these basic things running smooth first, like SSH with an IDE and a bit faster than up till now... I agree that it might be the app I use, but the filemanager, gedit and two IDE's all show the same behaviour.

And I am going to dive into the configuration file too yes

As what the terminal is concerned: I connect to the server and the right port, that part goes well, but it can't find the keyfile, I used slashes and backslashes and I believe that it typically should be something like /home/username/.ssh/id_rsa (or is it

The server responds in 2 seconds with: No such file or directory.
kex_exchange_identification: read: Connection reset by peer

I must be very close, but... sorry, I am not very used to Linux although I learn fast

Well, if there are already a few programs showing this behavior it may actually be something else entirely. Unfortunately I don't have any experience using any of these programs to fetch data remotely through SSH, so I can't really tell if this is the case. But it may be worth to completely rule it out.

Are you using a key file for this server? Unless you renamed it to something else it would be indeed id_rsa (the is the public file you would've uploaded to the server). If you are not using one and can connect without it, then that's fine for now. Sometimes, hosts have that private key which you can access through your profile.

1 Like

I normally don't use the key for the connection and that works fine, I only use the keys to establish a secure up and running database-connection from within PHP so that all queries are encrypted.
I will just ask the webhost for assistance as I am só close and I am sure it can be up and running fast, maybe he has good tips or check the configuration to see if anything over there might need some adjustments.

But I just managed to get a lightning fast connection over https with port 2078 and succesfully logged in using Brave-browser (I could use Konqueror for SFTP-ing too, I believes it supports that ánd it's a nice browser and filemanager too). I will also try how Dolphin reacts.
Btw: According to Konqueror SSH isn't the right protocol, I guess it doesn´t support it.

UPDATE: Konqueror says autorization required and Dolphin says that it can't browse websites, so surprisingly Brave Browser is the only one that manages to produce a login-form and connect in a second...

But only thing is: I cannot edit online with these browsers, only download files, if I can get some IDE to work over https would that be just a s safe as SSH?

My first instinct would be to say "no". The encryption itself is not the issue, but the ability to provide unique keys that you control. But, I've never used Konqueror nor any browser in this way so I don't really know for sure. However, for contrast, you can use a remote development server through VSCode which as per the documentation uses SSH.

Have you tried this IDE? If I had to do remote development this is who I would personally do it. Here's a guide that talks about how to set it up, and inside it one of the links also explains to setup SSH as well:

There's also a free and open source version called VSCodium, identical except without telemetry.

1 Like

Thank you very much for this information, I must confess that I am not a VS-code fan and I never use it although I had it installed, but this sounds good and I will certainly dive into it, many things to play with for now, will keep me busy all day tomorrow and I will try other safe methods too, if I have to investigate I might just do it completely.

And the VS-code tip might also be useful for other IDE's I guess, lots of them have all kinds of plugins available and I haven't explored all their settings yet either.

Thank you: I have a lot to work with now and I will most certainly come back here on this issue with all my findings, maybe someone else will benefit from it too in the future...

1 Like

Sorry, I missed this reply, will most certainly dive into this too, thanks!!

Please do report back, I'd very much like to know more about this very topic myself. At one point I thought of setting up a remote development environment using VSCodium as well, so that I could benefit from writing remote even on a low-end device. I might give it a try as well but I also have my hands too full with other things to look into...

1 Like

You already have helped me a lot up till now and I will surely come back with my findings, might cost some days.

So relax, do your stuff and hopefully some day soon you can benefit from my struggles. You know: now that I am switching from W... to Linux I want it to be permanent and awesome and thus use all the best things there are available, I have made enough concessions thanks to the other OS which name starts with a W and ends with an s lol

I am actually having fun here in Linux! Who would have thought this so soon already, I feel at home in Zorin and we are already big friends, I only go to windows to drive around in my tank a bit (m1 Tank Platoon II) but I am already working on getting that running in Linux using Wine and DXWND and Need for Speed will be second in line.

Have a nice evening (or day or whatever time it is on your side)!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.