Notices


Reply
Thread Tools
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#11
Ok, here's what I've done so far:

Code:
sudo gainroot
(you need to have the gainroot package installed)

edit /etc/event.d/sshd

I used "vi" to do that.

Comment out the first line:
Code:
#start on stopped rcS
and reboot. This way, ssh server will not autostart on boot.

Next step, give a password to "user"
Code:
sudo gainroot
passwd user
Then, edit /etc/ssh/sshd_config
Added the lines
Code:
AllowUsers user
MaxAuthTries 5
and changed
Code:
PermitRootLogin no
Port xxxx
where xxxx is a port of your choice, if you want other than 22

I have to leave home now, but I think two simple scripts in /etc/network/if-up.d and /etc/network/if-down.d should do the job:

start_ssh in /etc/network/if-up.d:
Code:
#!bin/sh
sh /etc/init.d/ssh start
stop_ssh in /etc/network/if-down.d:
Code:
#!bin/sh
sh /etc/init.d/ssh stop
I will hopefully try it later today as soon as I get home and then move on to configuring dyndns with the current ip.


Noob Question: If you have a device "A" connected to a public wifi (coffee shop, friends house), is there any way to ssh from device "B" into "A" without having to set modem port forwarding?

E.g.: if "A" is configured to listen to port 1234 and we know "A"'s public ip, will this work without configuring the modem(assuming 1234 is open)?

Code:
ssh -p 1234 user@publicIP
Never tried it before without port forwarding....

Last edited by colder; 2010-11-07 at 20:06.
 
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#12
For some reason it does not seem to work. Here's the start script:

Code:
#!/bin/sh

cd /root/ipcheck
python ipcheck.py -l -r checkip.dyndns.org:8245 username password domain
/etc/init.d/ssh start
where username/password/domain are the credentials for dyndns.org

and then
Code:
chmod 755 start_script.sh
I tried connecting and disconnecting the internet connection a few times but the script does not seem to run. I even added something silly such as

Code:
mkdir /home/user/test
for testing purposes but it does not get executed at all.

Any ideas?
 
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#13
NAILED IT!

On the above script, I replaced

Code:
#!/bin/sh
with
Code:
#!/bin/ash
and also renamed the file from start_script.sh to start_script (won't work otherwise)

Don't know what made the difference, I was just experimenting....

 
Reply

Thread Tools

 
Forum Jump


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