Reply
Thread Tools
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#11
Originally Posted by spanner View Post
Sounds like you're doing the right thing. I've never used freesshd so can't help you there, or troubleshoot Windows firewall problems for you. Maybe try the freesshd forums or google the exact error message.
I got firewall disabled anyway, all the time (:
And iv'e searched google and freesshd forums for the errors and all sort of keywords yesterday. I'm pretty much stuck. (:
I'll see if I can make my dd-wrt router do this (: it is linux after all.

Edit : Oh Oh! I almost forgot! Thanks for the help (:
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 

The Following User Says Thank You to eitama For This Useful Post:
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#12
Originally Posted by spanner View Post
Sounds like you're doing the right thing. I've never used freesshd so can't help you there, or troubleshoot Windows firewall problems for you. Maybe try the freesshd forums or google the exact error message.
OMG! It's working!!!!!!!
I just sshed to my router, ran the commands, and it worked!!!!

Now another question, I am a bit confused with the ssh keys.
I am getting prompted for a password on the N900 when running the "ssh -R command"
Do I need the public key from the router on the N900? or from the N900 on the router? I don't want to lose the password configuration in general, just for this command!

Also, any idea how I make this ssh loop run in the background and on startup?
I know my way around creating .sh file and giving them run permissions, I just need to know where to put it. maybe i'll make some code to check if there is internet connectivity, and if not, stop the loop or increase the sleep time.

Edit : I solved the public key problems.
Tomato allows inserting the public keys via the web GUI, so now no more password needed.

Just need to run the script on startup and in background.
I'll google a bit (:
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |

Last edited by eitama; 2010-06-02 at 08:55.
 
spanner's Avatar
Posts: 253 | Thanked: 184 times | Joined on Nov 2009 @ Bristol, UK
#13
Originally Posted by eitama View Post
OMG! It's working!!!!!!!
I just sshed to my router, ran the commands, and it worked!!!!

Now another question, I am a bit confused with the ssh keys.
I am getting prompted for a password on the N900 when running the "ssh -R command"
Do I need the public key from the router on the N900? or from the N900 on the router? I don't want to lose the password configuration in general, just for this command!
You need to copy /home/user/.ssh/id_rsa.pub (from your N900) into ~user/.ssh/authorized_keys on your router. This is assuming you're sshing into an account called "user" on the router - I'm not running dd-wrt so again I can only guess.

Make sure authorized_keys has permissions 600 and ~user/.ssh has permissions 700 (on the router).

Originally Posted by eitama View Post
Also, any idea how I make this ssh loop run in the background and on startup?
I know my way around creating .sh file and giving them run permissions, I just need to know where to put it. maybe i'll make some code to check if there is internet connectivity, and if not, stop the loop or increase the sleep time.
I don't know the best place to put a script like this on the N900, maybe someone else can help? Perhaps copy & modify one of the files in /etc/rc2.d but careful you may be able to hose your device if you mess it up. Get it running from the terminal first!

If you're running your script as root (which you will be if you're running it at startup) then su to user first so that the ssh client finds the right rsa key (otherwise it'll be looking at ~root/.ssh/id_rsa.pub, which doesn't exist)

su -c "ssh -N -C -R 2222:127.0.0.1:5000 myhomepc.net" user
 
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#14
Originally Posted by spanner View Post
You need to copy /home/user/.ssh/id_rsa.pub (from your N900) into ~user/.ssh/authorized_keys on your router. This is assuming you're sshing into an account called "user" on the router - I'm not running dd-wrt so again I can only guess.

Make sure authorized_keys has permissions 600 and ~user/.ssh has permissions 700 (on the router).



I don't know the best place to put a script like this on the N900, maybe someone else can help? Perhaps copy & modify one of the files in /etc/rc2.d but careful you may be able to hose your device if you mess it up. Get it running from the terminal first!

If you're running your script as root (which you will be if you're running it at startup) then su to user first so that the ssh client finds the right rsa key (otherwise it'll be looking at ~root/.ssh/id_rsa.pub, which doesn't exist)

su -c "ssh -N -C -R 2222:127.0.0.1:5000 myhomepc.net" user
Thanks for the info! I was just editing my post above yours to let you know I got some of the stuff working!
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#15
@Spanner,

I am trying to make the script run when there is a connect up, and stop running when a connection is down.
1. I have created a file called reverse_ssh.sh
2. chmod 777 reverse_ssh.sh
3. vi reverse_ssh.sh, entered the following line :
while true; do ssh -N -C -p 5000 -R 2222:127.0.0.1:22 woohoo.no-ip.info; sleep 5; done
4. Now when I do "ps" or "ps -A" I see the following :

2260 root 3868 S ssh -N -C -p 5000 -R 2222:127.0.0.1:22 woohoo.no-ip.......

Instead of seeing the script name in the command.
Any idea on how to make it so that it will show "reverse_ssh.sh" so I can later do a grep on "ps" to kill it on if-down ?
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#16
It's all working now! including scripts to start stop it when internet comes and goes!!!
It's not been easy. I will add a page to the wiki about this, and i'll post a link to that wiki page here.

Thanks for all the help spanner!
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#17
The information has been gathered into a wiki page.
http://wiki.maemo.org/Reverse_ssh

Enjoy, Thx to Spanner for his great help.
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |

Last edited by xomm; 2010-06-03 at 14:58. Reason: Poster requested an edit.
 

The Following 2 Users Say Thank You to eitama For This Useful Post:
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#18
Just to make things clear for readers, Open VPN will actually work great, but you will have to establish a connection to the VPN server from every new location you want to connect from, As opposed to reverse ssh, where you just "ssh" to your router / common server, and then to your n900.
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 

The Following User Says Thank You to eitama For This Useful Post:
xomm's Avatar
Posts: 609 | Thanked: 243 times | Joined on Jan 2010 @ Eastern USA
#19
As per eitama's request, this thread is now solved and closed.

If anyone has questions on this topic, read through this thread, and the wiki page linked to by eitama.

If you still can't find an answer, PM me and I'll reopen this thread, instead of making a new thread.

---Sept 25---

Thread re-opened for question.
__________________
==In school once again. Free time limited to night, holidays and weekends.==
Hi! I'm Andy, a Maemo Greeter! I'm also a moderator of the Applications, Nokia N900, and Maemo 5/Fremantle forums.
Useful Links: Maemo Wiki Main Page, New users start here, Beginners' wiki page, Maemo5 101, Frequently Asked Questions (FAQ)
Also, pin yourself in the map! Maemo Map. Send me a PM (Private Message) if I leave you hanging on a problem (or if you need more help).
Owner of both a N800 and N900; Active community member since Jan 2010. You've been xommified! - My blog.

Last edited by xomm; 2010-09-25 at 21:06.
 
Posts: 12 | Thanked: 5 times | Joined on Mar 2010
#20
Hi,

I have a problem trying to use a reverse ssh tunnelling.

After this command:
ssh -N -C -p 22 -R 2222:127.0.0.1:22 myHostname.no-ip.info

I have this error:

debug1: Entering interactive session.
debug1: remote forward failure for: listen 2222 connect, 127.0.0.1:22
Warning: remote port forwarding failed for listen port 2222
All remote requestes processed

and I cannot connect to the Host from remote.

Many thanks for any suggest.

bblue
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 21:36.