Headless SSH on Raspberry Pi3B: connection refused - windows

Thanks for taking the time and helping me out.
The Aim:
Heedlessly ssh into a Raspberry Pi 3B on my Win7 platform(s).
The problem:
I have two Raspberry Pi 2 B's that I have set up in the past with no issues incl headless setup. I have a new Raspberry Pi 3B and cannot ssh into it at all. I have followed the exact same steps I have for my Pi 2B's with exception to the image.
What I have done so far:
Download the latest Raspbian Jessie Image and format the Sd card using Win32DiskImager.
Power up the Raspberry
Ping the raspberry successfully using the Pi's IP address.
Open Putty and enter the IP on port 22 (not that the port should matter)
At this point when I try click "Open" after having entered the Pi's IP address I get the following error: "Connection Refused"
I then used a Screen and keyboard to boot the Pi 3B. Once booted I opened terminal and entered "sudo raspi-config", where I then enabled SSH manually.
I unplugged everything from the Pi3, plugged the LAN cable back into my laptop and Pi3 and powered up the Pi3B.
I could still ping the Pi
Using Putty and the Pi3B's IP address I then clicked "open" and the following error came up: "Network Error: Software cause connection abort"
EDIT:
I have now also added a router to the setup, checked up what the ip of the pi is through the router and tried connecting with putty onto the pi, but I still get "Network Error: Connection Refused"
I am running out of ideas, any help would be appreciated.
Thank you
Misha

After comically large amounts of googling and hassle I found a solution here: https://www.raspberrypi.org/blog/a-security-update-for-raspbian-pixel/
With the RPi3B and 11-01-2017 Raspbian Jessie combo (I dont know with which one the issue lies) one has to add a blank file named "ssh" into the boot directory of the SD card. This can be done on your Windows platform. Ensure that the file has no file extensions, because if it has any file extensions it wont work. Good practice anyway to have your file extensions showing in any case.
Hope this helps anyone else.

I have followed the exact same steps I have for my Pi 2B's...
What you didn't do is read the release notes of all the raspbian versions between your old and new image before following those steps. In one of them it says that you have to put a file (can be empty) with name ssh in the boot partition. Upon first boot ssh will be enabled and the file removed.
(Don't do what I did. I put the file 'ssh' in the boot directory of the main partition, but that turned out to be the mount point for the (small) boot partition, hiding the file 'ssh' at mount and rendering the whole exercise without effect. It took me some time before I found my mistake. You have to put the file in the small boot partition itself.)

here is what you do
go to Network & Sharing center & click on the Ethernet connection to Raspberry Pi then IPv4 & set everything to automatically(obtaining IP & DNS server)
then go to details of the Ethernet & check the autoconfiguration IPv4 & note that down.
remove sd card from Ra-Pi and mount to laptop, go to the the boot folder & open the cmdline.txt file, & add after root wait "ip=(autoconfiguration IPv4 + 1 on the last digit)" & save.
this worked for me

Related

Connecting to localhost on mac with an ipad

I would like to connect an ipad to localhost:5000 on my macbook. The purpose is that I would like to test how my website looks on the ipad. I followed the steps I found on numerous websites, meaning
I got the name (or ip address) of the macbook with
ipconfig getifaddr $(route -n get default|awk '/interface/ { print $2 }')
which gave 192.268.42.20. So this is the internal ip address within the network created by my rooter. My ipad is also within that network.
I turned off the firewall on the mac. I did not think that is necessary, but I did it anyway.
I went to System Preferences -> Sharing -> enabled Remote Management (here one can find the computer name, but it doesn't make a difference whether I use the ip address or the computer name)
Now I should be able to connect to the localhost on the mac with
http://192.168.42.20:5000
but this does not work. I get the message
This web page is not available
I use a Mac book running High Sierra, 10.13.6. Any idea what I might do wrong?
EDIT: Still no luck with this, but I got something working with
ngrok http 5000
see https://ngrok.com/docs. This works for what I need...
As long as the devices are on the same network, that should work. If they are not, you would have to enable port forwarding.
Try restarting both devices, then rechecking the IP address.
Make sure the server is running with no errors.
Also verify that you can access the page from the MacBook itself.
Aside from that, I don't know why it would not be working.

Can't SSH into EC2 from my mac but can from other devices

I am trying to connect into an EC2 instance (i am using a mac) which has a Security Group allowing all inbound traffic over ssh (port 22) but i'm unable to access. I'm having a little delay before getting an Operation timed out.
I already tried it over other devices such a raspberry pi and another macbook and the connection was successful.
I got access to the raspberry pi over ssh and tried the connection to my EC2 from the terminal; thought my ssh client or the port status could be the issue but after doing this i'm not really sure if this is the case.
This is the message i get when trying to connect:
ssh: connect to host x.x.x.x port 22: Operation timed out
One thing I noticed is that I used a different .pem file which is supposed to not work for that instance and the error was the same, it looks like my Mac cannot reach it.
Things already verified:
Security Group allowing traffic over port 22.
Instance rebooted/recreated.
DNS and Public IP address changed after instance reboot.
SSH connection successful over other devices.
SSH connection to other devices from this mac successful.
Firewall turned off.
DNS flushed.
Ping performed with success.
Any help is really appreciated it.
-- UPDATE --
This issue rose in my work machine. Got a different laptop due to other issues and problem fixed, looks like it might have been something related to ports or some sort of configuration. Thought it was a problem with AWS but now it's working fine. Sadly I couldn't debug enough to know what the exact issue was. Thanks to everyone who helped out!
It seems that you can remote by other devices and this issue is only still happening on your MAC. Try this on your MAC and try to remote again:
Flush your DNS
I don't know which Mac OS you are using so I put the link here: (https://help.dreamhost.com/hc/en-us/articles/214981288-Flushing-your-DNS-cache-in-Mac-OS-X-and-Linux)
If still cannot, you can try to open some protocol ports on that instances like:
ICMP, Echo Reply, ...
then try to reach by that protocol commands:
Ping, telnet, ...
If the result is cannot too, so it must be that your MAC cannot even reach to that instance network, then try to ensure that your MAC can reach the instance's network first.

Synology NAS Default IP Address

My work recently purchased a Synology DS3617xs NAS. How do I find the default IP of the NAS so I can do the initial setup?
For security, we're running on a closed system - no internet
Running RHEL 7.4, so the Synology Assistant won't work (Win /Mac /Debian only)
We have two switches but no routers, so no DHCP
From the documentation it seems you need either an internet connection or DHCP for automatic IP assignment (where you can then find the IP from your router).
Any help is greatly appreciated.
I figured out a work-around.
I connected the NAS directly to my workstation using another LAN port I have installed on my workstation. I set the IPv4 connection for this port as Link-Local Only. When the LAN port identified its IP address, I used nmap to search the network to find other IP addresses. Since the only other item on this connection was the Synology, I was able to figure out the IP.
As you dont have DCHP option, please check the subnet and IP Range of the Switches. Then set the IP for the synology diskstation manually (search with the App Synology Assistant Windows download Link). Run synology assist from your computer makes sure the NAS is up and running all lights on and the blue light solid. LAN and disk lights should be flashing. It does take a few minutes for the unit to become available the first time. if you see the IP you can just type in the IP and get to you NAS as well without the synology assistant. You will need just the DSM file for your version/ unit. usually xxx.PAT. its that easy . Maybe the extra switch is the problem.
Pat file of your Diskstation: Link
As others said, it will spend time looking for a DHCP server to allocate an IP, and if it can't it'll eventually(*) default back to a self assigned IP in the 169.254.x.x range.
It takes quite a while to time out, so if you want to set it up without a DHCP server, you need to power it up and wait for 10+ minutes till it times out looking for DHCP responses.
IF you want to set it up without DHCP, you'll want to ensure your computers IP is setup to be able to talk to this range. (eg set your netmask to 0.0.0.0 so all traffic is sent directly, instead of any configured gateway)

Accessing Ras Pi 3 phpmyadmin on windows machine

I've got an Arduino hooked up to a Raspberry Pi 3 via USB and feeding some analog data to a database I created.
I've set up a database on my Raspberry Pi 3 (have everything set up phpMyAdmin and MySQL). I'm feeding data into it and it works. I want to access the database through my Windows machine, though. I have Apache, phpMyAdmin, and MySQL all installed.
I'm pretty sure I've edited/copied all files correctly and I can get to localhost/phpmyadmin on my windows machine.
I'm just not sure what I need to do to get to my Pi's database from there. Working with Wifi currently. I don't necessarily have access to a router since I'm working of my apartment building's wifi. I have VPN installed on Pi but haven't really configured it yet if that's the route I need to take.
Any help appreciated
Since the database exists on your Raspberry Pi, you don't need to have MySQL installed on your Windows machine. You generally only need one MySQL server which can be accessed by many clients. In this case, since you want to use phpMyAdmin to access the data, you have the option of installing phpMyAdmin on your Windows machine or the Raspberry Pi. I highly recommend putting it on the Pi, because it simplifies the connection process to have it on the same machine that MySQL is using.
You'll need some supporting software to get phpMyAdmin running; a web server and the PHP interpreter. These are all easily available on the Raspberry Pi (depending on your operating system, of course; I use Raspbian and there are packages distributed for each). Then you'd use the web browser on your Windows machine to access the web server on the Pi (likely through the IP address; you'll have to query your Pi to figure out what the address is, perhaps with ip addr at the command prompt).
You can certainly use phpMyAdmin installed on your Windows machine instead, but then need to ensure that the MySQL daemon is listening for network connections and that you have a user permitted to connect from an external network connection (I'm seeing that many packages are restricting both of these, as a security precaution, in their distributions now). It's easy to enable yourself, but easier to just connect from a local PHP instance.
Unless your machines are on two different networks or you wish to connect to your home network from an outside connection on the Internet, you shouldn't need the VPN for this project. Your wifi is likely supplied by a router that's giving you a local address and will allow you to connect to other machines on your local network segment, so once you find the IP address you should be able to connect directly.

How to access vhosts via IPad?

I'm using XAMPP, on Mavericks, to simulate a localhost. I set jobeet.local, for example, as my vhosts. I tried to access it on my computer, it worked as well.
Now, I want to test my website on an IPad. So, I did the following steps:
Run XAMPP server on port 80, as usual
Connect the IPad to my wifi network.
Setup Http Proxy on Ipad, as picture showed below but change the port to 80
Now, I tested to access 127.0.0.1 via IPad. It worked! However, jobeet.local doesn't work.
I have searched and tried many ways to achieve this issue but they don't work.
Could you help me figure it out?
Thanks in advance.
You might have to update the hosts file.
The hosts file is a text file that maps hostnames to IP addresses.
Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers.
The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Editing the hosts file
Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.
Step 1 – Open the Terminal.app
Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
Step 2 – Open the hosts file
Open the hosts by typing on the Terminal that you have just opened:
$ sudo nano /private/etc/hosts
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).
Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
You can navigate the file using the arrow keys.
Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
$ dscacheutil -flushcache
You can now test your new mapping on the browser!
Hope this works for you!
I had to reinstall my setup today and made a step by step at that occasion:
I use a combination of Squidman and Mamp Pro (I assume it's similar to XAMPP)—hope this help anyone in their quest; happy to read feedback or get advice to make this better...
Squidman http://squidman.net/squidman/index.html
Mamp Pro http://www.mamp.info/en/mamp-pro/
on Squidman
- Preferences > General > Http port:
something different from the one MAMP is using (if map uses 80, then put 8080)
Preferences > Clients > Provide proxy service for:
insert the IP address or the subnet we will be catering for
Start Squidman
on MAMP:
setup the hostname, as well as the the website attached
insert the (local) IP address of the local machine
insert the port of Apache on the local machine
start Mamp; check that website is running correctly on local machine
on iPad/iPhone/mobile device
select the same wireless network as the laptop
in Wifi network > Preferences/Information: set a Manual HTTP Proxy
server IP is the (local) IP address of the Apache server, also running Squidman; port is the port used for Squidman
(Extra)
stuff to test: move dev server onto virtual machine (VirtualBox), to use with Node, custom PHP build, etc.
automate the setting: write pref for Squidman, Mamp/hostname, restart the Apache server, send configuration of proxy to mobile via iMessage or email.
I recommend using http://xip.io/. For example (taken from the website):
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
It does the job and you don't have to set anything up. I'm only pushing it because I am overly excited that I have wasted time trying over-engineered solutions.
On a mac you can use Squid on Windows that's Fiddler, however I'm having troubles with Fiddler and iPhone at the moment...

Resources