PDA

View Full Version : ssh over bluetooth?


meep
2010-03-12, 11:33
Hi all,

Is there a way to SSH over bluetooth? I just want to try an experiment :)

Cheers

noobmonkey
2010-03-12, 11:37
i'm not an expert, but if you are using bluetooth DUN - you would get an IP, so yes it should work....

phedders
2010-03-12, 13:23
Yes does work. just "ifup -f bnep0" - you may ahve to add a stanza to /etc/network/internfaces - fiddled a lot with mine, but it works very well - even with windows!!!

rolandw
2010-03-18, 18:51
ifup requires you to have write access on /var/run/ifstate which requires you to run this as root. Gainroot still doesn't allow it. Having ssh'd to the device as root, chmod'd ifstate and then run ifup using gainroot, no IP seems to be allocated. Surely there must be some better way of running this than as root or via chmoding the ifstate file?

Is it right that /etc/network/interfaces needs adding

auto bnep0
iface bnup0 inet static
address 192.168.3.15
netmask 255.255.255.0
gateway 192.168.3.1

or similar? I tried that and it still doesn't work.

gsever
2010-04-18, 20:58
Is there any progress for the original question?

I would like to be able to ssh N900 via bluetooth network. I could send/receive files between the device and my F12 fine however ssh'ing doesn't seem to work. (I used PC-Connectivity (http://pc-connectivity.garage.maemo.org/) package to configure IP settings for the bluetooth network.)

It would be great if someone shed light on this issue.

bugelrex
2010-06-17, 17:12
Any progress on this?

I found:
http://talk.maemo.org/showthread.php?t=48992

but this required the USB cable to be connected.

sebhack
2010-12-14, 21:19
Here is how I manage to establish a network connection
between N900 and my MacBookPro over Bluetooth PAN.

On N900: Edit /etc/bluetooth/main.conf and remove 'network' from the
configuration option 'DisablePlugins'. Reboot device.
This enables Bluetooth PAN.

Now pair your PC with your N900. On OSX: Go to network
preferences and add interface 'Bluetooth PAN'. Assign an IP
address to this interface, like 10.10.0.2 (Do not use your
LAN subnet like 192.. or 172.. to avoid routing issues).

Now grab your N900 and assign a IP address to the bluetooth
interface:

ifconfig bnep0 up 10.10.0.2

Now you should be able to ping and ssh 10.10.0.2 from your PC.
For ssh: be sure to install OpenSSH server on your device.

Have fun,

euer datenpeter!

ampaze
2010-12-14, 21:44
Very good. Now all I need is Bluetooth on my PC.

sebhack
2010-12-16, 19:34
Use the dbus-scripts daemon if you do not want to
assign the IP address manually via Xterminal everytime
a connection has been established.

Here is how:

# wget http://repository.maemo.org/extras-devel/pool/fremantle/free/d/dbus-scripts/dbus-scripts_1.0+maemo-5_armel.deb
# dpkg -i dbus-scripts_1.0+maemo-5_armel.deb

Create /usr/bin/bt.sh, contents:


#!/bin/sh
sleep 3
ifconfig bnep0 up 10.10.0.2


# chmod +x /usr/bin/bt.sh

Create /etc/dbus-scripts.d/dbus-scripts, contents:


/usr/bin/bt.sh * * org.bluez.Device PropertyChanged Connected


killall dbus-scripts
/etc/init.d/dbus-scripts start

zimon
2010-12-17, 10:58
/usr/bin/bt.sh * * org.bluez.Device PropertyChanged Connected


Doesn't that run that script also when just some other than network device is connected by Bluetooth?

MaddogG
2010-12-17, 11:18
Very good. Now all I need is Bluetooth on my PC.

May I ask you why don't you use WiFi?

clasificado
2010-12-17, 11:40
@MaddogG sometimes, you are in a computer that doesnt have wifi.

MaddogG
2010-12-17, 11:41
@MaddogG sometimes, you are in a computer that doesnt have wifi.

Ok, but he doesn't have Bluetooth, too!

zimon
2010-12-17, 13:15
And I think still Bluetooth uses less energy even with these new powersave-modes in Wifi.

I nowadays have Bluetooth networking on always when at home and much of the maintaining and configuring I do over ssh from PC.
It does not take much battery having it connected via BT all the time, but I would guess (have not tried) doing same with WLAN would drain the battery.

I used to keep it connected through USB, but I am not happy N900's CPU running constantly at 500 Mhz when connected via USB. I hope there will be a hack in kernel-power for that some day.

MaddogG
2010-12-17, 13:47
And I think still Bluetooth uses less energy even with these new powersave-modes in Wifi.


This is a good reason, probably you are right...

sebhack
2010-12-18, 08:48
Doesn't that run that script also when just some other than network device is connected by Bluetooth?

You're right. But I think, calling ifconfig multiple times doesn't hurt though.


The reason I want to access my device via bluetooth is our restricted wifi at my work place. There, I can access the internet, but I cannot access my computer due to security policies. Sure, I can use the USB cable, but I often forget it at home.

It's nice to be able to access files on the phone via sftp without touching it by leaving it in the bag.

zimon
2010-12-18, 10:31
You're right. But I think, calling ifconfig multiple times doesn't hurt though.


True, but if you also set up a default route, DNS-servers and Dummy-APN, like I have, it will hurt.

Would have to be something more specific so only started PAN connection would run the script.
If there would be pand program, one could just check with `pand -l` in the start of the script.
On PC side, I can see it is up:

# pand -l
bnep0 3C:F7:2A:XX:XX:XX PANU

jaromrax
2011-04-15, 12:00
Hi,
more than year later, I have the same question. I've started to play things as described elswhere on my debian squeeze, but soon I stucked on n900.

on root@n900:_________

/etc/bluetooth/main.conf and removed 'network,input,hal' from the
configuration option 'DisablePlugins'.

into /etc/network/interfaces I added

auto bnep0
iface bnup0 inet static
address 10.10.0.2
netmask 255.255.255.0
gateway 10.10.0.1

(even after reboot) I ran

ifup -f bnep0 (on ifup -v bnep0 it says 'interface already configured')
ifconfig bnep0 up 10.10.0.2
...ifconfig: SIOCGIFFLAGS: No such device

sabhack - did I forgot something?
thanks, j.

---edit----------------
ok, one thing is clear. Only after I try to connect over BT with nm-applet to "mymaemoname"_Network, the interfaces become available on both sides. No problem to add few lines to local /etc/network/interfaces (like
allow-hotplug bnep0
iface bnep0 inet static
address 10.10.0.3
netmask 255.255.255.0
# gateway 10.10.0.2
)

I must launch the ifconfig manually on n900.
However - I can have a bnep0 connection for about 30 seconds and after I get disconnected.... nm-applet just rotates ... these 30sec. This I dont know where it comes from, it doesnt happen for debian->BT->n900->mobile broadband.

Next thing: to be able to run dbus-scripts, I realized that it must be installed (from -devel?). I am not going to go that far, I am quite happy with the stability now. Are there any other solutions to respond automatically on n900 side?

-----next edit ------------- sorry ---------------------
after a lot of google ......
nm-applet 0.8, although it says it is ok, it has an issue with PAN
Finaly, I removed my bluetooth-applet, installed "blueman" and used blueman-applet. It didnt work neither, BUT, right-click/local services, I ticked group network, for "pan support" I tried to tick blueman (maybe a bug..., doesnt remember the setting) AND right-click/plugins I checked "DhcpClient" which unchecked "NMPANSupport". Than, "group network" from blueman started to work, nm-applet remained untouched and unaware.
My previous DUN setting in nm-applet remained ok (no idea where it is stored).
------------------
The only question remains, howto set
ifconfig bnep0 up 10.10.0.2
on n900 when PAN is started... without loading stuff from extra-devel.....
thanks, if there is any advice

aldebarab
2011-07-11, 07:27
ok, one thing is clear. Only after I try to connect over BT with nm-applet to "mymaemoname"_Network, the interfaces become available on both sides. No problem to add few lines to local /etc/network/interfaces (like
allow-hotplug bnep0
iface bnep0 inet static
address 10.10.0.3
netmask 255.255.255.0
# gateway 10.10.0.2
)

I must launch the ifconfig manually on n900.
However - I can have a bnep0 connection for about 30 seconds and after I get disconnected.... nm-applet just rotates ... these 30sec. This I dont know where it comes from, it doesnt happen for debian->BT->n900->mobile broadband.

Next thing: to be able to run dbus-scripts, I realized that it must be installed (from -devel?). I am not going to go that far, I am quite happy with the stability now. Are there any other solutions to respond automatically on n900 side?

-----next edit ------------- sorry ---------------------
after a lot of google ......
nm-applet 0.8, although it says it is ok, it has an issue with PAN

The only question remains, howto set
ifconfig bnep0 up 10.10.0.2
on n900 when PAN is started... without loading stuff from extra-devel.....
thanks, if there is any advice

Hi all

"allow-hotplug bnep0"
in /etc/network/interfaces seems to be ignored by maemo5 when connecting the n900 with bluetooth.
I only managed to bring up bnep0 by a dbus script:

EVENT="$4"
UDI="$5"
HALDEV="$(echo $UDI | sed 's#.*/\([0-9a-zA-Z_]*\)#\1#')"
LOG="/tmp/tethering.log"
echo $* >> $LOG
#INETDEV="gprs0"
INETDEV="wlan0"
RUNFILE="/var/run/tethering.$HALDEV.pid"
IFACEFILE="/var/run/tethering.$HALDEV.iface"

if [ "$EVENT" = "DeviceAdded" ]; then
IFACE=$(hal-get-property --udi $UDI --key net.interface)
echo $IFACE >> $LOG
# ari:
# network-manager-gnome (nm-applet) establishs connection only
# when receiving an dhcp reply
case $IFACE in
bnep0 )
IF_ADDRESS=192.168.253.1
IF_RANGE=192.168.253.254,192.168.253.254
IF_GW=192.168.253.254
;;
* )
exit 0
;;
esac

echo "$(date) Enabling tethering on interface $IFACE" >> $LOG
echo "$IFACE" > $IFACEFILE
ifconfig "$IFACE" "$IF_ADDRESS"
route add default gw $IF_GW
# ari: to make "dummy network work!
/usr/bin/run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
# ari: to make network-manager-gnome work
start-stop-daemon -S -p "$RUNFILE" -m -b -x /usr/sbin/dnsmasq -- -k -I lo -i "$IFACE" -a $IF_ADDRESS -z -F $IF_RANGE,3600

fi

if [ "$EVENT" = "DeviceRemoved" ]; then
if [ ! -f "$IFACEFILE" ]; then
exit 0
fi
IFACE="$(cat $IFACEFILE)"
rm "$IFACEFILE"
echo "$(date) Disabling tethering on device $IFACE" >> $LOG
start-stop-daemon -K -p "$RUNFILE" -x /usr/sbin/dnsmasq
#ari to remove dummy network
/usr/bin/run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui
com.nokia.icd_ui.disconnect boolean:true
ifconfig "$IFACE" down
fi

exit 0

NetworkManager with nm-applet seems to wait for a dhcp response. If there is no one, the connection times out and the bnep0 interfaces on both sides (n900 and debian squeeze) are removed. That's why we start dnsmasq to deliver exactly one address to the pc.

If you want to use the bnep0 connection from any n900 application for internet access (on the pc masquerading and forwarding must be enabled), you must use the "dummy network" for Internet connection (package libicd-network-null) and send a connection message for dummy on the system dbus.

BUT: why does not "allow-hotplug bnep0" work?
On the debian squeeze side it works flawlessly.

Hope this helps

ari

pulketo
2011-12-26, 18:32
May I ask you why don't you use WiFi?

I do have a reason:
I want to connect to my N900 from an android phone though bluetooth (via ssh) and want to be able to use aircrack or vnc

spacemoere
2014-02-18, 13:00
[QUOTE=sebhack;896897]Here is how I manage to establish a network connection
between N900 and my MacBookPro over Bluetooth PAN.

On N900: Edit /etc/bluetooth/main.conf and remove 'network' from the
configuration option 'DisablePlugins'. Reboot device.
This enables Bluetooth PAN.

Hola sebhack...

I don't know why, but I am not able to save the change in the main.conf file after modifiing:(...
Did I maybe forget something before?

reinob
2014-02-19, 10:02
I don't know why, but I am not able to save the change in the main.conf file after modifiing:(...
Did I maybe forget something before?

Are you root?