Blind ssh connectin a problem


39 posts   Page 2 of 2   1, 2
by AndrewS » Wed Jun 27, 2012 11:57 am
peguintutor - can you add links to your guides to http://elinux.org/RPi_Guides please? :)
User avatar
Posts: 2193
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by pluggy » Sun Jul 01, 2012 8:33 pm
nmap

http://nmap.org/

Handiest thing in the world for finding stuff on a network. Not got my pi yet but its in the Debian ARM repository I use on my ARM box. There is a certain degree of paranoia in some quarters surrounding such software, you have been warned. Available for Windoze & Mac

nmap 192.168.1.0/24

will work on many modern router networks (192.168.1.X).

Devices with port 22 open are a good place to start
Don't judge Linux by the Pi.......
User avatar
Posts: 2081
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by ic3guy » Mon Jul 02, 2012 10:27 am
Thank you very much Penguin. This is exactly what I was looking for.

Cheers!
Posts: 3
Joined: Mon Jul 02, 2012 10:26 am
by Chistrix » Mon Jul 30, 2012 5:24 pm
I connected the raspberry pi to the network in my workplace. To find the ip for connecting using ssh
I just did a ping from Windows Command Line using the default name raspberrypi and it provided the ip address.

C:\Users\chistrix>ping raspberrypi

Pinging raspberrypi.prt.local [10.13.7.243] with 32 bytes of data:
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64

Ping statistics for 10.13.7.243:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Posts: 1
Joined: Mon Jul 30, 2012 5:18 pm
by jdbennet » Mon Jul 30, 2012 6:07 pm
Why not use serial, or make sure it has a fixed ip?
Posts: 96
Joined: Sun Jul 22, 2012 2:25 pm
by aelsas » Mon Jul 30, 2012 6:35 pm
Another option would be an app like Fing http://www.overlooksoft.com/download
User avatar
Posts: 58
Joined: Fri Jul 06, 2012 11:23 pm
Location: Frankfurt, Germany
by bursar » Mon Jul 30, 2012 9:49 pm
Chistrix wrote:I connected the raspberry pi to the network in my workplace. To find the ip for connecting using ssh
I just did a ping from Windows Command Line using the default name raspberrypi and it provided the ip address.

C:\Users\chistrix>ping raspberrypi

Pinging raspberrypi.prt.local [10.13.7.243] with 32 bytes of data:
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64
Reply from 10.13.7.243: bytes=32 time<1ms TTL=64

Ping statistics for 10.13.7.243:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Try it home and see what happens. If you're not running a DNS server, your Windows PC won't be able to look up the hostname 'raspberrypi'.

And the quoted post brings up a point that I wanted to mention. Preconfiguring for a 192.168.x.x address is a bad idea when you don't know if the user might actually be wanting an 10.x.x.x address.
http://mmm-pi.co.uk - my adventures with a Pi
Posts: 22
Joined: Thu Jul 19, 2012 10:53 am
Location: Cambridge, UK
by e90jimmy » Mon Jul 30, 2012 10:13 pm
I went a Little different route.


Edit /etc/rc.local <nano, vi, joe: your choice>

insert the following line after, 17: "printf :My IP adress is..."

Code: Select all
curl  http://www.yourwebsite.com/pi-ip/?id=pi_one\&addr=$_IP



Then on the server side, add a PHP Script:


Code: Select all

<?php

$pi_id = $_REQUEST['id']; // If you have more then one pi.
$pi_addr = $_REQUEST['addr'];
$date = date('c');

$myFile = "tr_".$pi_id.".txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $date ."|". $pi_addr ."\n");
fclose($fh);

?>



You end up with a txt file on the webserver that looks like this:

Code: Select all
2012-07-30T14:52:07-04:00|192.168.30.99
2012-07-30T14:55:00-04:00|192.168.39.12
2012-07-30T14:59:00-04:00|192.168.39.10



Then just bookmark the url for your text file, and you can always get your PI IP.


YMMV.
Posts: 8
Joined: Thu Jan 12, 2012 4:39 pm
by bursar » Tue Jul 31, 2012 7:55 am
e90jimmy wrote:I went a Little different route.

Then just bookmark the url for your text file, and you can always get your PI IP.

How do you access the text file to obtain the IP address when you don't know the IP address to connect to the Pi to obtain the text file?
http://mmm-pi.co.uk - my adventures with a Pi
Posts: 22
Joined: Thu Jul 19, 2012 10:53 am
Location: Cambridge, UK
by alexeames » Tue Jul 31, 2012 8:20 am
bursar wrote:
e90jimmy wrote:I went a Little different route.

Then just bookmark the url for your text file, and you can always get your PI IP.

How do you access the text file to obtain the IP address when you don't know the IP address to connect to the Pi to obtain the text file?


I think he's assuming you've got a web server elsewhere.
Actually now I think about it you could also use the little script I wrote last week (which was written for security checking) which emails you (using a googlemail account) the IP address of the Pi and lots of other info too. If that's of interest I can post the latest version. If not, no worries. :D
My Pi uses 2 watts - what what? ---- HiRes early production Pi photos RS Front Back | Farnell Front Back
User avatar
Posts: 2018
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by e90jimmy » Tue Jul 31, 2012 11:30 am
Yes, exactly, you simply access the text file:

http://www.yourwebserver.com/pi-ip/tr_<id>.txt

--Jimmy
Posts: 8
Joined: Thu Jan 12, 2012 4:39 pm
by e90jimmy » Tue Jul 31, 2012 12:34 pm
I also tried mailing the ip address on boot, but quickly found neither mail or mailx were installed.


I am using the Raspbian build.


Step One install, mailx
Code: Select all

$ sudo apt-get install bsd-mailx ssmtp



Edit /etc/ssmtp/ssmtp.conf, update mailhub to gmail, change hostname, and add AuthUser, AuthPath, UseSTARTTTLS.

Code: Select all

mailhub=smtp.gmail.com:587
hostname=<YOUR HOSTNAME>
AuthUser=<gmail_address>@gmail.com
AuthPass=<gmail_password>
UseSTARTTLS=YES



Send Test Email:
Code: Select all

/usr/bin/mail -s "my ipaddress `hostname -I`" <youremailaddress> < /etc/motd




Add the mail command to /etc/rc.local

Code: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
  /usr/bin/mail -s "my ipaddress $_IP" <youremail> < /etc/motd
 # edit:  need full path to mail, and some file for content, Message of the day will work.
fi

exit 0


Reboot Raspberry Pi

Check Email
Posts: 8
Joined: Thu Jan 12, 2012 4:39 pm
by alexeames » Tue Jul 31, 2012 2:02 pm
e90jimmy wrote:I also tried mailing the ip address on boot, but quickly found neither mail or mailx were installed.


Nice solution. Mine uses a googlemail account and python to do the sending. :D
My Pi uses 2 watts - what what? ---- HiRes early production Pi photos RS Front Back | Farnell Front Back
User avatar
Posts: 2018
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by nadir » Thu Aug 02, 2012 4:43 pm
I did it like mentioned above: with "nmap 192.168.1.0/24" (or whatever ifconfig tells me to use as a net). For Windows this could be done with zenmap.
arp-scan, mentioned earlier, seems to work good too.
Now it (usually) uses the same IP, but if in doubt i use nmap again, and it works well.
Posts: 112
Joined: Sun Jun 10, 2012 5:45 am