| Author |
Can't maks shell script excutable!!
|
|
| William Comeau 2004-12-10, 8:45 pm |
| I have the following bash file and I can't make it executable.It is in
dir /etc/rcS.d.
#!/bin/bash
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables=/sbin/iptables
iptables --flush -t nat
iptables --table nat --append POSTROUTING --out-interface ppp0 -j
MASQUERADE
# The following tells to accept the network card information.
iptables --append FORWARD --in-interface eth0 -j ACCEPT
# The following are a basic firewall.
iptables -A INPUT -i ppp0 -m state --state NEW,INVALID -j DROP
iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j DROP
After making the file I right click on the file and select properties
and select " is executable".Reboot the distro (Mepis).Check the file and
it is just a txt file and not executable.Shure would appreciate some
help to solve this problem.
Thanks Kindly,
William
PS.
I made an other bash file and that one worked ok.
| |
| Madhusudan Singh 2004-12-10, 8:45 pm |
| William Comeau wrote:
> I have the following bash file and I can't make it executable.It is in
> dir /etc/rcS.d.
>
> #!/bin/bash
> echo "1" > /proc/sys/net/ipv4/ip_forward
> iptables=/sbin/iptables
> iptables --flush -t nat
> iptables --table nat --append POSTROUTING --out-interface ppp0 -j
> MASQUERADE
> # The following tells to accept the network card information.
> iptables --append FORWARD --in-interface eth0 -j ACCEPT
> # The following are a basic firewall.
> iptables -A INPUT -i ppp0 -m state --state NEW,INVALID -j DROP
> iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j DROP
>
> After making the file I right click on the file and select properties
> and select " is executable".Reboot the distro (Mepis).Check the file and
> it is just a txt file and not executable.Shure would appreciate some
> help to solve this problem.
You do not need to reboot until you are certain that the file is an
executable.
Open a terminal, log in as root using su, chmod +x <bashfilename>. That
should do it.
| |
| William Comeau 2004-12-16, 7:29 pm |
| Madhusudan Singh wrote:
> William Comeau wrote:
>
>
>
>
> You do not need to reboot until you are certain that the file is an
> executable.
>
> Open a terminal, log in as root using su, chmod +x <bashfilename>. That
> should do it.
I cd /etc/rcS.d and at "root" chmod +x S60natstart and it is still the
same.When I put my cursor over the file it says "plain text document"
and "is executable" is checked in properties.
Thanks for trying to help me.
William
| |
| Andy Fraser 2004-12-16, 7:29 pm |
| In alt.os.linux.debian, William Comeau uttered these immortal words:
> I cd /etc/rcS.d and at "root" chmod +x S60natstart and it is still the
> same.When I put my cursor over the file it says "plain text document"
> and "is executable" is checked in properties.
>
> Thanks for trying to help me.
???
You said you wanted it to be executable and have confirmed that the
executable bit is set. There's nothing wrong with it. The output of "ls -l"
would be more useful than posting what some unspecified GUI file manager
says in determining that the executable bit really *is* set.
What were you expecting to see?
--
Andy.
| |
| William Comeau 2004-12-16, 7:29 pm |
| Andy Fraser wrote:
> In alt.os.linux.debian, William Comeau uttered these immortal words:
>
>
>
>
> ???
>
> You said you wanted it to be executable and have confirmed that the
> executable bit is set. There's nothing wrong with it. The output of "ls -l"
> would be more useful than posting what some unspecified GUI file manager
> says in determining that the executable bit really *is* set.
>
> What were you expecting to see?
>
I did a ls -1 and the results below for S60netstart file in dir /ete/rcs.d.
S02mountvirtfs
S05bootlogd
S05keymap.sh
S07hdparm
S10checkroot.sh
S18hwclockfirst.sh
S18ifupdown-clean
S20module-init-tools
S20modutils
S21mepis-auto.sh
S30checkfs.sh
S30etc-setserial
S30procps.sh
S30setserial
S31mepis-pcmcia.sh
S35mountall.sh
S36mountvirtfs
S38pppd-dns
S39ifupdown
S40hostname.sh
S40networking
S45mountnfs.sh
S48console-screen.sh
S50hwclock.sh
S55bootmisc.sh
S55urandom
S60natstart <------Here is the File
S65guarddog
S70xfree86-common
S75sudo
root@6[rcS.d]#
Hope this info will help and thanks for your help.
William
| |
| Andy Fraser 2004-12-16, 7:29 pm |
| In alt.os.linux.debian, William Comeau uttered the immortal words:
>
> I did a ls -1 and the results below for S60netstart file in dir
> /ete/rcs.d.
"ls -l" < lower-case L
not "ls -1" < number one
--
Andy.
| |
| William Comeau 2004-12-16, 7:29 pm |
| Andy Fraser wrote:
> In alt.os.linux.debian, William Comeau uttered the immortal words:
>
>
>
>
> "ls -l" < lower-case L
> not "ls -1" < number one
>
Sorry about that chief,giving you the wrong info doesn't help you or me.
Hope this is the right info.The file is the fourth from the bottom.
root@9[rcS.d]# ls -l
total 8
-rw-r--r-- 1 root root 701 2004-06-09 08:47 README
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S02mountvirtfs ->
.../init.d/mountvirtfs
lrwxrwxrwx 1 root root 18 2004-12-11 19:37 S05bootlogd ->
.../init.d/bootlogd
lrwxrwxrwx 1 root root 19 2004-12-11 19:37 S05keymap.sh ->
.../init.d/keymap.sh
lrwxrwxrwx 1 root root 16 2004-12-11 19:37 S07hdparm -> ../init.d/hdparm
lrwxrwxrwx 1 root root 22 2004-12-11 19:37 S10checkroot.sh ->
.../init.d/checkroot.sh
lrwxrwxrwx 1 root root 25 2004-12-11 19:37 S18hwclockfirst.sh ->
.../init.d/hwclockfirst.sh
lrwxrwxrwx 1 root root 24 2004-12-11 19:37 S18ifupdown-clean ->
.../init.d/ifupdown-clean
lrwxrwxrwx 1 root root 27 2004-12-11 19:37 S20module-init-tools ->
.../init.d/module-init-tools
lrwxrwxrwx 1 root root 18 2004-12-11 19:37 S20modutils ->
.../init.d/modutils
lrwxrwxrwx 1 root root 23 2004-12-11 19:37 S21mepis-auto.sh ->
.../init.d/mepis-auto.sh
lrwxrwxrwx 1 root root 20 2004-12-11 19:37 S30checkfs.sh ->
.../init.d/checkfs.sh
lrwxrwxrwx 1 root root 23 2004-12-11 19:37 S30etc-setserial ->
.../init.d/etc-setserial
lrwxrwxrwx 1 root root 19 2004-12-11 19:37 S30procps.sh ->
.../init.d/procps.sh
lrwxrwxrwx 1 root root 19 2004-12-11 19:37 S30setserial ->
.../init.d/setserial
lrwxrwxrwx 1 root root 27 2004-12-11 19:37 S31mepis-pcmcia.sh ->
/etc/init.d/mepis-pcmcia.sh
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S35mountall.sh ->
.../init.d/mountall.sh
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S36mountvirtfs ->
.../init.d/mountvirtfs
lrwxrwxrwx 1 root root 18 2004-12-11 19:37 S38pppd-dns ->
.../init.d/pppd-dns
lrwxrwxrwx 1 root root 18 2004-12-11 19:37 S39ifupdown ->
.../init.d/ifupdown
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S40hostname.sh ->
.../init.d/hostname.sh
lrwxrwxrwx 1 root root 20 2004-12-11 19:37 S40networking ->
.../init.d/networking
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S45mountnfs.sh ->
.../init.d/mountnfs.sh
lrwxrwxrwx 1 root root 27 2004-12-11 19:37 S48console-screen.sh ->
.../init.d/console-screen.sh
lrwxrwxrwx 1 root root 20 2004-12-11 19:37 S50hwclock.sh ->
.../init.d/hwclock.sh
lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S55bootmisc.sh ->
.../init.d/bootmisc.sh
lrwxrwxrwx 1 root root 17 2004-12-11 19:37 S55urandom -> ../init.d/urandom
-rwxr-xr-x 1 root root 482 2004-12-11 20:20 S60natstart < FILE is here
lrwxrwxrwx 1 root root 18 2004-12-11 19:37 S65guarddog ->
.../init.d/guarddog
lrwxrwxrwx 1 root root 24 2004-12-11 19:37 S70xfree86-common ->
.../init.d/xfree86-common
lrwxrwxrwx 1 root root 14 2004-12-11 19:37 S75sudo -> ../init.d/sudo
root@9[rcS.d]#
Thanks
William
| |
| Andy Fraser 2004-12-16, 7:29 pm |
| In alt.os.linux.debian, William Comeau uttered these immortal words:
>
> Sorry about that chief,giving you the wrong info doesn't help you or me.
It certainly doesn't. :-D
> Hope this is the right info.The file is the fourth from the bottom.
>
> root@9[rcS.d]# ls -l
> total 8
> -rw-r--r-- 1 root root 701 2004-06-09 08:47 README
> lrwxrwxrwx 1 root root 21 2004-12-11 19:37 S02mountvirtfs ->
> ../init.d/mountvirtfs
<Snip other links>
So they're links to files in /etc/init.d. Type "ls
-l /etc/init.d/S60netstart". If you see something like "-rwxr-xr-x" then
the file is executable (as user, group and world in this case) and
everything's fine.
Don't worry about a GUI file manager telling you it's a "Plain text file"
because it is a plain text file that just happens to contain executable
script code. I still don't know what you were expecting to see instead of
"Plain text file".
--
Andy.
| |
| John Hasler 2004-12-16, 7:29 pm |
| The file is there and executable. Now the question is: Why is it there?
That directory should contain only symlinks to files in /etc/init.d.
What is it that you are trying to do?
--
John Hasler
| |
| Andy Fraser 2004-12-16, 7:29 pm |
| In alt.os.linux.debian, John Hasler uttered these immortal words:
> The file is there and executable. Now the question is: Why is it there?
> That directory should contain only symlinks to files in /etc/init.d.
Bollocks, I missed that. :-)
Note to self: stop posting at 1am.
--
Andy.
| |
| William Comeau 2004-12-16, 7:29 pm |
| John Hasler wrote:
> The file is there and executable. Now the question is: Why is it there?
> That directory should contain only symlinks to files in /etc/init.d.
>
> What is it that you are trying to do?
I have two computers using Mepis distros networked together via a
crossover cable.Computer #1 has internet connection via a external USR
modem and I want to be able to have computer #2 access the internet
also.I don't how to do it so someone suggested that I try this bash
program and make it executable
in /etc/rcS.d folder.The folder with the file is called S60natstart.
This is the program.
#!/bin/bash
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables=/sbin/iptables
iptables --flush -t nat
iptables --table nat --append POSTROUTING --out-interface ppp0 -j
MASQUERADE
# The following tells to accept the network card information.
iptables --append FORWARD --in-interface eth0 -j ACCEPT
# The following are a basic firewall.
iptables -A INPUT -i ppp0 -m state --state NEW,INVALID -j DROP
iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j DROP
If I knew what I was doing I would not be asking all these questions.I
would have solved the problem,instead of spending 65 hours now and
counting.I can share files on my network but not internet connection.
I can solve my problem if I want to reinstall Mandrake but I really like
Mepis,it is my first debian distro.
Thanks Kindly,
William
Thanks
|
|
|
|