Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Cannot connect to my ubuntu server

  1. #1
    Join Date
    Mar 2021
    Beans
    11

    Cannot connect to my ubuntu server

    I get this error
    Code:
    ssh: connect to host 192.168.0.254 port 22: Connection refused
    when I am trying to connect to my server
    How do I fix this. The server is on a partition on my C drive. Any fixes?

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,566
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Cannot connect to my ubuntu server

    Quote Originally Posted by nitchgamingstudios View Post
    I get this error
    Code:
    ssh: connect to host 192.168.0.254 port 22: Connection refused
    when I am trying to connect to my server
    How do I fix this. The server is on a partition on my C drive. Any fixes?
    Did you install openssh-server? Is it running? Is the machine firewalled in any way? Are you sure the machine is at that address? Are you using static addressing? DHCP reservations?
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    May 2010
    Beans
    1,198

    Re: Cannot connect to my ubuntu server

    Can you SSH to localhost if you are sat at the server rather than remote? Which OS is the server side running? Which OS is the client running? Can other clients connect OK?

  4. #4
    Join Date
    Mar 2021
    Beans
    11

    Re: Cannot connect to my ubuntu server

    Yes. Open SSH is installed. Windows defender firewall has been turned off and yes, the machine is at the correct address. What do you mean by static addressing?

  5. #5
    Join Date
    Mar 2021
    Beans
    11

    Re: Cannot connect to my ubuntu server

    Let me give it a shot

    EDIT:

    I still get the same error

    Code:
    nicodemus@LAPTOP-TAFDGDO9:~$ alias server="ssh nicodemus@localhost"
    nicodemus@LAPTOP-TAFDGDO9:~$ server
    ssh: connect to host localhost port 22: Connection refused
    Last edited by nitchgamingstudios; March 8th, 2021 at 06:09 PM.

  6. #6
    Join Date
    Mar 2021
    Beans
    11

    Re: Cannot connect to my ubuntu server

    When I run ipconfig in my CMD:

    Code:
    Wireless LAN adapter Wi-Fi:
    
       Connection-specific DNS Suffix  . :
       Link-local IPv6 Address . . . . . :----------------------
       IPv4 Address. . . . . . . . . . . : 192.168.0.254
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 192.168.0.1

  7. #7
    Join Date
    Mar 2021
    Beans
    11

    Re: Cannot connect to my ubuntu server

    I can't access the sshd config file?

  8. #8
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    11,931
    Distro
    Ubuntu

    Re: Cannot connect to my ubuntu server

    When running into ssh issues, most users run it with the ssh verbose options
    like
    Code:
    ssh -vvv user@machine
    (replace user@machine with the correct names)
    This usually gives a good idea of what's what.
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  9. #9
    Join Date
    Dec 2009
    Beans
    6,510

    Re: Cannot connect to my ubuntu server

    Maybe I've just gotten too old for this but I'm very confused.

    [1] The title of this thread is "Cannot connect to my Ubuntu server"

    [2] But you aren't trying to connect to your Ubuntu server:

    When I run ipconfig in my CMD:

    Code:
    Wireless LAN adapter Wi-Fi:
    
       Connection-specific DNS Suffix  . :
       Link-local IPv6 Address . . . . . :----------------------
       IPv4 Address. . . . . . . . . . . : 192.168.0.254
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 192.168.0.1
    ipconfig is a Windows command so that address is your Windows box. And you are trying to connect to the Windows box:
    ssh: connect to host 192.168.0.254 port 22: Connection refused
    How and with what did you set up the SSH server on the Windows box?

    [3] You seem to have another problem with accessing the Ubuntu box:
    nicodemus@LAPTOP-TAFDGDO9:~$ alias server="ssh nicodemus@localhost"
    nicodemus@LAPTOP-TAFDGDO9:~$ server
    ssh: connect to host localhost port 22: Connection refused
    Which may be because you have no SSH server on the Ubuntu box or a firewall is in the way. If it's the later turn it off:
    Code:
    sudo ufw disable

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Cannot connect to my ubuntu server

    My bet is the OP installed Ubuntu into a VM, but either
    • didn't install the openssh-server package or
    • setup the VM networking (in the VM settings) for NAT, not bridged - needs to be either bridged or host-only or
    • doesn't know the correct IP for the ubuntu system or
    • forgot to start the virtual machine or
    • some mix of these


    If the OP didn't enable a firewall, then none is enabled.

    If the OP is using WSL - that changes things. It is an important detail to mention.
    Of the OP wants to connect from Linux to Windows using ssh, I think Win10 has an sshd now. No clue how to set that up.
    I know that Win10 ssh client will connect to Ubuntu ssh-servers. It works the same as normal Unix ssh clients, just with Windows paths for any files specific on the command line with ssh.

    One more thing:
    Code:
    nicodemus@LAPTOP-TAFDGDO9:~$ alias server="ssh nicodemus@localhost"
    nicodemus@LAPTOP-TAFDGDO9:~$ server
    I suppose you can setup an alias like this, but if the userid on the client and the server are the same, no need to specify it.
    Code:
    ssh localhost
    is sufficient. It doesn't harm anything to include the username, but extra typing = bad in my lazy world. Might as well add the verbose switches to get more debug information back:
    Code:
    ssh -vvvv localhost
    What is a static IP? Websearch found this: https://whatismyipaddress.com/dynamic-static I liked the images they used.

    I find it easiest to just force all devices on my home network to have static IPs if they aren't guest devices. Anything that runs a "server" - like ssh - is easier to access if the IP never changes. That's a static IP.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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