User Tools

Site Tools


protected:member:data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
protected:member:data [2016/08/22 05:58] – dirtyprotected:member:data [2016/09/21 09:32] (current) – removed dirty
Line 1: Line 1:
-====== Linux server ====== 
-  *增加使用者建議使用 adduser較useradd為佳 會自動設定目錄 密碼 以及shell(自動複製.bashrc) 
-  *vi /etc/passwd 改使用者剛進去的位置, ex:課堂上的使用者xx 把/home/xx 改成 /home/mlb/xx , 再把home底下的xx資料夾mv 到mlb底下 
-  *在/home改權限, 讓其他使用者無法在妳的資料夾ls : chmod 711 xx 
-  *刪除使用者建議使用 deluser 或 userdel -r 可依並刪除目錄 
-  *將A使用者加入B Group: gpasswd -a A B 
-  *新增使用者並設定UID GID (為了符合mount 硬碟內資料的權限) 
-<code>sudo adduser --uid 1011 --gid 1000 --home /homeL/guy --shell /bin/bash</code> 
-  *新增apt source list 
-<code>sudo vi /etc/apt/sources.list</code> 
-  *至[[https://launchpad.net/ubuntu/+mirror/free.nchc.org.tw-archive|NCHC]]網頁中間部分選擇ubuntu版本 
-   複製(ex.) 
-<code>deb http://free.nchc.org.tw/ubuntu/ lucid main  
-deb-src http://free.nchc.org.tw/ubuntu/ lucid main </code> 
-貼上至sources.list最末行,即完成增加更新主機列表的動作 
  
-  *改sudo權限的使用者 
-<code>sudo vi /etc/sudoers</code> 
-======NIS+NFS====== 
-[[https://help.ubuntu.com/community/SettingUpNISHowTo|SettingUpNISHowTo]]\\ 
-[[https://help.ubuntu.com/community/SettingUpNFSHowTo|SettingUpNFSHowTo]]\\ 
-[[http://ljhuang.pixnet.net/blog/category/1362152/3|中文參考-隨手亂記]]\\ 
-[[private:zzhowzz:note:NIS|NIS]] 
-=====client===== 
-  *HDD / 30G swap 8G /local_home remain\\ 
-使用者名稱mbi 密碼\\ 
--再編輯resolv.conf (應該不用,如果是從終端機就要再這邊設定)\\ 
-  *(9.04)更新語言包 (左上角那邊找一下)\\ 
-  *更新套件 (進入終端機案crtl+alt+f1),ctrl+alt+f7可以切換回圖形介面\\ 
-  *設定網路 \\ 
-**更新ubnuntu** 
-  -先隨便連一個網路\\ 
-  -apt-get update\\ 
-  -apt-get upgrade\\ 
-  -重新設定網路,\\ 
-    *ip = 192.168.1.2(01+1)(後面的電腦 如果是merry01)\\ 
-    *mask = 255.255.255.0\\ 
-    *gateway = 192.168.1.1\\ 
-    *dns = 140.116.72.14\\ 
-  -連到接到merry的區網\\ 
-  *安裝NIS\\ 
-  -apt-get install portmap nis --> fail  一次裝好protmap(nis nfs的協定) nis\\ 
-  -sudo vi /etc/yp.confg 改ypserver 192.168.1.1 
-  -ypserver merry(不知要步要 ㄏ) 
-  -sudo domainname merry 
-  -sudo make -C /var/yp 
-  -sudo service portmap restart 
-  -sudo /etc/init.d/nis restart (不成功也沒差) 
-  -重開機, 可以先確定一下vi順不順 
--clinet 端 (設在後面的電腦)\\ 
-**以下步驟要確定vi很順,不然會無法重開機且失敗機率很高。如果真的不順就重開機或重灌吧。** 
-  -sudo vi /etc/passwd 加上+:::::: (指令'rpcinfo -p [hosts]':rpc 為協定,這個可以看rpc協定打開的port) (sudo vi,通常都是加在檔案的最下面)\\ 
-  -sudo vi /etc/group 加上+:::\\ 
-  -sudo vi /etc/shadow 加上+::::::::   \\ 
-  -sudo vi /etc/nsswitch.conf (sudo vi)\\ 
-    *passwd:  compat nis\\ 
-    *group:   compat nis\\ 
-    *shadow:  compat nis\\ 
-    *hosts:   (....略) nis\\ 
-  -在/etc/resolv.conf設nameserver(就是設定dns:140.116.72.14)  \\ 
-  -/etc/init.d/portmap restart\\ 
-  -/etc/init.d/nis restart(如果成功很快就OK)\\ 
-  -ypwhich  (測試nis是否成功,成功就會出現merry,rpcinfo -p 應該會有ypbind)\\ 
-  -sudo aptitude install openssh-server(裝這個才可以ssh) 
--server 端  (設在merry,基本上應該已經設好了,除非電腦真的太多了,才有可能要新增) \\ 
-  vi /etc/ypserv.securenets\\ 
-  (加入)host 192.168.1.x (client ip)\\ 
-  -make -C /var/yp (如果今天有新增使用者,那個使用者馬上就想要到後面的電腦來用的話,有時候沒有辦法用的情形的話,那這個時候就要執行這個程式看看)\\ 
-  *安裝NFS (又跑回client端了!!)\\ 
-  apt-get install nfs-common\\ 
-  mount -t nfs 192.168.1.1:/home /home \\ 
-  *自動掛載/home目錄\\ 
-sudo apt-get install autofs (如此一來重開機才可以看到home)\\ 
-vi /etc/auto.master \\ 
-最下面加 \\ 
-/home /etc/auto.home   (home 代表home目錄)\\ 
-vi /etc/auto.home     \\ 
-* 192.168.1.1:/home/&  (新增此行)\\ 
-  *clone 到其他台   (如果是複製硬碟之後才要改以下的東西)\\ 
-  -改host名字\\ 
-  -vi /etc/hostname\\ 
-  -vi /etc/hosts\\ 
-      127.0.1.1  [hosts]\\ 
-  -vi /etc/udev/rules.d/70-persistent-net.rules 將PCI device底下的都刪除\\ 
-  重開 設定網路 (把IP 改成正確的)\\ 
-  -mount -t nfs 192.168.1.1:/home /home\\ 
-  *開機帳號因為沒有nfs的空間所以無法登入\\ 
-  -vi /etc/auto.master\\ 
-  -banner /home..... \\ 
-  *ubuntu 沒有chkconfig \\ 
-apt-get install sysv-rc-conf\\ 
- 
-====== Apache2 ====== 
-===== 更改www-data使用者 ===== 
-先建立一新使用者www-user, 更改/etc/apache2/envvars, 改成 
-<code> 
-export APACHE_RUN_USER=www-user 
-export APACHE_RUN_GROUP=www-user 
-</code>再重開apache2即可 
-===== Apache2 基本操作 ===== 
-啟動Apache server 
-<code>sudo /etc/init.d/apache2 start</code> 
-停止Apache server 
-<code>sudo /etc/init.d/apache2 stop</code> 
-重啟動Apache server 
-<code>sudo /etc/init.d/apache2 restart</code> 
-===== 使系統上所有使用者都擁有自己的個人網頁 ===== 
-<code> 
-cd /etc/apache2/mod-enabled/ 
-ln -s ../mods-available/userdir.conf userdir.conf 
-ln -s ../mods-available/userdir.load userdir.load 
-</code> 
-===== 禁止瀏覽目錄 ===== 
-<code>sudo vim /etc/apache2/sites-avaiable/default</code> 
-將原指令 
-<code> 
-<Directory /var/www> 
-Options Indexes FollowSymLinks MultiViews 
-</code> 
-改成 
-<code> 
-<Directory /var/www> 
-Options -Indexes FollowSymLinks MultiViews 
-</code> 
-以及 
-<code>sudo vim /etc/apache2/mods-available/userdir.conf</code> 
-<code> 
-<Directory /home/*/public_html> 
-AllowOverride FileInfo AuthConfig Limit 
-</Directory> 
-改成 
-<Directory /home/*/public_html> 
-AllowOverride FileInfo AuthConfig Limit 
-AddHandler cgi-script .cgi .pl .php 
-Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec +ExecCGI 
-</Directory> 
-</code> 
-===== 限制瀏覽 ===== 
-在想要保護的目錄下, 寫一個.htaccess檔, 內容為 
-<code> 
-AuthName "Hi, there." 
-AuthUserFile [passwd path]/.passwd 
-AuthType Basic 
-require valid-user 
-</code> 
-創建具瀏覽權限的名單 .passwd 
-<code> 
-htpasswd -c [passwd path]/.passwd username (第一次建立.passwd) 
-htpasswd [passed path]/.passwd username (新增其它具有權限瀏覽的user) 
-</code> 
-===== 使位於/home/xx/目錄下使用者可執行CGI ===== 
-修改userdir.conf 
-<code>sudo vim /etc/apache2/mods-available/userdir.conf</code> 
-<code> 
-<Directory /home/*/public_html> 
-AllowOverride FileInfo AuthConfig Limit 
-AddHandler cgi-script .cgi .pl .php 
-Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec +ExecCGI 
-</Directory> 
-再增加以下區段 
-<Directory /home/xx/*/public_html> 
-AllowOverride FileInfo AuthConfig Limit 
-AddHandler cgi-script .cgi .pl .php 
-Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec +ExecCGI 
-</Directory> 
-</code> 
-重開apache即可 
-<code>sudo /etc/init.d/apache2 restart</code> 
-===== Ubuntu 10.04LST PHP bug ===== 
-修改/etc/apache2/mods-available/php5.conf 
-將以下部分以#號標記 
-<code> 
-#<IfModule mod_userdir.c> 
-#    <Directory /home/*/public_html> 
-#        php_admin_value engine On 
-#    </Directory> 
-#</IfModule> 
-</code> 
-===== 自動轉向do ===== 
-新增/etc/apache2/sites-available/serv 
-<code><Files ~ "^do$"> 
-        SetHandler cgi-script 
-</Files> 
- 
-Alias /bp/ "/home/dirty/wrk/BP2010/" 
-<DirectoryMatch ~ "^/home/dirty/wrk/"> 
-        Options Indexes 
-        <Limit GET POST> 
-                Allow from all 
-        </Limit> 
-</DirectoryMatch> 
-</code> 
-在/etc/apache2/sites-enable/ 
-<code>ln -s /etc/apache2/sites-available/serv .</code> 
- 
-====== Ubuntu ====== 
-  *[[http://superuser.com/questions/269961/resolv-conf-gets-refreshed-on-every-reboot|重開機的時候resolv.conf不會被Network Manager蓋掉]]\\ 
-    *指令:sudo chattr +i /etc/resolv.conf 
protected/member/data.1471845501.txt.gz · Last modified: by dirty