Unix Technical Forum

Can't maks shell script excutable!!

This is a discussion on Can't maks shell script excutable!! within the Debian Linux support forums, part of the Debian Linux category; --> I have the following bash file and I can't make it executable.It is in dir /etc/rcS.d. #!/bin/bash echo "1" ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 06:39 AM
William Comeau
 
Posts: n/a
Default Can't maks shell script excutable!!

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 06:39 AM
Madhusudan Singh
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 06:39 AM
William Comeau
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

Madhusudan Singh wrote:
> 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.


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 06:39 AM
Andy Fraser
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 06:39 AM
William Comeau
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

Andy Fraser wrote:
> 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?
>


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-19-2008, 06:39 AM
Andy Fraser
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

In alt.os.linux.debian, William Comeau uttered the 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.


"ls -l" < lower-case L
not "ls -1" < number one

--
Andy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-19-2008, 06:39 AM
William Comeau
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

Andy Fraser wrote:
> In alt.os.linux.debian, William Comeau uttered the 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.

>
>
> "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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-19-2008, 06:39 AM
Andy Fraser
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

In alt.os.linux.debian, William Comeau uttered these 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
>>

>
> 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-19-2008, 06:39 AM
John Hasler
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-19-2008, 06:39 AM
Andy Fraser
 
Posts: n/a
Default Re: Can't maks shell script excutable!!

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com