vps开机运行求助
283
- 哈P哥2013-01-15论坛元老34143
开机运行这个/usr/local/sbin/sshd -t -f /usr/local/etc/sshd_config
能不能直接ln -s /usr/local/sbin/sshd -t -f /usr/local/etc/sshd_config /etc/rc.d/rc.local这样?回运行吗?还是比较要按照教程先弄个脚本然后这样麻烦的设置一步步的来??创建一个脚本:
cd /etc/init.d/
vi setiptables.local
在脚本中输入上述两条指令(要以#!/bin/sh开头):
#!/bin/sh
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
sysctl -p
接着,保存该文件并退出编辑模式,并给予该文件可执行的权限。
chmod +x /etc/init.d/setiptables.local
接着,让脚本自动运行,并创建链接。
update-rc.d setiptables.local start 98 2 3 4 5 .
mkdir /etc/rc.d/
ln -s /etc/init.d/setiptables.local /etc/rc.d/rc.local