[Solution] SFTP Connection closed File 22 not found

SFTP File 22 not found Connection closed
SFTP Connection closed

If you are trying to connect to SFTP address using the command line and SFTP command and you get the error "File "/22" not found." then the reason is that you have tried to provide port 22 which is the default port for SFTP instead of providing the path, you do not need to provide the port number if the server is hosted on the default 22 port.

% sftp demo@code2care.org:22   
(demo@code2care.org) Password: 
Connected to code2care.org.
File "/22" not found.
Connection closed.  

You have provided the port, instead of the directory/path location, user@host:dir-location.


If you want to provide the port you can make use of -P option followed by the port number

% sftp -P 22 user@code2care.com

(user@ Password: 

Connected to code2care.com


Read more: https://code2care.org/macos/sftp-to-different-than-22-custom-post

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.