Are you struggling with sftp error code 255?
SFTP is a secure method for file upload.
However, it often shows errors when the remote server is down/unavailable, the remote machine doesn’t have ssh access or has firewall restrictions.
At Bobcares, we often get requests from our customers to fix an error message sftp error code 255 as part of our Server Management Services.
Today, let’s get into the details on how our Support Engineers fix this error.
Why sftp error code 255?
Usually, the exit code 255 is a frequent error that happens due to the problem in SSH access.
The error appears like the following
The following reasons are the common cause of this error.
If the remote server to which we are trying to connect is unavailable or down, then the connection via sftp has not been established, and so we received this error.
In addition to this, we will get the same error if the remote server is not having the ssh access to the server or if there is any firewall restriction.
Now let’s detail the reason for this error and how our Support Engineers fix the problem.
The causes and fixes of sftp error code 255
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers facing problems with error sftp error code 255.
Now, let’s see the major reasons for this sftp related errors and how our Support Engineers fix them.
1. Missing RSA key
Recently, while connecting to the server via sftp one of our customers was getting the error sftp error code 255. Initially, his public key authentication was successful. But after a while, the connection got disconnected.
On checking, our Support Engineers found that the public key was working and could not trace anything wrong with it. However, we found that he had only created DSA keys, and RSA keys were missing.
Therefore, we created RSA keys and also inserted the public keys in his authorized keys file, then everything worked fine.
This resolved the error and the customer could regain sftp connection.
2. Firewall restrictions
Firewall restrictions can also be a reason for sftp failure. It will restrict unauthorized IP access or port access to the server for security purposes.
Sometimes, the error sftp error code 255 happens due to the sftp port restricted in the firewall. In such cases, our Support Engineers will first check for any firewall restrictions. Firewall restrictions can cause timeout errors while trying to connect to the server using sftp.
This has been caused due to some server-side settings or sftp port (default 22)blocks on the network.
So, our Support Engineers check the log files and confirm that it does not cause the sftp to exit connection.
For instance, we check the IPtables to see if there are any IP restrictions.
iptables -nL | grep xx.xx.xx.xx
If so, we will remove the IP restrictions to fix this error.
3. Permission of sftp
Sometimes, if there was no sftp server on the remote end, customers will receive the same error. Here, our Support Engineers confirm the working of the sftp server.
Another important cause to receive this error is incorrect permission of /home/user and .ssh folder on the remote server.
Here, we check the permission of the user and .ssh folder and correct it as follows.
chmod 755 /home/user chmod 700 /home/user/.ssh
Generally, the /home/user folder should be with 755 permission and the .ssh folder is with 700 permission.
By ensuring this, we can avoid unwanted errors happens while connected to the remote server via sftp.
[Struggling with sftp connection errors? We are here to help you.]
In short, sftp error code 255 error has been received mainly due to the problems in the remote server such as missing RSA keys, firewall restrictions, and so on. Today we discussed the reasons causing sftp error code 255 and saw how our Support Engineers fix this error for our customers.