Linux考前輔導(dǎo)題目之RHCT答案_第1頁
Linux考前輔導(dǎo)題目之RHCT答案_第2頁
Linux考前輔導(dǎo)題目之RHCT答案_第3頁
已閱讀5頁,還剩2頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、1.創(chuàng)建下列用戶、組和組關(guān)系 :名為 admin 的組名為 natasha 的用戶,屬于 admin 組,并且該組是這個(gè)用戶的附屬組 名為 harry 的用戶,屬于 admin 組,并且該組是這個(gè)用戶的附屬組 名為 sarah 的用戶,沒有可交互的 shell,并且不屬于 admin 這個(gè)組 用戶 natasha、 harry、 sarah 的密碼都應(yīng)該為 wql23p rootlinser1 # groupadd adminrootlinser1 # useradd -G admin natasharootlinser1 # useradd -G admin harryrootlinser1

2、 # useradd -s /sbin/nologin sarahrootlinser1 # passwd natashaChanging password for user natasha.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.rootlinser1 # passwd harry Changing password for user harry .New UNIX password:Retype new UNIX password: S

3、orry, passwords do not match.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.rootlinser1 # passwd sarah Changing password for user sarah.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.2.拷貝文件 /etc/fst

4、ab 到 /var/tmp/fstab 。配置文件 /var/tmp/fstab 的權(quán)限使 a) 文件 /var/tmp/fstab 的擁有者是 root 用戶b) 文件 /var/tmp/fstab 屬于 root 組c) 文件 /var/tmp/fstab 對(duì)任何人都不可執(zhí)行d) 用戶 natasha 對(duì)文件 /var/tmp/fstab 有讀和寫的權(quán)限e) 用戶 harry 對(duì)文件 /var/tmp/fstab 既不能讀也不能寫f) 所有的用戶都能夠讀該文件 步驟一:拷貝文件rootlinser1 tmp#cp /etc/fstab /var/tmp/fstab步驟二:設(shè)置權(quán)限a.roo

5、tlinser1 tmp# chown root:root fstabc.rootlinser1 tmp# chmod a-x fstab d.rootlinser1 tmp# setfacl -m u:natasha:rw fstab e.rootlinser1 tmp# setfacl -m u:harry:- fstabf.rootlinser1 tmp# chmod a+r fstab3. 創(chuàng)建一個(gè)共享目錄 /common/adm ,使其具有一下特性a) 目錄 /common/adm 屬于 admin 組b) 目錄對(duì)該組成員是可讀可寫可執(zhí)行的,但是對(duì)其他用戶,都不可讀、不可寫、不可訪問

6、c) 在/common/adm 目錄下創(chuàng)建文件,其組的擁有權(quán)會(huì)自動(dòng)設(shè)置成admin 組rootlinser1 # mkdir -p /common/admrootlinser1 #chown :admin /common/admrootlinser1 #chmod g=rwx,o= /common/admrootlinser1 common# chmod g+s adm4.您的系統(tǒng)要添加一個(gè)大小為 500M 的物理分區(qū), 并且掛載到 /mnt/backup 目錄下,使用 ext3 文件系統(tǒng)。步驟一:查看物理硬盤:rootlinser1 # fdisk -l步驟二:編輯其中一個(gè)硬盤:rootli

7、nser1 # fdisk /dev/sdbCommand (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-2610, default 1):Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +500MCommand (m for help): pDisk /dev/sdb: 21.4 GB, 21474

8、836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytesDevice BootStartEnd Blocks Id System/dev/sdb1 162 497983+ 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.rootlinser1

9、# partprobe步驟三:格式化為 EXT3 文件系統(tǒng)rootlinser1 # mkfs -t ext3 /dev/sdb1 步驟四:建立掛載目錄并掛載rootlinser1 # mkdir /mnt/backuprootlinser1 # mount /dev/sdb1 /mnt/backup/rootlinser1 # mkdir /mnt/backuprootlinser1 # mount /dev/sdb1 /mnt/backup/5. 配置磁盤配額,當(dāng)用戶 harry 執(zhí)行以下命令時(shí):a) 執(zhí)行 dd if=/dev/zero of=/home/sunil/somefile b

10、s=1024 count=40 后,能夠成功創(chuàng)建一個(gè) 大小為 40kib 的文件b) 執(zhí)行 dd if=/dev/zero of=/home/sunil/somefile bs=1024 count=80 后,不能成功創(chuàng)建一個(gè) 大小為 80kib 的文件步驟一:修改 fstab 文件rootlinser1 # vim /etc/fstab/dev/vg/lv_home /home ext3 defaults,usrquota,grpquota 1 2 步驟二:重新掛載分區(qū)或者重新啟動(dòng)系統(tǒng)也可rootlinser1 # mount -o remount /dev/vg/lv_home 步驟三:為

11、用戶和組啟用配額rootlinser1 # quotacheck -cugv /dev/vg/lv_homerootlinser1 # ls /homeaquota.group aquota.user harry lost+found lzy natasha sarah 步驟四:編輯用戶配額rootlinser1 # edquota -u harryDisk quotas for user harry (uid 502):Filesystem blocks soft hard inodes soft hard/dev/mapper/vg-lv_home 20 5070 90 0步驟五:開啟配額

12、rootlinser1 # quotaon -ugv /home6. 邏輯卷 vo2掛載在/lvm 下,需要重新指定邏輯卷 vo2的大小到 290M 。并確保文件系統(tǒng) 的內(nèi)容保持完整。步驟一:卸載邏輯卷rootlinser1 # umount /lvm步驟二:強(qiáng)制檢查文件系統(tǒng)rootlinser1 # e2fsck -f /dev/vg1/vo2e2fsck 1.39 (29-May-2006)Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking direct

13、ory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/dev/vg1/vo2: 11/128000 files (9.1% non-contiguous), 8444/256000 blocks 步驟三:縮小文件系統(tǒng)到 290Mrootlinser1 # resize2fs /dev/vg1/vo2 290Mresize2fs 1.39 (29-May-2006)Resizing the filesystem on /dev/vg1/vo2 to 74240 (4k

14、) blocks.The filesystem on /dev/vg1/vo2 is now 74240 blocks long.步驟四:縮小邏輯卷到 290Mrootlinser1 # lvresize -L 290M /dev/vg1/vo2Rounding up size to full physical extent 292.00 MBWARNING: Reducing active logical volume to 292.00 MBTHIS MAY DESTROY YOUR DATA (filesystem etc.)Do you really want to reduce vo

15、2? y/n: yReducing logical volume vo2 to 292.00 MBLogical volume vo2 successfully resized步驟五:重新掛載,并查看rootlinser1 # mount /dev/vg1/vo2 /lvmrootlinser1 # df -hT7. 您的系統(tǒng)應(yīng)該有一個(gè) 700M 大小的 RAID 0 設(shè)備,掛載到 /common 目錄下。該 RAID 設(shè) 備應(yīng)該是有兩個(gè)物理分區(qū)組成,這兩個(gè)物理分區(qū)都應(yīng)該和你的其他分區(qū)位于同一個(gè)硬盤上。RAID 分區(qū)應(yīng)該被格式化為 ext3 文件系統(tǒng)。步驟 1:建立物理分區(qū)rootlinser

16、1 # fdisk /dev/sdbCommand (m for help): nCommand actione extendedp primary partition (1-4)ePartition number (1-4): 4First cylinder (63-2610, default 63):Using default value 63Last cylinder or +size or +sizeM or +sizeK (63-2610, default 2610):Using default value 2610Command (m for help): nCommand act

17、ionl logical (5 or over)p primary partition (1-4)lFirst cylinder (63-2610, default 63):Using default value 63Last cylinder or +size or +sizeM or +sizeK (63-2610, default 2610):+350MCommand (m for help): nCommand actionl logical (5 or over) p primary partition (1-4) lFirst cylinder (107-2610, default

18、 107):Using default value 107Last cylinder or +size or +sizeM or +sizeK (107-2610, default 2610):+350MCommand (m for help): tPartition number (1-6): 5Hex code (type L to list codes): fdChanged system type of partition 5 to fd (Linux raid autodetect)Command (m for help): tPartition number (1-6): 6Hex

19、 code (type L to list codes):fdChanged system type of partition 6 to fd (Linux raid autodetect)Command (m for help): pDisk /dev/sdb: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice BootStartEndBlocks IdSystem/dev/sdb11624979

20、83+83Linux/dev/sdb4632610204668105Extended/dev/sdb563106353398+fdLinux raid autodetect/dev/sdb6107150353398+fdLinux raid autodetectCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.rootlinser1 # partprobe 步驟 2:創(chuàng)建 RAID0 設(shè)備rootlinser1 # mdadm -creat

21、e /dev/md0 -level 0 -n 2 /dev/sdb5 /dev/sdb6 mdadm: array /dev/md0 started.步驟 3 :格式化并掛載rootlinser1 # mkfs -t ext3 /dev/md0rootlinser1 # mkdir /commonrootlinser1 # mount /dev/md0 /common14: 23 執(zhí)行 /bin/echo8. 用戶 natasha 需要配置一個(gè)定時(shí)執(zhí)行任務(wù),其每天在本地時(shí)間為 hiyarootlinser1 tmp# crontab -e -u natasha23 14 * * * /bin/echo hiya9. 在你的機(jī)器中打開 ip 轉(zhuǎn)發(fā)功能rootlocalhost # vi /etc/sysctl.conf net.ipv4.ip_forward = 1rootlocalhost # sysctl -p net.ipv4.ip_forward = 110. 配置本地的 yum 庫, yum 服務(wù)器在 server1 上,地址見環(huán)境介紹。使用 yum 安裝 x3270-x11 程序步驟一:添加 yum 倉庫配置文件rootstation7 # vi /etc/yum.repos.d/server1.repo- URL 的位置server1 - 倉庫名 name=R

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論