Results 1 to 5 of 5
Hello, i want to run these 3 commands on linux rhel boot, please how to start after boot? 1. ssh -f -N -D 0.0.0.0:1080 localhost 2. iptables -A INPUT --src ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-24-2014 #1
Run commands on each boot
Hello, i want to run these 3 commands on linux rhel boot, please how to start after boot?
1. ssh -f -N -D 0.0.0.0:1080 localhost
2. iptables -A INPUT --src 184.108.40.206 -p tcp --dport 1080 -j ACCEPT
3. iptables -A INPUT -p tcp --dport 1080 -j REJECT
these should ensure the server will serve as a proxy at port 1080 for mentioned IP only
- 01-24-2014 #2
Most distros have a startup script called rc.local, where you put this kind of thing. You'll find it in the /etc tree, usually in /etc/rc.d with the other startup scripts."I'm just a little old lady; don't try to dazzle me with jargon!"
- 01-25-2014 #3
i inputed it by installing sshpass (yum install sshpass) and command looks like:
sshpass -p "$pass" ssh -f -N -D 0.0.0.0:1080 localhost
i added commands in a new .sh file with chmod +x permissions and call this .sh file from /etc/rc.d/rc.local (sh /path/to/file.sh) that worked.
Last edited by postcd; 01-25-2014 at 10:03 AM.
- 01-25-2014 #4
- Join Date
- Dec 2013
Here's a pretty good explanation of the services execution process at boot. An introduction to services, runlevels, and rc.d scripts | Linux.com
Note it differs by distro - and you haven't indicated yours yet. You get different services at different run levels.
- 01-25-2014 #5
Have you tried just putting those command in the rc.local file and see if they execute. You're running a shell within a shell that's what concerns me.