PDA

View Full Version : SSH connection refused | Kali linux | raspberrypi0w otg



Maskiert
2019-09-15, 20:09
Recently I've purchased a raspberry pi zero w. I heard that you can set them up to be ssh'ed into just by setting up some config files and plugging in to a usb. However this didn't appear to be as easy as I thought. I ended up running into several problems that were heading banging to troubleshoot. Anyway long story short I now have a rpi0w setup with a installation of kali linux(rpi0w version). When I plug the pi into my laptop. A new connection appears "RNDIS ethernet" saying its and unidentified connection (good all is well). The problem arises when I try to ssh into the pi though putty. I use
ipconfig on cmd terminal to get the ip. I use
ping (address) to see if I'm getting replies and this works. But when I go putty and put in the same ip I get a error "Connection error:Connection error: Connection refused". When I go into the pi via monitor and keyboard I use
systemctl status ssh and it says that ssh is correctly running. I'm not really sure what I'm missing here. If anybody has gone through this process before or has any clue what I should try please reply:p

Maskiert
2019-09-17, 02:15
I went and got some pictures for whoever wants them. Also I went a bit farther and got telnet for cmd. Typed up a command and found that port 22 failed to connect(interesting)

3598

Mister_X
2019-09-22, 16:03
I wasn't aware it had a USB to ethernet.

So, what IP does your computer have and what IP does the PI have?

Maskiert
2019-09-22, 19:53
You can see the autoconfigured ip for the raspberry on the image above. I got this IP by inputting ipconfig into the windows command prompt. The pi I've setup to put a static ip on usb0. Not exactly sure if thats working out correctly or not. But since windows is getting a ping back from the pi I'm guessing its a good connection.

Address information:
PI-Clientside:
Windows:Unknown("Like I said no simple way to get it")
Pi:lo=inet 127.0.0.1
wlan0=inet 192.168.1.128 (I have an adapter connected through usb hub which connects also to keyboard
ubs0=inet 192.168.1.129 (Clearly you can see that I've set both wlan0 and usb0 as static ip's)
Windows-Hostside:
Pi:169.254.28.139

Another thing I should mention is that on the pi, I've setup a crontab @reboot event to run this command "sudo ifconfig usb0 up" this event runs about 40-60 seconds after reboot.

Mister_X
2019-09-23, 15:34
There is no image.

Just FYI, ipconfig is a windows tool, and on linux, it's ifconfig.

On Windows, the IP is 169.x.x.x and I doubt it has any route to 192.168.1.x, so there is your problem. Configure a 192.168.1.x IP address on the windows interface and that will work

Maskiert
2019-09-23, 22:54
Okay I ran this command before plugging the pi into my computer and well....

https://drive.google.com/file/d/1Y2YuOnriuHKO3SPQ6cZJTkuLBMTeNcoD/view?usp=sharing

**** so theirs no IP. What should I do?

Mister_X
2019-09-26, 23:24
Google asks to login. Post it in the forum.

Set IPs on each side within the same range, that should solve it.

Maskiert
2019-09-28, 22:48
How should I go about doing that?

Edit:Sorry for being a retard about this. I finally got it working

On the client side I setup usb0 in /etc/network/interface as
ipv4 = 10.1.1.125
subnet = 250.0.0.0
gateway = 10.1.1.1

On the host I setup static ip with static stuff(etc)

But turns out I didn't need to. My problem was I was expecting connection from the autoconfiguration but I should have been trying to connect to 10.1.1.125
Thanks for helping me figure that out

Right now the pi and the ssh are working correctly :D