maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   accessing N9 thru SSH over wifi (https://talk.maemo.org/showthread.php?t=79355)

F2thaK 2011-10-25 12:41

accessing N9 thru SSH over wifi
 
accessing N9 thru SSH over wifi


how do you do it?

Ive activated developer mode, run SDK connect, got IP and password and attempted to gain access. What user name do you use? I tried root and user. No go.

--------------------------------------------------------------------------------
Post PR1.1, to enable remote root login again (or rather make it controllable via
/etc/ssh/sshd_config like before):


Code:

echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh
pkill -9 /usr/sbin/sshd

annd reboot.

ukki 2011-10-25 12:48

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by F2thaK (Post 1113381)
accessing N9 thru SSH over wifi


how do you do it?

Ive activated developer mode, run SDK connect, got IP and password and attempted to gain access. What user name do you use? I tried root and user. No go.

On N9 open terminal and run:
Code:

devel-su (password is rootme)
passwd user (and enter some password)

Then ssh in as 'user' using the password you just set.

EDIT: Not sure you need to be root for that, simple 'passwd' as user could work too.

F2thaK 2011-10-25 13:11

Re: accessing N9 thru SSH over wifi
 
thanks!.......

mooglez 2011-10-25 13:28

Re: accessing N9 thru SSH over wifi
 
Any problems connecting over 3G? Wifi seems to work fine for me, but attempting to connect to an N9 that is on 3G connection fails.

oweng 2011-10-25 13:30

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by mooglez (Post 1113415)
Any problems connecting over 3G? Wifi seems to work fine for me, but attempting to connect to an N9 that is on 3G connection fails.

Are you even on the same network? Can you 'see' eachothers IPs?

mooglez 2011-10-25 13:43

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by oweng (Post 1113416)
Are you even on the same network? Can you 'see' eachothers IPs?

not on the same network

i've added the ip address that my putty is on to the N9 openssh config as an allowed host (previously only the common intranet addresses were there)

I think i had this working before i started messing with some of the settings, which is why it would be nice if someone confirmed that they can connect normally over 3G via SSH

reinob 2011-10-25 14:52

Re: accessing N9 thru SSH over wifi
 
You don't normally get a public IP when on 2G/3G, in which case you won't be able to connect from a device outside of that network.

uvatbc 2011-10-25 15:15

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by ukki (Post 1113383)
On N9 open terminal and run:
Code:

devel-su (password is rootme)
passwd user (and enter some password)

Then ssh in as 'user' using the password you just set.

EDIT: Not sure you need to be root for that, simple 'passwd' as user could work too.

+1 for this post.
Also: if you do a passwd without devel-su then it refuses to change the password.

mooglez 2011-10-25 15:24

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by reinob (Post 1113449)
You don't normally get a public IP when on 2G/3G, in which case you won't be able to connect from a device outside of that network.

i do on mine. worked just fine on my n900, and i think it was working for me previously on N9 also.

SteveYoungs 2011-10-28 03:38

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by F2thaK (Post 1113381)
accessing N9 thru SSH over wifi


how do you do it?

Ive activated developer mode, run SDK connect, got IP and password and attempted to gain access. What user name do you use? I tried root and user. No go.

Well, I've never used the SDK connect thing, but the way I set mine up was...

From terminal on N9:

Code:

devel-su
mkdir .ssh
su - developer
mkdir .ssh

From PC:

Code:

$ scp ~/.ssh/id_dsa.pub root@[N9's IP]:.ssh/authorized_keys
At this point you should be able to ssh from your PC to your N9 as the root user with a simple: `ssh root@IP' with no need for a passwd because it is using SSH keys.

Now all you need to do is copy /root/.ssh/authorized_keys to /home/developer/.ssh/ and make sure you chown it to the right user/group. The easiest way to do that is copy it as root to a temporary file in /home/developer/.ssh/ and then switch to the developer user and then cp it to authorized_keys file.

I tried doing the same thing with the "user" user, but for some reason it would not let me log in via ssh afterwards. But seeing as though the user "developer" has the same userid it doesn't really matter. :-)

Another good thing to do is to create a SSH key pair for the N9's user, "user". Then you can put the .pub on any machine you want to ssh to from your N9. It is very handy being able to log into my desktop at home no matter where I am in the world. :-)

SteveYoungs 2011-10-28 03:43

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by reinob (Post 1113449)
You don't normally get a public IP when on 2G/3G, in which case you won't be able to connect from a device outside of that network.

It depends on your mobile carrier I think. I get public IP on gprs (2/3G) and I can log into my desktop via SSH from my N9 on it.

reinob 2011-10-28 07:35

Re: accessing N9 thru SSH over wifi
 
OK. At least in my case I get a 10.*.*.* address from my provider. Of course this lets me connect to Internet, or to my laptop via SSH (otherwise it wouldn't be an "internet" connection).

The problem is when you want to make a connection TO your N900/N9 from the OUTSIDE. The public IP that I get is (probably) shared by other devices on the same network (NAT).

Manatus 2011-10-28 10:22

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1114927)
It depends on your mobile carrier I think. I get public IP on gprs (2/3G) and I can log into my desktop via SSH from my N9 on it.

This is curious... So far I haven't been able to connect to SSH through 3g data connections either. However WebDAV-server in QAD file manager I was able to connect to.

I use the same sim card that, until it got chopped to fit N9, worked lately with N900. I am able connect to SSH with wifi, though.

3g data seems to yield good speed and throughput (10 Mbps), so it doesn't seem to be plain badly working data connection.

Until your comment I just though that gprs0 interface was blocked in iptables (don't know how to check that) while wlan0 was not.

EDIT: With not getting connection through 3g I meant timeout, not restriction to log in (as is configured in /etc/sshd_config).

mooglez 2011-10-28 10:58

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1114927)
It depends on your mobile carrier I think. I get public IP on gprs (2/3G) and I can log into my desktop via SSH from my N9 on it.

It worked for me too the first few days, but after i changed to key based authentication, i suddenly cannot connect via 3G connection anymore.

Wondering if i mistakenly did something else too.. could someone post the default sshd config from N9?

SteveYoungs 2011-10-28 23:47

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by Manatus (Post 1115015)
This is curious... So far I haven't been able to connect to SSH through 3g data connections either.

[ ... ]

Until your comment I just though that gprs0 interface was blocked in iptables (don't know how to check that) while wlan0 was not.

For your iptables rules on your N9, forget it. You don't have permission to run iptables at all (not even as root). Thank you very much, aegis mumbo-jumbo nonsence. :-(

On your PC it'd be an incoming packet and you can't filter on interface for incoming. At least I don't think you can.

Code:

iptables -S
Is the command you're looking for, BTW. Just grep its output for what you are looking for, even if you're not going to find it in this case. :-)

Quote:

EDIT: With not getting connection through 3g I meant timeout, not restriction to log in (as is configured in /etc/sshd_config).
Hmm, doesn't that suggest that the problem you have is simply slow/flakey connection? Or have you mucked about in your sshd conf?

SteveYoungs 2011-10-28 23:56

Re: accessing N9 thru SSH over wifi
 
1 Attachment(s)
Quote:

Originally Posted by mooglez (Post 1115032)
It worked for me too the first few days, but after i changed to key based authentication, i suddenly cannot connect via 3G connection anymore.

Wondering if i mistakenly did something else too.. could someone post the default sshd config from N9?

Here's mine. I'm fairly sure I haven't modified it, but in any case it works.
------------------------------------------------------------------------

mooglez 2011-10-31 06:30

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1115363)
Here's mine. I'm fairly sure I haven't modified it, but in any case it works.
------------------------------------------------------------------------

Thank you for the file.

After replacing mine with yours, and rebooting the phone, the problem still persists.. I'm not able to connect over the 3G public IP address.

I should probably stick my SIM card back into N900 for a moment when I get back home, and verify that the problem is not caused by it.

Andy1210 2011-10-31 16:04

Re: accessing N9 thru SSH over wifi
 
terminal:
devel-su
passwd -u developer

Then you can connect with "developer" user, and then use devel-su for root over ssh :)

trbs 2011-11-02 19:52

Re: accessing N9 thru SSH over wifi
 
Please note that the internal password security of the N9 like the N900 is very very weak !

Passwords are stored in /etc/passwd with a very simple "Traditional DES" encryption which makes cracking password from the N9 a matter of minutes to hours.

So please don't use passwords but use ssh keys like described earlier in this thread and then change your /etc/ssh/sshd_config to read:

Code:

PasswordAuthentication no
Even if the password storage was not so weak I would still recommend this, since your likely to connect to many foreign networks.

moofang 2011-11-02 19:59

Re: accessing N9 thru SSH over wifi
 
Uh, guys, if you're on 3G you're almost certainly under a NAT. You simply cannot reliably ssh (or connect in any other way without a proxy or some trick) to your phone or any other device if you're on 3G. If you can you're probably lucky enough to be currently assigned exclusively to a public IP. Don't expect that to be reliably repeatable. That's what services like dyndns are for.

mece 2011-11-02 20:00

Re: accessing N9 thru SSH over wifi
 
ssh over 3g is blocked by a script that drops connections over gprs to port 22. The script is aegis protected so you can't just go and change it. This is how I solved the problem:
http://talk.maemo.org/showpost.php?p...7&postcount=56

It's a workaround, but it works.

DaGr8Gatzby 2011-11-04 00:07

Re: accessing N9 thru SSH over wifi
 
How do I shut off sshd?

SteveYoungs 2011-11-04 02:41

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1115359)
You don't have permission to run iptables at all (not even as root). Thank you very much, aegis mumbo-jumbo nonsence. :-(

But you do if you are not root. aegis, you are so god damned weird! I can't wait till I find a way to turn that off completely and forever.

SteveYoungs 2011-11-04 02:52

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by mece (Post 1117488)
ssh over 3g is blocked by a script that drops connections over gprs to port 22. The script is aegis protected so you can't just go and change it. This is how I solved the problem:
http://talk.maemo.org/showpost.php?p...7&postcount=56

It's a workaround, but it works.

All this script does is add a iptables rule to the device's firewall, and it is only for incoming connections. It does not stop you from ssh'ing from the device over 3g.

You can also easily remove the iptables rule that it adds with:

Code:

/sbin/iptables -D INPUT -i gprs0 -p tcp -m tcp --dport 22
 -j DROP

Note though that you would need to do this after ever reboot of the device. And also because of aegis weirdness you have to do this as "user" not as "root".

kopla 2011-11-06 17:48

Re: accessing N9 thru SSH over wifi
 
Aerlier SSH connection worked but not after OpenSSH updated.
I only get error "Connection refused".

Any ideas how this problem could be solved?

shmerl 2011-11-06 20:42

Re: accessing N9 thru SSH over wifi
 
See also: http://forum.meego.com/showthread.php?t=4866

shmerl 2011-11-06 20:58

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1118096)
Note though that you would need to do this after ever reboot of the device. And also because of aegis weirdness you have to do this as "user" not as "root".

It's actually good. When you really need to access the device through ssh, you can do this temporary removal, which is back after the reboot. But really for security reasons I wouldn't leave ssh open there for the outside network. Remote ssh forwarding works fine, and limits the session to your own machine.

SteveYoungs 2011-11-06 23:17

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by shmerl (Post 1119216)
It's actually good. When you really need to access the device through ssh, you can do this temporary removal, which is back after the reboot. But really for security reasons I wouldn't leave ssh open there for the outside network. Remote ssh forwarding works fine, and limits the session to your own machine.

Yeah, I agree. In fact, I never SSH to my N9 over 3g/gprs. Why? Because the only time I'm using 3g I'm away from home, and when I'm away from home my N9 is with me. :)

Outgoing SSH (from the N9) is unaffected by this iptables rule, so for my usage at least, never need to touch the iptables for SSH.

J4ZZ 2011-11-07 08:23

Re: accessing N9 thru SSH over wifi
 
Have someone tried to just put the N9 into AP mode (Mobile Hotspot) and then connect over SSH? Always worked with the N900. ;)

Cheers,

J4ZZ

mooglez 2011-11-07 09:32

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by kopla (Post 1119158)
Aerlier SSH connection worked but not after OpenSSH updated.
I only get error "Connection refused".

Any ideas how this problem could be solved?

the update disabled root login to ssh by default
you can login as user, or edit the sshd_config to allow root login again.

tratrafe2 2011-11-07 17:52

Re: accessing N9 thru SSH over wifi
 
i made a step by step tutorial here ;)
http://www.youtube.com/watch?v=wccMF2lDH5A

F2thaK 2011-11-11 08:56

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by SteveYoungs (Post 1114926)
Well, I've never used the SDK connect thing, but the way I set mine up was...

From terminal on N9:

Code:

devel-su
mkdir .ssh
su - developer
mkdir .ssh


I cant get past step "su - developer", Ive updated to PR1.1 and i get not authorised error or some sh.t. F>>K ssake

SteveYoungs 2011-11-11 22:10

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by F2thaK (Post 1121732)
I cant get past step "su - developer", Ive updated to PR1.1 and i get not authorised error or some sh.t. F>>K ssake

I still haven't received PR1.1 yet, so I don't know for sure. I guess it is possible that they have further crippled the thing by removing root's access to su somehow. Although I cannot imagine why they'd be so stupid to do that.

Perhaps you need to use `devel-su' from root now too?

F2thaK 2011-11-12 02:11

Re: accessing N9 thru SSH over wifi
 
yes, with pr1.1 theyve disabled root access in another config file. found the fix on meego forum.


Post PR1.1, to enable remote root login again (or rather make it controllable via
/etc/ssh/sshd_config like before):


Code:

echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh
pkill -9 /usr/sbin/sshd

annd reboot.

Schturman 2011-11-12 10:27

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by tratrafe2 (Post 1119573)
i made a step by step tutorial here ;)
http://www.youtube.com/watch?v=wccMF2lDH5A

Thanks, very useful video :)

DaShaker 2011-11-13 22:06

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by tratrafe2 (Post 1119573)
i made a step by step tutorial here ;)
http://www.youtube.com/watch?v=wccMF2lDH5A

Thanks for the video! You might want to include a demo of SSHFS as well. On a Linux client, you can mount your N9 with a command like this:

sshfs user@N9ip:/home/user/MyDocs/share /home/myuser/share

SSHFS runs over SSH, so nothing further is needed on the N9 side. You can now access the N9 from the Linux box under share.

On a Windows system, there is a Dokan SSHFS client. With this you can mount something on the N9 as a logical drive. So N: is /home/user/MyDocs/share on Windows, for example.

Now I just need a Samba and SSHFS client for the N9, to access Linux and Windows servers from the N9 . . .

Schturman 2011-11-13 22:36

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by DaShaker (Post 1123112)
Thanks for the video! You might want to include a demo of SSHFS as well. On a Linux client, you can mount your N9 with a command like this:

sshfs user@N9ip:/home/user/MyDocs/share /home/myuser/share

SSHFS runs over SSH, so nothing further is needed on the N9 side. You can now access the N9 from the Linux box under share.

On a Windows system, there is a Dokan SSHFS client. With this you can mount something on the N9 as a logical drive. So N: is /home/user/MyDocs/share on Windows, for example.

Now I just need a Samba and SSHFS client for the N9, to access Linux and Windows servers from the N9 . . .

Thanks.. Can you write a full guide step by step for windows users, please?

shmerl 2011-11-13 23:28

Re: accessing N9 thru SSH over wifi
 
For windows you'll probably need to install cygwin first.

DaShaker 2011-11-13 23:46

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by Schturman (Post 1123121)
Thanks.. Can you write a full guide step by step for windows users, please?

The download site for DokanSSHFS is here: http://dokan-dev.net/en/download/
Download:
DokanInstall_0.6.0.exe
dokan-sshfs-0.6.0.zip
dokan-sshfs-0201226.zip
Microsoft Visual C++ 2005 SP1 Redistributable Package
(I can't post all the links, since I am a new member)

1) Unpack the zipped files into separate directories. Install the Microsoft Visual C++ 2005 SP1 Redistributable Package first.

2) Run the DokanInstall_0.6.0.exe to install the Dokan libraries.

3) In the dokan-sshfs-0201226 directory, run the installer to install the older 0.2 version. This is necessary because the 0.6 version does not have an installer. This will probably ask for a reboot.

4) From the 0.6 unzipped directory, copy (overwrite )DokanNet.dll and DokanSSHFS.exe in the installed location, C:\Program Files\Dokan\DokanSSHFS.

5) Start the Dokan GUI from the desktop Icon or from Windows Start. Everthing is pretty much self explanatory:

Host: N9ip
User: User
Password: xxxx (I haven't figured out how to use the "identity" yet)
Server Root: /home/user/MyDocs/share
Drive: N

Oh, I forgot to mention in my first post. You might also be interested in using VNC. This allows you to have your phone interface as a window on Windows or Linux. The VNC server is on the Nokia shop for free called "Netview." VNC clients are available for Windows and Linux called vncviewer. This is nice if you are configuring something on the phone with a GUI, but want to use a full size keyboard to type in the text fields on the GUI. Just start Netview on the N9, and use "vncviewer N9ip."

Have fun!

DaShaker 2011-11-14 00:00

Re: accessing N9 thru SSH over wifi
 
Quote:

Originally Posted by shmerl (Post 1123150)
For windows you'll probably need to install cygwin first.

No, there is no need for cygwin. On Linux SSHFS works through a kernel module called Filesystem in Userspace, or FUSE. Dokan is a Windows implementation of FUSE (more or less). So it is just a few Windows .exe's and .DLL's.


All times are GMT. The time now is 00:08.

vBulletin® Version 3.8.8