{"id":1772,"date":"2014-09-27T21:44:49","date_gmt":"2014-09-27T13:44:49","guid":{"rendered":"http:\/\/www.yclimw.com\/?p=1772"},"modified":"2021-05-31T14:08:42","modified_gmt":"2021-05-31T06:08:42","slug":"linux-miscellany","status":"publish","type":"post","link":"https:\/\/www.yclimw.com\/?p=1772","title":{"rendered":"Linux\u6742\u8bb0"},"content":{"rendered":"<p>\u6b64\u5e16\u5b50\u7528\u4e8e\u8bb0\u5f55\u4f7f\u7528Linux\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u5404\u79cd\u5c0f\u95ee\u9898\u3002<\/p>\n<hr \/>\n<p>1\u3001\u4f7f\u7528ln\u547d\u4ee4\u8de8\u5206\u533a\u94fe\u63a5\u76ee\u5f55\u65f6\uff0c\u62a5\u9519\u201c\u76ee\u5f55\u94fe\u63a5\u51fa\u9519\u201d\u3002<\/p>\n<p>\u7b54\uff1a2.4 kernel\u4ee5\u4e0a\uff0c\u53ef\u4ee5\u7528mount &#8211;bind\u547d\u4ee4\u6765\u94fe\u63a5\u3002<\/p>\n<pre class=\"brush:bash;\"> The bind mounts.\n              Since Linux 2.4.0 it is possible to remount  part  of  the  file\n              hierarchy somewhere else. The call is\n                     mount --bind olddir newdir\n              or shortoption\n                     mount -B olddir newdir\n              or fstab entry is:\n                     \/olddir \/newdir none bind\n\n              After  this  call the same contents is accessible in two places.\n              One can also remount a single file (on a single file). It's also\n              possible  to  use  the  bind mount to create a mountpoint from a\n              regular directory, for example:\n\n                     mount --bind foo foo\n\n              The bind mount call attaches only (part of) a single filesystem,\n              not possible submounts. The entire file hierarchy including sub\u2010\n              mounts is attached a second place using\n\n                     mount --rbind olddir newdir\n\n              or shortoption\n                     mount -R olddir newdir\n\n              Note that the filesystem mount options will remain the  same  as\n              those  on  the  original  mount  point, and cannot be changed by\n              passing the -o  option  along  with  --bind\/--rbind.  The  mount\n              options  can be changed by a separate remount command, for exam\u2010\n              ple:\n\n                     mount --bind olddir newdir\n                     mount -o remount,ro newdir\n\n              Note that behavior of  the  remount  operation  depends  on  the\n              \/etc\/mtab  file. The first command stores the 'bind' flag to the\n              \/etc\/mtab file and the second command reads the  flag  from  the\n              file.  If you have a system without the \/etc\/mtab file or if you\n              explicitly define source and  target  for  the  remount  command\n              (then  mount(8)  does  not read \/etc\/mtab), then you have to use\n              bind flag (or option) for the remount command too. For example:\n\n                     mount --bind olddir newdir\n                     mount -o remount,ro,bind olddir newdir<\/pre>\n<hr \/>\n<p><!--more--><\/p>\n<p>2\u3001Linux\u4e0b\u5982\u4f55\u77e5\u9053\u67d0\u4e2a\u7aef\u53e3\u5728\u8fd0\u884c\u4ec0\u4e48\u7a0b\u5e8f\uff1f<\/p>\n<p>\u5f53\u6211\u4eec\u7528netstat -an\u7684\u65f6\u5019\uff0c\u6211\u4eec\u6709\u65f6\u5019\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u7684\u8f93\u51fa\uff1a<\/p>\n<pre class=\"brush:bash;\">udp 0 0 0.0.0.0:32768 0.0.0.0\uff1a*<\/pre>\n<p>\u4f46\u662f\u67e5\u627e\/etc\/services\u53c8\u6ca1\u6709\u8fd9\u4e2a\u7aef\u53e3\u7684\u76f8\u5173\u8bf4\u660e\uff0c\u600e\u4e48\u529e\u5462\uff1f\u8fd9\u4e2a\u662f\u4e0d\u662f\u9ed1\u5ba2\u7a0b\u5e8f\uff1f\u6709\u6ca1\u6709\u529e\u6cd5\u67e5\u770b\u7a76\u7adf\u4ec0\u4e48\u7a0b\u5e8f\u76d1\u542c\u5728\u8fd9\u4e2a\u7aef\u53e3\uff1f<\/p>\n<p>\u4f7f\u7528lsof -i :32768\u5c31\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n<pre class=\"brush:bash;\">COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME\n\nrpc.statd 603 root 4u IPv4 953 UDP *:32768\n\nrpc.statd 603 root 6u IPv4 956 TCP *:32768 (LISTEN)<\/pre>\n<p>&nbsp;<\/p>\n<p>\u539f\u6765\u662frpc\u7684\u7a0b\u5e8f\u3002<\/p>\n<p>\u4f7f\u7528lsof -i :port\u5c31\u80fd\u770b\u89c1\u6240\u6307\u5b9a\u7aef\u53e3\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u540c\u65f6\u8fd8\u6709\u5f53\u524d\u8fde\u63a5\u3002<\/p>\n<hr \/>\n<p>3\u3001Ubuntu\u7f51\u7edc\u8fde\u63a5\u4e2d\uff0cVPN\u8fde\u63a5\u7684\u9009\u9879\u6d88\u5931\uff0c\u65e0\u6cd5\u65b0\u589e\u3001\u4fee\u6539VPN\u8fde\u63a5\uff0cVPN\u9009\u9879\u51fa\u73b0\u4e4b\u540e\uff0c\u8981\u8fdb\u884c\u914d\u7f6e\u63d0\u793a\u201c\u65e0\u6cd5\u627e\u5230\u7528\u4e8e org.freedesktop.NetworkManager.pptp \u7684 VPN \u63d2\u4ef6\u670d\u52a1\u3002\u201d<\/p>\n<pre class=\"brush:bash;\">sudo apt-get install network-manager-openvpn-gnome\nsudo apt-get install network-manager-vpnc-gnome<\/pre>\n<hr \/>\n<p>4\u3001\u6dfb\u52a0\u7528\u6237\u8981\u5df2\u5b58\u5728\u7684\u7ec4<\/p>\n<pre class=\"brush:bash;\">sudo adduser username groupname<\/pre>\n<p>\u9a8c\u8bc1\u7528\u6237\u76f8\u5173\u4fe1\u606f<\/p>\n<pre class=\"brush:bash;\">id username<\/pre>\n<hr \/>\n<p>5\u3001Shell\u4e2d\u6bcf\u6b21\u8bfb\u53d6\u6587\u4ef6\u7684\u4e00\u884c\uff0c\u9010\u884c\u5904\u7406\u3002<\/p>\n<p>#!\/bin\/bash<br \/>\nwhile read line<br \/>\ndo<br \/>\necho $line #\u8fd9\u91cc\u53ef\u6839\u636e\u5b9e\u9645\u7528\u9014\u53d8\u5316<br \/>\ndone &lt; filename #filename \u4e3a\u9700\u8981\u8bfb\u53d6\u7684\u6587\u4ef6\u540d<\/p>\n<p>\u6216\u8005<\/p>\n<p>#!\/bin\/bash<br \/>\ncat filename| while read line #filename \u4e3a\u9700\u8981\u8bfb\u53d6\u7684\u6587\u4ef6\u540d,\u4e5f\u53ef\u4ee5\u653e\u5728\u547d\u4ee4\u884c\u53c2\u6570\u91cc\u3002<br \/>\ndo<br \/>\necho $line<br \/>\ndone<\/p>\n<hr \/>\n<p>fastcgi\u95ee\u9898<\/p>\n<p>\uff08111:connection refused\u2026\u2026<\/p>\n<p>\/usr\/bin\/spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f \/usr\/bin\/php-cgi<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b64\u5e16\u5b50\u7528\u4e8e\u8bb0\u5f55\u4f7f\u7528Linux\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u5404\u79cd\u5c0f\u95ee\u9898\u3002 1\u3001\u4f7f\u7528ln\u547d\u4ee4\u8de8\u5206\u533a\u94fe\u63a5\u76ee\u5f55\u65f6\uff0c\u62a5\u9519\u201c\u76ee\u5f55\u94fe\u63a5\u51fa\u9519\u201d\u3002 &hellip; <a href=\"https:\/\/www.yclimw.com\/?p=1772\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Linux\u6742\u8bb0<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,12],"tags":[283,218,219,321,215,220,221],"class_list":["post-1772","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-","tag-linux-","tag-ln","tag-mount","tag-shell","tag-ubuntu","tag-220","tag-221"],"_links":{"self":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/1772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1772"}],"version-history":[{"count":5,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/1772\/revisions"}],"predecessor-version":[{"id":2540,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/1772\/revisions\/2540"}],"wp:attachment":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}