2012年11月18日 星期日

Ubuntu 12.04 server版本進階

選擇安裝的版本為 : ubuntu-12.04.1-server-amd64.iso
VM設定:VMWorksation 9
網路設定 :在VMWorksation 9網路設定為NAT

建立群組
    sudo groupadd aaa

將使用者a01 a02 加入aaa群組
sudo /etc/group 進程式底下 把a01,a02加到aaa那行最後面

讓檔案開啟所有權限
    sudo chmod 777 FileName

複製檔案
    cp Source Destination

※補充
A 拷貝到 B 假設B原來有該檔案 就會繼承B權限
             如果B沒有該檔案 就會繼承A檔案的權限,另外如果下cp 前面有加 sudo 則owner為root

改變檔案所屬群組chgrp
chgrp aaa mya01
          群組 檔案  

自創命令
---------------bashrc-----------------

alias ping='ping -c 4'
alias ipconfig='/etc/update-motd.d/50-landscape-sysinfo'
export PS1="\u@\h:"
alias bye'sudo shutdown -h +2"2分鐘後關機"'
-----------------------------------------



Sticky Bit

a01使用者到/home/student/創一個mysbit資料夾並更改權限
chmod 1777 mysbit
1.a01進到mysbit建檔Hello1.txt Hello.txt2 Hello3.txt
2三個使用者分別刪檔案
結構如下

home
  |
  |--student
  |     |
  |     |--mysbit
  |          |
  |          |-Hello1.txt    <--student 可以刪
  |          |
  |          |-Hello2.txt    <--a02     不能刪
  |          |
  |          |-Hello3.txt    <--a01     可以刪




sudo apt-get install apache2

sudo /etc/init.d/apache2 restart 啟動apache

nano /var/www/index.html  編輯網站




特殊指令
bash
pstree

----------自創程式test.sh-------------
read -p "" a
read -p "" b
declare -i sum=$(($a+$b))
echo $sum

沒有留言:

張貼留言