0

I am following this tutorial as in this question. However, I know in this case I do not need a cross-over cable because I got it to work with a touch screen modded version of Raspbian. My steps that worked for that OS were: add ip=169.254.0.2 at end of cmdline.txt file, plug in Ethernet cord (one end in Pi and the other one in the laptop), and run PuTTY and type hostname (or 169.254.0.2).

I wanted to do this on a non-modded, fresh version of Raspbian. So I did the same steps. I went to cmdline.txt and added the same line to the end, saved it and plugged the internet cord in. However, when I tried to use PuTTY to access it it gave me the error, Error: Permission Denied. I'm running Windows 8 on my laptop. I tried running the program with administrator privileges but that did not work either. I have been going on the assumption that SSH is enabled by default in the newest versions of Raspbians.

Could someone please explain why it might work for an OS very similar to Raspbian (just tweaked to send display over GPIO to a touchscreen), but not work on a fresh install of it?

Update 1
I re-imaged the latest version of Raspbian to eliminate any problems, and added the line to commandline.txt. When I tried to ssh into it it gave me the error, after a long wait: software aborted request. When I tried it again it always said connection timed out, or when I try to log in via the hostname: hostname "raspberrypi" not found. Any ideas. I am really in a fix here and cannot think of anything!

Update 2
To make sure that it was not a problem with antivirus software, etc I disabled all my firewalls, etc. However, it still gives me the same errors.

  • BTW: I am unable to run any commands on the pi. I can however edit any of the files on the pi. e.g. etc/network/interfaces, via Paragon Software for Windows. – NULL Jun 30 '15 at 21:34
  • Have you read/tried this: raspberrypi.stackexchange.com/questions/38/… – CAtoOH Jul 3 '15 at 14:02
  • Yes, I haven't gotten anything to work as of yet – NULL Jul 3 '15 at 18:31
  • You say that the Pi has 169.254.0.2 for IP address. What about your laptop? Which address does it get once directly connected to the Pi? – Huygens Jul 7 '15 at 21:22
4
+50

Couple of things I think may be going wrong (please correct me if I'm wrong). If you're connecting the Ethernet cord directly to your laptop and your laptop isn't setup as a DHCP server, your Pi is going to keep its invalid 169 IP address.

So, just in case, I would set the Pi as a static address in your cmdline.txt file: ip=192.168.0.2 (use ipconfig on the command line to check your default gateway).

If your default gateway is 192.168.0.1 set your pi to something close to that over the 20 range, 192.168.0.20-254. That way you can be certain it's actually getting a valid address and not likely to conflict with anything else on your network. (If you do end up disco'ing it directly from your laptop)

If you have a username on the Pi already, or have the docs for the default username (I'm pretty sure it's pi), when you connect with putty it needs to be your pi@192.168.0.20 in the putty window.

Port: 22
Connection Type: ssh

Edit
Also, are you certain that your ssh server is running on the pi? You may want to grab a copy of nmap and scan it just to see.

  • ...will try and update when I have a chance! SSH server should run on boot with the latest version of Rasbian correct? Thats what I read everywhere else. – NULL Jul 3 '15 at 18:34
  • I had mine hooked up to an HDMI before I was using it just for ssh. I can't remember if I set up the server or not. Because I did have to for several other systems, but regardless, if the pi is responding with a permission denied (I'd assume it's serving). It may be something as simple as adding the @ between pi and your ip in putty. Let me know how it goes. I've been meaning to reimage mine. I'll pull it out and go through your steps. See what's up. – Mike Padg Jul 3 '15 at 18:45
  • @NULL Yes, SSH is enabled by default on a fresh raspbian unless you disabled it via raspi-config. – dhruvvyas90 Jul 4 '15 at 7:57
  • I have been very busy lately but will try when I get a chance! – NULL Jul 6 '15 at 16:24
2

You can try this, and it's working for me currently as I type this. It's somewhat over complicated I suppose, but it works.

Set up TFTPd32 as a DHCP server. Download it, and run the executable. Go into settings, uncheck all other services except DHCP, then goto the DHCP tab and enter these settings (note this won't allow your Pi to use the internet)

IP Pool Start address: 192.168.1.100 Size of pool (use something small): 20 Def router (not very important since we're not having internet): 192.168.0.0 Mask: 255.255.255.0 DNS Servers: 192.168.0.0 WINS Server: 192.168.0.0

Save it and restart TFTPd32. Connect you Pi up and it will be assigned an IP address, then just use something like PuTTY to connect to the IP address it is assigned which will show in TFTPd32.

If it doesn't work the first time, make sure the server interfaces drop down is set to your ethernet card, or a software loopback.

Here's a screenshot of my settings.

2

I just installed Raspbian 1.4.1 via NOOBS from the Raspberry Pi downloads page.

Once initially installed I first selected option 1 in raspi-config to change the user password. Then, went into option 8 and selected A4 to enable the SSH server.

In my Mac's System Preferences under Network I saw that the Mac assigned itself the address 169.254.138.194. On the RPi, I ran the commands:

cd /boot
sudo cp cmdline.txt cmdline.txt.orig
sudo vi cmdline.txt

In there, I replaced the line:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait

with:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline ip=169.254.138.42 rootwait

The only difference is the addition of ip=169.254.138.42 right before rootwait.

With that in place I was able to SSH into the RPi from my computer using the command ssh pi@169.254.138.42.

Can you confirm that SSH is enabled? If you are able to hook a keyboard and mouse directly to the RPi, you can confirm by logging in and running the command ssh localhost. If SSH is running you will see:

pi@raspberrypi ~ $ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is fa:66:ec:f9:3a:70:e6:b5:df:ad:43:75:f9:3b:f1:d0.
Are you sure you want to continue connecting (yes/no)?

At this point you can just hit ctrl+c to cancel since this message verifies SSH is running. If SSH is not running you'll see something like this:

pi@raspberrypi ~ $ ssh localhost
socket: Address family not supported by protocol
ssh: connect to host localhost port 22: Address family not supported by protocol

You can enable SSH by running sudo raspi-config selection option 8 -> option A4 -> enable.

Can you also verify that you can ping the RPi from your desktop. You should see something like this:

[berto@g6]$ ping 169.254.138.42
PING 169.254.138.42 (169.254.138.42): 56 data bytes
64 bytes from 169.254.138.42: icmp_seq=0 ttl=64 time=0.794 ms

Finally, in the comments you mention you are unable to run any commands on the RPi; can you expand on that? Are you getting permission denied or are the commands not recognized?

Hope this helps!

  • "Finally, in the comments you mention you are unable to run any commands on the RPi; can you expand on that?" Yes...thats because I dont have a screen that will work with Raspbian only a touchscreen that I use a hacked version of the Raspbian OS on. Right now i am trying to be able to use "real" raspbian via ssh. – NULL Jul 8 '15 at 10:53
1

It should work specifying a link-local address (169.254.0.0/16) on both sides of the connection. And ideally both sides of the connection should have the correct netmask (better use 255.255.0.0).

So on the Pi, make sure you have the IP data express like this:

ip=169.254.0.2:::255.255.0.0

Here is the explanation for the ip parameter:

ip=<static-ip>:<bootp-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

With

  • <static-ip>: IP address of your Pi
  • <bootp-ip>: IP address of a bootp server (for network booting)
  • <gw-ip>: Gateway IP address (no need in your case, unless your laptop is configured as a gateway server and can provide access to another LAN)
  • <netmask>: netmask
  • <hostname>: hostname of your Pi
  • <device>: device name (e.g. eth0)
  • <autoconf>: boolean, probably defines if the IP address is autoconfigurable (default to link-local using maybe zeroconf for assignement)

Then boot your Pi. Make sure the IP+netmask on the laptop will allow to see the Pi IP address from it. Then try to ping the Pi using its IP address.

If you don't like link-local addres, you can use other IP ranges reserved for private LANs, such as any subnetwork within 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16. For example, you could pick up 192.168.68.2/24 for your Raspberry Pi (note that /24 is equivalent to a netmask of 255.255.255.0) and 192.168.68.1/24 for your laptop if it does not conflict with other LAN IP ranges in your network(s). So on the Pi side you would have:

ip=192.168.68.2:::255.255.255.0

If you have nmap installed on your laptop, you can use it to scan your network in order to identify your Pi and its IP:

sudo nmap -sP 169.254.0.0/16

Or for scanning another IP range like I suggested:

sudo nmap -sP 192.168.68.0/24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.