1 / 25

Linux_20101022

Linux_20101022. http://ihsumlee.bounceme.net. http:// ihsumlee.bounceme.net. 打開 virtualbox -> 啟動 Fedora-> 啟動伺服器網路 • 查詢電腦 ip : 命令提示單元 -> ipconfig (windows) • 利用 pietty 以 root 登入 伺服器. 麻煩查看 / var /log/ dmesg. cat 檔案 : 查看檔案 cat –n 檔案 : 查看檔案 + 行號 h ead –n 行數 檔案 : 查看檔案前面 n 行

simeon
Download Presentation

Linux_20101022

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux_20101022 http://ihsumlee.bounceme.net

  2. http://ihsumlee.bounceme.net • 打開virtualbox->啟動Fedora->啟動伺服器網路 • •查詢電腦ip: 命令提示單元-> ipconfig (windows) • •利用pietty以root登入伺服器

  3. 麻煩查看 /var/log/dmesg • cat 檔案: 查看檔案 • cat –n 檔案: 查看檔案+行號 • head –n 行數 檔案 :查看檔案前面n行 • tail –n 行數 檔案:查看檔案後面n行 • more 檔案 : 以分頁模式查看檔案 • less 檔案: 以分頁模式查看檔案+搜尋字串功能 q: 離開, /字串:查詢字串, n:向下查詢, N:向上查詢

  4. 麻煩查看 /var/log/dmesg

  5. 找sendmail的字串 • 麻煩告訴我,sendmail字串在/root/install.log中的第幾行? • cat -n install.log | grepsendmail

  6. 查詢/root/install.log中的字串”release” • 輸入下列字串 “I am Lee. I am living in New Taipei City.”

  7. 新增群組: groupadd群組名稱 • Ex: 假設我要新增一個群組為 zoo, groupadd zoo • 刪除群組: groupdel群組名稱 • Ex: 假設我要刪除一個群組為 zoo, groupdelzoo 查看伺服器上的群組檔案位於 /etc/group 1. cat -n /etc/group | grep zoo 2. tail -5 /etc/group

  8. 新增使用者並加入群組 • useradd -g 主要群主名稱 -G次要群組1,次要群組2,..,次要群組2 使用者名稱 Ex. 如果目前伺服器上有三個群組, 分別是zoo_Taipei,zoo_NewTaipei,zoo_Tainan. 我要新增一個使用者zooKeeper, 將他加入zoo_Taipei為主要群組, zoo_NewTaipei及zoo_Tainan為次要群組. useradd -g zoo_Taipei -G zoo_NewTaipei,zoo_Tainanzoo_Keep 查看新群組: tail -5 /etc/group

  9. step1 • 我想要知道,我的伺服器中是否存在以下個群組: zoo_Taipei, zoo_NewTaipei, zoo_Tainan cat /etc/group | grep zoo • 因為沒有以上三個群組, 所以我先新增群組 groupaddzoo_Taipei groupaddzoo_NewTaipei groupaddzoo_Tainan • 新增群組完成後, 再查看/etc/group是否存在新的群組 cat /etc/group | grep zoo

  10. step2 • 我想要查看有沒有zooKeeper. id zooKeeper • 如果出現“使用者不存在”, 可以新增使用者. cat /etc/passwd | grepzooKeeper 其中檔案 /etc/passwd用來存放伺服器中所有使用者, 包括系統正訂使用者, 及我們自行新增的使用者. • 接下來要新增使用者並將他“zooKeeper”加入群組 useradd -g zoo_Taipei -G zoo_NewTaipei,zoo_TainanzooKeeper 其中, -G 後面的群組之間以逗號隔開, 且逗號間不能有空隔

  11. step3 • 假設zooKeeper由Taipei調到Tainan. 我要更動zooKeeper的主要群組為zoo_Tainan usermod-g zoo_Tainan-G zoo_NewTaipei,zoo_TaipeizooKeeper 由於zooKeeper已存在伺服器中, 因此不能用useradd來新增同一個使用者帳號. 所以必須使用usermod來修改使用者資訊.

  12. Step 4 • 假設Taipei及Tainan的zoo都關了. 所以我必須把zooKeeper調到NewTaipei. 並且移除zoo_Taipei及zoo_Tainan的群組. usermod -g zoo_NewTaipei -G zoo_NewTaipeizooKeeper

  13. 修改現有使用者的群組 • usermod -g 主要群主名稱 -G次要群組1,次要群組2,..,次要群組2 使用者名稱 Ex. 如果目前伺服器上有三個群組, 分別是zoo_Taipei,zoo_NewTaipei,zoo_Tainan. 我要修改使用者zooKeeper, 將他的主要群組修改為zoo_NewTaipei, zoo_Taipei及zoo_Tainan為次要群組. usermod -g zoo_NewTaipei -G zoo_Taipei,zoo_Tainanzoo_Keep 查看新群組: tail -5 /etc/group

  14. 如何新增群組? rd, sales, manager • groupaddrd • groupaddsales • groupaddmanager • 角色:root : su root • 查詢目前伺服器上的群組:cat /etc/group

  15. 新增使用者並加入某一個群組 • useradderic > eric群組就eric (沒有指定群組) • useradd -g rderic • id eric • 同樣地, joyce (rd), hank (sales)

  16. 新增使用者並加入某兩個群組 • useradd -g manager -G rd tom • -g :主要群組,-G:次要群組 • id tom • emily (manager, sales)

  17. 新增使用者並加入某多個群組 • 我要在rd,sales,及manager之外, 新增一個群組 boss • 新增一個使用者 apple • apple (boss, rd, sales, manager) • useradd apple (錯) • useradd –g boss -G rd,sales,manager apple • id apple • groupadd :新增群組

  18. 修改使用者群組 • usermod -g manager -G rd apple • id apple

  19. http://ihsumlee.bounceme.net

  20. usermod -g manager -G rd appleid apple • rd的manager由tom換eric • joyce由rd部門換到sales部門 eric

  21. 修改權限 chmod u 擁有者 g 擁有群組 O 其它人 • drwxrwxrwxtom manager---- tom • drwx r-x - - - tom manager---- tom • chmod 777 tom • chmod 750 tom 421 421 421

  22. 更改檔案權限 • 切換使用者到tom • 新增一個檔案 file1 chmod 544 file1 • 更改file1的權限為 544 • 新增一個檔案 file2 • 將權限設定為tom可讀可寫不可執行, rd群組可讀不可寫不可執, sales群組不可讀可寫不可執行 • 新增一個檔案 dir1 • 其權限為 r-x-wxrw-

  23. mkdirdir1 • touch file1 file2 • id 使用者名稱 • chown 擁有者:群組 資料夾(檔案)

  24. ipconfig

More Related