{"id":177,"date":"2008-02-18T21:06:42","date_gmt":"2008-02-19T02:06:42","guid":{"rendered":"http:\/\/bitpost.com\/news\/2008\/02\/18\/sudo-is-useless\/"},"modified":"2008-02-29T10:16:29","modified_gmt":"2008-02-29T15:16:29","slug":"sudo-is-useless","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2008\/sudo-is-useless\/","title":{"rendered":"sudo is useless&#8230;"},"content":{"rendered":"<p>sudo does all this crap &#8220;to remain secure&#8221;:<\/p>\n<pre><code>Variables that control how dynamic loading and binding is done can be used to subvert the program that sudo runs.  To combat this the LD_*, _RLD_*, SHLIB_PATH (HP-UX only), and LIBPATH (AIX only) environment variables are removed from the environment passed on to all commands executed.  sudo will also remove the IFS, CDPATH, ENV, BASH_ENV, KRB_CONF, KRBCONFDIR, KRBTKFILE, KRB5_CONFIG, LOCALDOMAIN, RES_OPTIONS, HOSTALIASES, NLSPATH, PATH_LOCALE, TERMINFO, TERMINFO_DIRS and TERMPATH variables as they too can pose a threat.<\/code><\/pre>\n<p>What a useless waste of time.  As the man page says:<\/p>\n<pre><code>There is no easy way to prevent a user from gaining a root shell if that user is allowed to run arbitrary commands via sudo.<\/code><\/pre>\n<p>So what&#8217;s the *(%#@&#038;#$ use of crippling the environment?  I&#8217;ve been trying to get a successful root-initiated [make install] going from a user-initiated script file, and sudo has wasted my time.  [su] to the rescue.  This will use your proper root environment:<\/p>\n<pre><code>su -c \"make install\" -<\/code><\/pre>\n<p>The down sides are that you&#8217;ll be prompted for your password every time you call su, and you have to use the root password.  But sudo is worthless.<\/p>\n<p>\/rant<\/p>\n<p>UPDATE: [su] is no better.  I lied, you still won&#8217;t get your full environment.  The only solution is to actually RUN your shell environment scripts yourself from a batch file that you execute with -c.  Live and learn.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>sudo does all this crap &#8220;to remain secure&#8221;: Variables that control how dynamic loading and binding is done can be used to subvert the program that sudo runs. To combat this the LD_*, _RLD_*, SHLIB_PATH (HP-UX only), and LIBPATH (AIX only) environment variables are removed from the environment passed on to all commands executed. sudo [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[10,2],"tags":[],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-tricks-tips-tools","category-chatter"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-2R","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":0,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}