{"id":1064,"date":"2018-10-26T16:32:50","date_gmt":"2018-10-26T08:32:50","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=1064"},"modified":"2018-10-26T16:32:50","modified_gmt":"2018-10-26T08:32:50","slug":"rbash%e9%99%90%e5%88%b6%e7%9a%84-bash","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=1064","title":{"rendered":"rbash\u9650\u5236\u7684 bash"},"content":{"rendered":"<div class=\"ad_r\">\n<div id=\"BAIDU_SSP__wrapper_u1788635_0\"><\/div>\n<\/div>\n<div id=\"article_content\" class=\"article_content\">\n<p>rbash(restricted bash)\uff0c\u5373\u53d7\u9650\u5236\u7684 bash\uff0c\u5bf9\u4e8e\u7528\u4f5c\u4e2d\u8f6c\u670d\u52a1\u5668\uff0c\u8fd8\u662f\u5f88\u4e0d\u9519\u6ef4\u3002<\/p>\n<p>rbash \u652f\u6301 debian \u4ee5\u53ca rh\u3002rbash \u53ea\u662f bash \u7684\u4e00\u4e2a\u8f6f\u94fe\u63a5\u3002\u9664\u4e86\u8fd9\u91cc\u63d0\u5230\u7684\u51e0\u4e2a\u65b9\u9762\u4e4b\u5916\uff0c\u5b83\u8ddf<br \/>\nbash \u4e00\u6837\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre>* changing directories with cd\n* setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV\n* specifying command names containing \/\n* specifying a file name containing a \/ as an argument to the . builtin command\n* Specifying a filename containing a slash as an argument to the -p option to the hash builtin command\n* importing function definitions from the shell environment at startup\n* parsing the value of SHELLOPTS from the shell environment at startup\n* redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators\n* using the exec builtin command to replace the shell with another command\n* adding or deleting builtin commands with the -f and -d options to the enable builtin command\n* Using the enable builtin command to enable disabled shell builtins\n* specifying the -p option to the command builtin command\n* turning off restricted mode with set +r or set +o restricted.\n<\/pre>\n<p>\u5229\u7528\u4ee5\u4e0a\u8fd9\u4e9b\u7279\u6027\uff0c\u7528\u4e8e\u4e2d\u8f6c\u670d\u52a1\u5668\uff0c\u9650\u5236\u7528\u6237\u4f7f\u7528\u5176\u4ed6\u547d\u4ee4\uff01<\/p>\n<p>\u76ee\u7684\uff1a\u7528\u6237\u53ea\u80fd\u4f7f\u7528ssh\u547d\u4ee4\uff0c\u5176\u4f59\u547d\u4ee4(\u5185\u7f6e\u547d\u4ee4\u9664\u5916)\u90fd\u4e0d\u80fd\u4f7f\u7528\u3002<\/p>\n<p>\u8fc7\u7a0b\uff1a<\/p>\n<pre>ln -s \/bin\/bash \/bin\/rbash\nadduser test -s \/bin\/rbash -d \/home\n\u968f\u4fbf\u62ff\u4e00\u4e2a\u7528\u6237\u7684.bashrc\u81f3\/home\n\u7cfb\u7edf\u9ed8\u8ba4\u7684$PATH\u53d8\u91cf\u5b9a\u4e49\u53d6\u6d88\uff0c\u5b9a\u4e49\u81ea\u5df1\u7684$PATH\necho \u201cexport PATH=\/home\/rbin\u201d &gt;&gt; \/home\/.bash_profile\nmkdir \/home\/rbin\nchown -R root.root .bashrc .bash_profile\nchmod 644 .bash_profile .bashrc\n\n\u8ba9\u7528\u6237\u4f7f\u7528ssh\u547d\u4ee4\uff0c\u52a0\u4e2a\u8f6f\u94fe\u63a5\uff0c\u5176\u4f59\u7684\u540c\u7406\uff1a\nln -s \/usr\/bin\/ssh \/home\/rbin\/ssh<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>rbash(restricted bash)\uff0c\u5373\u53d7\u9650\u5236\u7684 bash\uff0c\u5bf9\u4e8e\u7528\u4f5c\u4e2d\u8f6c\u670d\u52a1\u5668\uff0c\u8fd8\u662f\u5f88\u4e0d\u9519\u6ef4\u3002 rbash \u652f\u6301 debian \u4ee5\u53ca rh\u3002rbash \u53ea\u662f bash \u7684\u4e00\u4e2a\u8f6f\u94fe\u63a5\u3002\u9664\u4e86\u8fd9\u91cc\u63d0\u5230\u7684\u51e0\u4e2a\u65b9\u9762\u4e4b\u5916\uff0c\u5b83\u8ddf bash \u4e00\u6837\u3002 &nbsp; * changing directories with cd * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1064","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1064"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1064\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}