Find the answer to your Linux question:
Results 1 to 9 of 9
Hi all, Im total noob to this forum and to linux. When I try to scp or sftp from the server at school I get connection refused on port 22, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    4

    Connection refused port 22


    Hi all, Im total noob to this forum and to linux. When I try to scp or sftp from the server at school I get connection refused on port 22, but when I tried with the ssh client in windows xp, I would get the same error with scp and sftp but when I use the built in graphical transferwindow and move folders from server to C: it works perfect, why is that ? How do I solve this so I can reboot and return to my beloved linux.

    /grimbaum

  2. #2
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Port 22 may well be blocekd. I know in any server hardening Ports 20-22 get closed straight away. I would imagine the other tool is configured to use a different port altogether. Isn't port 22 for SSH anyway? 20 and 21 should be for FTP.

  3. #3
    Just Joined!
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    4
    Port may well be assigned for ftp but when i scp or sftp it automatically choose port 22 but that perhaps has something to do with that I first ssh into the server and then in the server console window I do sftp. If these ports are closed by default on my box how do I open them for incoming traffic?

  4. #4
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Belgium
    Posts
    1,429
    You have this problem trying to access your linux from outside right? SSH uses port 22. Can you post the config of your IPtables?
    ** Registered Linux User # 393717 and proud of it ** Check out www.zenwalk.org
    ** Zenwalk 2.8 - Xfce 4.4 beta 2- 2.6.17.6 kernel = Slack on steroids! **

  5. #5
    Just Joined!
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    4
    Yes , Im trying to reach it from the outside.
    The only thing that would have anything to do with iptables on my box would be this.

    usr/src/linux-2.6.11-gentoo-r11/include/config/ip/nf/iptables.h and all this file says is

    #define CONFIG_IP_NF_IPTABLES 1

    Other things that are related to iptables would have to do with firewall software which I have not emerged.

  6. #6
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    This is a little confusing.

    So you are running sshd on your local Linux machine? And when you try to connect to your local Linux machine from an outside source the connection is refused? Yes?

    Are you behind a router or other firewall, or does your local Linux machine have an IP that is routable? How about if you ran a port scan (nmap or whatever) against your local machine? Does 22 show open?

  7. #7
    Just Joined!
    Join Date
    Jul 2005
    Posts
    28
    Well, it seems that your school firewall closes the SSH port (22) so you can't ssh to this staion.
    But this firewall left the ftp port open. Note that the graphical interfaces use the ftp client, not the SSH one.
    try to connect your server by 'ftp' applications and see whether it has problems or not.

  8. #8
    Just Joined!
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    4
    What Im doing is first of all
    *ssh to school server - works fine
    * ssh to my own computer from school server - keep getting connection refused port 22
    * scp or sftp files from schools server to my computer - keep getting connection refused port 22

    when I use graphical ftp environement tranfering files to my computer works fine, when I look in prefs for graphical software it has default settings on recieveing on port 22, but maybe it changes this automatically if port 22 is closed.

    nmap says that all 1663 total ports are closed. Which means that probably sshd is the problem and when I try to start sshd it says it "could not load host key" sshd: no hostkeys available --exiting.

    How do I get sshd running , after all it seems this would be a good start.

    /grimbaum

  9. #9
    Just Joined!
    Join Date
    Jul 2005
    Posts
    28
    well I've told you that graphical ftp environments ofcourse use the ftp port (port 20) not the ssh one.
    afterwards if you want to start a ssh server on your host you can try this command by root access:

    '/usr/bin/ssh-keygen -f /etc/ssh/ssh_host_key -N '

    --Good lock!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •