{"id":195,"date":"2014-12-26T16:56:29","date_gmt":"2014-12-26T08:56:29","guid":{"rendered":"http:\/\/blog.haostudio.net\/hwp\/?p=195"},"modified":"2017-07-25T00:12:50","modified_gmt":"2017-07-24T16:12:50","slug":"cc-a80-%e6%9d%bf%e5%ad%90%e7%9a%84%e6%80%aa%e5%95%8f%e9%a1%8c-%e5%8f%aa%e6%9c%89root%e5%8f%af%e4%bb%a5%e7%99%bb%e5%85%a5-%e5%85%b6%e4%bb%96%e4%bd%bf%e7%94%a8%e8%80%85%e7%84%a1%e6%b3%95%e7%99%bb","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/cc-a80-%e6%9d%bf%e5%ad%90%e7%9a%84%e6%80%aa%e5%95%8f%e9%a1%8c-%e5%8f%aa%e6%9c%89root%e5%8f%af%e4%bb%a5%e7%99%bb%e5%85%a5-%e5%85%b6%e4%bb%96%e4%bd%bf%e7%94%a8%e8%80%85%e7%84%a1%e6%b3%95%e7%99%bb\/","title":{"rendered":"CC-A80 \u677f\u5b50\u7684\u602a\u554f\u984c: \u53ea\u6709root\u53ef\u4ee5\u767b\u5165, \u5176\u4ed6\u4f7f\u7528\u8005\u7121\u6cd5\u767b\u5165"},"content":{"rendered":"<!--more-->\n<h1>CC-A80 \u677f\u5b50\u7684\u602a\u554f\u984c: \u53ea\u6709root\u53ef\u4ee5\u767b\u5165, \u5176\u4ed6\u4f7f\u7528\u8005\u7121\u6cd5\u767b\u5165<\/h1>\n<h2>\u767c\u751f\u73fe\u8c61<\/h2>\n<p>\u6700\u8fd1\u628a\u525b\u525b\u88dd\u597dDebian \u7cfb\u7d71\u7684<a href=\"http:\/\/blog.haostudio.net\/hwp\/%E6%96%B0%E7%8E%A9%E5%85%B7%E5%88%B0%E6%89%8B%E4%BA%86-arm-%E9%96%8B%E7%99%BC%E6%9D%BF-cc-a80\/\">CC-A80<\/a> \u677f\u5b50\u62ff\u4f86\u4f7f\u7528, \u4e00\u958b\u59cb, \u7528root \u767b\u5165, \u4f7f\u7528\u4e00\u5207\u90fd\u6c92\u554f\u984c, \u4f46\u662f\u5728\u65b0\u589e\u4e00\u500b\u4e00\u822cuser account\u5f8c, \u7528ssh \u7adf\u7136\u767c\u73fe\u7121\u6cd5\u767b\u5165, \u73fe\u8c61\u5982\u4e0b:<\/p>\n<pre><code>$ ssh testuser@192.168.1.1\ntestuser@192.168.1.1&#039;s password: \nLinux bsms 3.4.39 #1 SMP PREEMPT Thu Dec 25 17:06:42 CST 2014 armv7l\n\nThe programs included with the Debian GNU\/Linux system are free software;\nthe exact distribution terms for each program are described in the\nindividual files in \/usr\/share\/doc\/*\/copyright.\n\nDebian GNU\/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\npermitted by applicable law.\nLast login: Fri Dec 26 07:34:05 2014 from 192.168.1.2\nConnection to 192.168.1.1 closed.\n$\n<\/code><\/pre>\n<p>\u5f9e\u4e0a\u9762\u73fe\u8c61\u770b\u4f86, \u5df2\u7d93\u9023\u4e0aCC-A80 \u677f\u5b50\u4e86, \u4f46\u662f\u537b\u7a81\u7136\u9593\u65b7\u7dda\u4e86.<\/p>\n<p>\u7528root \u9023\u4e0aCC-A80 \u677f\u5b50\u4e0a, \u67e5\u770b\/var\/log\/auth.log, \u5982\u4e0b<\/p>\n<pre><code>root@cb4-work:~# cat \/var\/log\/auth.log \n..\u524d\u7565\nDec 26 08:04:49 cb4-work sshd[3184]: Accepted password for haoadmin from 192.168.1.2 port 64770 ssh2\nDec 26 08:04:49 cb4-work sshd[3184]: pam_unix(sshd:session): session opened for user testuserby (uid=0)\nDec 26 08:04:49 cb4-work sshd[3186]: Received disconnect from 192.168.1.2: 11: disconnected by user\nDec 26 08:04:49 cb4-work sshd[3184]: pam_unix(sshd:session): session closed for user testuser\nroot@cb4-work:~# \n<\/code><\/pre>\n<p>\u770b\u4f86, \u7684\u78ba\u5df2\u7d93\u901a\u904epam_unix \u90a3\u95dc, \u5728\u9032\u5165shell \u4e4b\u524d, \u4f46\u662f\u537b\u7a81\u7136\u9593\u88ab\u65b7\u7dda\u4e86.<\/p>\n<p>\u67e5\u904e\u8a31\u591a\u5730\u65b9, \u50cf\u662fuser account \u7684\u5efa\u7acb, shell \u662f\u5426ok, \u4ee5\u53caroot filesystem.  \u4e00\u6a21\u4e00\u6a23\u7684\u6771\u897f \u653e\u5728\u6211\u7684CubieTruck \u677f\u5b50\u90fdok, \u4f46\u662f\u504f\u504f\u5728CC-A80 \u4e0a\u537b\u6709\u554f\u984c, \u56e0\u6b64\u6211\u628a\u65b9\u5411\u671d\u5411linux kernel \u4e0a\u4f86\u67e5.<\/p>\n<h2>\u554f\u984c\u6240\u5728<\/h2>\n<p>\u67e5\u4e86\u8a31\u4e45, \u5728\u7db2\u8def\u4e0a\u770b\u5230\u9019\u7bc7\u6587\u7ae0<a href=\"http:\/\/stackoverflow.com\/questions\/12550779\/only-root-can-login-possible-reasons\">&#8220;Only root can login. Possible reasons? &#8220;<\/a> , \u60f3\u8aaa, \u4ed6\u7684\u554f\u984c\u8ddf\u6211\u597d\u50cf. \u65bc\u662f\u5728CC-A80 \u4e2d\u57f7\u884c\u5982\u4e0b\u6307\u4ee4\u67e5\u770bvm.mmap&#095;min&#095;addr \u7684\u503c:<\/p>\n<pre><code>root@cb4-work:~# sysctl -a | grep vm.mmap_min_addr\nvm.mmap_min_addr = 65536\n<\/code><\/pre>\n<p>\u5c07\u5176\u6539\u70ba4096<\/p>\n<pre><code>root@cb4-work:~# sysctl -w vm.mmap_min_addr=&quot;4096&quot;\nvm.mmap_min_addr = 4096\n<\/code><\/pre>\n<p>\u7136\u5f8c\u518d\u6e2c\u8a66<\/p>\n<pre><code>$ ssh testuser@192.168.1.1\ntestuser@192.168.1.1&#039;s password: \nLinux bsms 3.4.39 #1 SMP PREEMPT Thu Dec 25 17:06:42 CST 2014 armv7l\n\nThe programs included with the Debian GNU\/Linux system are free software;\nthe exact distribution terms for each program are described in the\nindividual files in \/usr\/share\/doc\/*\/copyright.\n\nDebian GNU\/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\npermitted by applicable law.\nLast login: Fri Dec 26 07:34:05 2014 from 192.168.1.2\ntestuser@cb4-work:~$ \n<\/code><\/pre>\n<p>\u679c\u7136\u53ef\u4ee5\u767b\u5165\u4e86.<\/p>\n<h2>\u89e3\u6c7a\u65b9\u6cd5<\/h2>\n<p>\u65e2\u7136\u77e5\u9053\u554f\u984c\u6240\u5728, \u89e3\u6cd5\u5c31\u5bb9\u6613\u4e86, \u6709\u5169\u7a2e\u89e3\u6cd5<\/p>\n<p>\u65b9\u6cd5\u4e00: \u662f\u5728compile kernel \u6307\u5b9aCONFIG&#095;DEFAULT&#095;MMAP&#095;MIN&#095;ADDR\u7684\u503c.\n\u6211\u770b\u4e86\u4e00\u4e0b\u6211\u7684CC-A80 linux kernel config file, \u767c\u73feMMAP&#095;MIN&#095;ADDR \u7684\u539f\u8a2d\u5b9a\u5982\u4e0b:<\/p>\n<pre><code>CONFIG_DEFAULT_MMAP_MIN_ADDR=65536\n<\/code><\/pre>\n<p>\u5c07\u9019\u884c\u522a\u9664\u8b93\u5176\u4f7f\u7528\u5167\u5b9a\u503c, \u4e00\u822c\u5167\u5b9a\u503c\u662f4096, \u6216\u8005\u662f\u81ea\u5df1\u5f37\u5236\u8a2d\u62104096 \u90fd\u53ef\u4ee5<\/p>\n<pre><code>CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n<\/code><\/pre>\n<p>\u7136\u5f8c\u91cd\u65b0\u7de8\u8b6fkenel \u5c31\u597d\u4e86.<\/p>\n<p>\u65b9\u6cd5\u4e8c:\n\u82e5\u4f60\u7121\u6cd5\u91cd\u65b0\u7de8\u8b6fkernel, \u4e5f\u53ef\u4ee5\u5728\u7cfb\u7d71\u555f\u52d5\u6642, \u52d5\u614b\u4fee\u6539vm.mmap&#095;min&#095;addr \u7684\u503c, \u65b9\u6cd5\u5982\u4e0b:<\/p>\n<pre><code># echo &quot;vm.mmap_min_addr = 4096&quot; &gt; \/etc\/sysctl.d\/mmap_min_addr.conf\n<\/code><\/pre>\n<p>\u7136\u5f8c\u91cd\u958b\u6a5f\u5373\u53ef.<\/p>\n<p>\u4e0d\u7136\u4e5f\u53ef\u4ee5\u91cd\u555fprocps service<\/p>\n<pre><code># \/etc\/init.d\/procps restart\n<\/code><\/pre>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u96d6\u8aaa\u5df2\u7d93\u89e3\u6c7a\u554f\u984c, \u4f46\u662f\u70ba\u4f55\u8a2d\u621065536 \u6703\u9020\u6210\u5982\u6b64\u7684\u73fe\u8c61, \u6211\u4e5f\u641e\u4e0d\u61c2..\u7db2\u8def\u4e0a\u4e5f\u6c92\u67e5\u5230\u8cc7\u6599, \u53ea\u80fd\u5148\u628a\u9019\u4e8b\u4ef6\u8a18\u4e0b\u4f86, \u7b49\u4ee5\u5f8c\u6709\u6a5f\u6703\u518d\u6df1\u5165\u4e86\u89e3\u56c9.<\/p>\n<hr \/>\n<h3>\u53c3\u8003\u8cc7\u6599:<\/h3>\n<ol>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/12550779\/only-root-can-login-possible-reasons\">Only root can login. Possible reasons? <\/a><\/li>\n<li><a href=\"https:\/\/wiki.debian.org\/mmap_min_addr\">mmap_min_addr<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,2],"tags":[72,11,70,71,69],"class_list":["post-195","post","type-post","status-publish","format-standard","hentry","category-embedded-system","category-linux","tag-cc-a80","tag-cubieboard","tag-kernel-config","tag-login","tag-sysctl"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":7,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":396,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/195\/revisions\/396"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}