<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Howto Make Script More Portable With #!/usr/bin/env As a Shebang</title> <atom:link href="http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: someone</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-173257</link> <dc:creator>someone</dc:creator> <pubDate>Sat, 13 Aug 2011 19:01:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-173257</guid> <description>Even the official python tutorial website is using:
#! /usr/bin/env python
http://docs.python.org/tutorial/interpreter.html</description> <content:encoded><![CDATA[<p>Even the official python tutorial website is using:<br
/> #! /usr/bin/env python<br
/> <a
href="http://docs.python.org/tutorial/interpreter.html" rel="nofollow">http://docs.python.org/tutorial/interpreter.html</a></p> ]]></content:encoded> </item> <item><title>By: robsku</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-164148</link> <dc:creator>robsku</dc:creator> <pubDate>Fri, 17 Dec 2010 23:29:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-164148</guid> <description>@Terrible
You could be correct, but I&#039;d like to hear your opinion of why exactly is it more harmful?
Well, it runs the command, perl for example, like you would run perl by hand - so I assume it searches via PATH - I can see that individual user may then create executable &#039;perl&#039; of his own under his home directory and change PATH so that env will call that... However that already means that user in question is doing this on purpose, in which case he could just call the harmful program himself - no need to even include the script, perl nor env on that and if done that way it would not affect other users which would still get to run the script as intended.
However security and holes in it can be complex issues and I&#039;m not a professional at all... If indeed using env is more of a possible security issue than creating shebang pointing right to correct interpreter in install routine I would love to learn why exactly is it safer, about possible security issues in using env, etc.
I would think that when installed system wide both ways would be as safe - and one trying to do harm could install the whole software locally under his home directory anyway but could not alter what is ran when other users call the script in question - not understanding makes me even more curious, but most importantly I want to ensure security...</description> <content:encoded><![CDATA[<p>@Terrible<br
/> You could be correct, but I&#8217;d like to hear your opinion of why exactly is it more harmful?</p><p>Well, it runs the command, perl for example, like you would run perl by hand &#8211; so I assume it searches via PATH &#8211; I can see that individual user may then create executable &#8216;perl&#8217; of his own under his home directory and change PATH so that env will call that&#8230; However that already means that user in question is doing this on purpose, in which case he could just call the harmful program himself &#8211; no need to even include the script, perl nor env on that and if done that way it would not affect other users which would still get to run the script as intended.</p><p>However security and holes in it can be complex issues and I&#8217;m not a professional at all&#8230; If indeed using env is more of a possible security issue than creating shebang pointing right to correct interpreter in install routine I would love to learn why exactly is it safer, about possible security issues in using env, etc.<br
/> I would think that when installed system wide both ways would be as safe &#8211; and one trying to do harm could install the whole software locally under his home directory anyway but could not alter what is ran when other users call the script in question &#8211; not understanding makes me even more curious, but most importantly I want to ensure security&#8230;</p> ]]></content:encoded> </item> <item><title>By: Terrible</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-146918</link> <dc:creator>Terrible</dc:creator> <pubDate>Mon, 26 Jan 2009 22:00:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-146918</guid> <description>Terrible advice.  Do not do this.  Portability should stem from your installion routines, not some security and design problem causing hack.</description> <content:encoded><![CDATA[<p>Terrible advice.  Do not do this.  Portability should stem from your installion routines, not some security and design problem causing hack.</p> ]]></content:encoded> </item> <item><title>By: Carsten</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-146686</link> <dc:creator>Carsten</dc:creator> <pubDate>Wed, 14 Jan 2009 08:45:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-146686</guid> <description>I do not feel very comfortable with the security aspects of this hack.
It may be more portable but it reduces control.
Bash and other shells are hardened so that they can be used for admin jobs withstanding tampering efforts by non root users.
Using the described  &quot;env&quot; solution may introduce vulnerabilities which are difficult to oversee or analyze.
Instead of linking env and using it to deal with compatibity I rather add compatibility links to my systems which link bash or perl to a uniform location e.g. ln -s /usr/local/bin/bash /bin/bash</description> <content:encoded><![CDATA[<p>I do not feel very comfortable with the security aspects of this hack.<br
/> It may be more portable but it reduces control.<br
/> Bash and other shells are hardened so that they can be used for admin jobs withstanding tampering efforts by non root users.<br
/> Using the described  &#8220;env&#8221; solution may introduce vulnerabilities which are difficult to oversee or analyze.<br
/> Instead of linking env and using it to deal with compatibity I rather add compatibility links to my systems which link bash or perl to a uniform location e.g. ln -s /usr/local/bin/bash /bin/bash</p> ]]></content:encoded> </item> <item><title>By: vivek</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-141020</link> <dc:creator>vivek</dc:creator> <pubDate>Thu, 06 Sep 2007 09:44:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-141020</guid> <description>You can pass /bin/path/to/mybinary -w</description> <content:encoded><![CDATA[<p>You can pass /bin/path/to/mybinary -w</p> ]]></content:encoded> </item> <item><title>By: IHar Filipau</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-140663</link> <dc:creator>IHar Filipau</dc:creator> <pubDate>Thu, 02 Aug 2007 08:07:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-140663</guid> <description>The only problem I have with env, that on some systems lacking &#039;use warnings&#039;, I can&#039;t pass &#039;-w&#039; on command line. Or is it possible somehow?</description> <content:encoded><![CDATA[<p>The only problem I have with env, that on some systems lacking &#8216;use warnings&#8217;, I can&#8217;t pass &#8216;-w&#8217; on command line. Or is it possible somehow?</p> ]]></content:encoded> </item> <item><title>By: nag</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-140466</link> <dc:creator>nag</dc:creator> <pubDate>Thu, 12 Jul 2007 21:43:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-140466</guid> <description>Thanks for &quot;shebang&quot; and its explanation. Its really helpful.</description> <content:encoded><![CDATA[<p>Thanks for &#8220;shebang&#8221; and its explanation. Its really helpful.</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-84270</link> <dc:creator>nixcraft</dc:creator> <pubDate>Wed, 07 Mar 2007 16:27:25 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-84270</guid> <description>If you move from Linux distro to BSD you will see bash is located at /usr/local/bin/bash OR to Solaris you will see bash at /opt or some other location. Instead of adjusting all the location admin can create a /usr/bin/env softlink and problem solved. Just imagine you have 100s of shell and perl scripts...
This is not just about Linux. It is about running a script under different UNIX like oses.</description> <content:encoded><![CDATA[<p>If you move from Linux distro to BSD you will see bash is located at /usr/local/bin/bash OR to Solaris you will see bash at /opt or some other location. Instead of adjusting all the location admin can create a /usr/bin/env softlink and problem solved. Just imagine you have 100s of shell and perl scripts&#8230;</p><p>This is not just about Linux. It is about running a script under different UNIX like oses.</p> ]]></content:encoded> </item> <item><title>By: bhaskar</title><link>http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-84191</link> <dc:creator>bhaskar</dc:creator> <pubDate>Wed, 07 Mar 2007 15:15:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html#comment-84191</guid> <description>I am confused.
Why is /usr/bin/env more portable than /bin/bash.
Besides on most linux distros bash is found in /bin, but env is not guaranteed to be found under /usr/bin.
e.g. in my case (FC5) env is under /bin.
My point is , which ever way you need to know the absolute path to either env, or bash, so why bother ?</description> <content:encoded><![CDATA[<p>I am confused.<br
/> Why is /usr/bin/env more portable than /bin/bash.<br
/> Besides on most linux distros bash is found in /bin, but env is not guaranteed to be found under /usr/bin.<br
/> e.g. in my case (FC5) env is under /bin.<br
/> My point is , which ever way you need to know the absolute path to either env, or bash, so why bother ?</p> ]]></content:encoded> </item> </channel> </rss>
