SSH connection refused on external network with the default username - ssh

I recently tried to configure port fowarding on my raspberry pi, to be able to connect through it from anywhere. So, I changed my box parameters to permit it.
It seems to work, as my raspberry pi is responding. But I still use the pi username, and it seems to cause the rejection of the connection. When I try to connect to my raspberry pi, the following message appears:
PS C:\Users\MyUser> ssh pi#xx.xx.xx.xx
You are trying to login with the default username.
For security reasons this can only be done from a local network or console.
pi#xx.xx.xx.xx's password:
Permission denied, please try again.
Of course, I can assure you that the password I enter is correct. When I'm connected to my local network, even if I'm using the ip adress of my box (the one with the ip forawrding) to connect to my raspberry pi, it works perfectly. But if I try from another network, this message appears.
I've been trying to search on internet how to solve this problem but couldn't find anything, event by trying to modify the sshd config.
Any clues to remove this behavior and allow me to connect to my raspberry pi, from a distant network, only with a port redirection (yeah I've heard about tunnelin, pitunnel, etc but that's not what I'm looking for) and without changing the username (Yes I'm aware that chaning it will allow me to ssh succesfully but that's not what I'm looking for) ? Thanks in advance.

Related

raspbian ssh connection refused after having enabled it

I used sudo raspi-config, went into the advanced options, enabled ssh and tried with and without rebooting after this step, I am still getting Network Error: Connection refused
when trying to establish a connection via PuTTY
EDIT: It seems like the device isn't even connected to the network, even though I use DLAN to get it connected directly to the broadband router, the same DLAN I use to connect my primary desktop.
Have you checked your firewall?
I know that this is an old question, but I run into this same problem today when connecting to raspberry with Putty. In my case, the problem was that I used wlan instead of ethernet cable, and hostname -i gave the wrong Ip address.
I then run ifconfig, and realized that there was different Ip address for wlan. With that Ip address, Putty and Filezilla connected right away to my raspberry.
Hope that this will help someone.

Can not connect to VM instance via SSH

Today I found out I can not connect to my VM instance via SSH anymore.
I have checked and even re-added firewall rule to open port 22, yet I see the port is closed. I have done nothing that I can recollect that could have ended up closing that port.
I have also tried logging in via serial port, but I have no login password for that (I always let google just log me in with key).
Can anyone help me?

Start ssh in background on OpenWRT via ssh

Good morning,
I recently moved to the universities dormitory and they have a specific way how to enable the internet connection. They require me to connect to the network via Cable, set up a specific static IP and then enable the Internet connectivity by ssh'ing to a special IP with my own account and password. As long as this ssh session is open, the internet connection is active. If closed, then it is lost.
My setup right now is like this: I connected an OpenWRT-based TP-Link router (TP-Link TL-WR841N/ND v9) to the dormitory's network. My devices are connected to the router's wifi.
To get an internet connection, right now I am doing this:
connect to the router via ssh
connect to the internet via ssh on the router
So basically I am having two running ssh sessions. This is quite annoying as my laptop has to be on and running if I want to have an internet connection. My idea would be to keep the ssh session on the router running all the time. For this, however, I would need to keep the ssh session running in the background of the router.
Starting the second SSH with & skips the password entry. So I have to get it back to fg, enter the password and the process is back in the foreground. CTRL+Z appears to be not working on OpenWRT.
The only thing which could skip the password entry would be connecting with a key, but the server I am connecting to is not allowing that.
Anybody having other ideas?
You can do multiple things to solve this
Create a script(which will connect to internet) in router and schedule it in a cron job
If nohup/tmux is available in the router, execute the commands with them so that they keep alive when the ssh session is terminated.
So, looks like I solved the problem.
As nohup/tmux is not available on the router, I had to find an equivalent. Fortunately, screen is available for my router. With screen, you can start the ssh for the internet in a separate screen. When it's running, you can simply detach the screen and close the ssh to the router.
The ssh-connection for the internet will continue running in the background of the router.
The only drawback is that I have to reconnect manually, as soon as the router restarts.

SSH into linux after creating an access point with hostapd

I made a remote control vehicle with a Raspberry Pi, but i am linked to a wifi router. I decided to make the Pi itself some kind of router to connect directly to it. I downloaded and set up hostapd, set the own_ip_addr=127.0.0.1. When i ping 127.0.0.1, i get responses, but i can't ssh at that address.
Any help is welcome. If you have any idea other than hostapd, please tell me. I just want to control the Pi via wifi without a router.
127.0.0.1 is the local address, and not valid external to the Pi...
If you want to connect to the Pi externally, you must find the Pi's network IP.
You could find this by running ip addr show on the Pi, and taking note of the IP for the interface you are using.
Then just use that IP when you try SSHing.

How do I access my own website hosted in my machine?

Forgive me if this is a stupid question.
I am running XAMPP (lite) for developing my website. I can access it through http://localhost/mysite
I wanted to view it on another computer (just for testing purposes), so I went to whatismyip.com, got my ip address, and tried to access the site from another computer using http://xxx.xxx.xxx.xxx/mysite
Am I doing it right?
Anyway, I get a "Enter your username and password" prompt. I've tried the following usernames and their passwords: 1) My computer name 2) My windows login username 3) My database username
None of them worked. I already have my firewall OFF.
Any ideas?
If you are behind a router, then the credentials you are prompted for are those of the router.
You will have to setup your router to forward HTTP traffic (port 80) from outside to your PC if you want others to view the site.
Apache might only be binding to localhost. Open up a command prompt and do a netstat to see what address is being bound to on port 80. While you are at it, do an ipconfig /all to see what the IP address is of your machine. If you have a DSL/cable router, you probably have a private IP address which by default isn't accessable from the internet unless you setup port forwarding. If you want to access your computer from inside your home network, try accessing it using the IP you got above. If you want to access your computer from the outside, read the documentation for your cable / dsl modem / router to see how to setup port forwarding.