Vous êtes sur la page 1sur 35

LINUX INTRODUCTION Linux partitions - / = root partition (holds all OS database) - /boot = holds booting files - swap = for

support RAM

Two environment of desktop


GNOME DESKTOP ENVIRONMENT KDE DESKTOP ENVIRONMENT

UNIT 2.
Some basic commands used in terminal #passwd root : to change the root password #whoami : to know who is logged in #pwd : to show where the user is (the current directory) #ls : to see the content under the current location #ls / :to see the content under the root #cd /home : go into home directory #hostname : to know the computer name #reboot : restart the PC #init 6 : restart the PC #passwd username : change the password of any user #mkdir : to make a directory #touch : create blank file #vi : to edit old file or create new file

#cat : to check contents of file #clear : to clear the terminal window #exit : to go out #history : to see the list of the command you run previously #init 0 : to shut down the system #hostname (pc1) : to change your systems name to (pc1) *applicable for the current session HOW TO CHANGE THE HOST NAME PERMENANTETLY #vi /etc/sysconfig/network (edit hostname) Inside the file change the host name by press I then after changing the hostname put : ; write wq : this will save changes and exit the file the goes back to the terminal #vi Desktop/filename : to create a file on the desktop;follow the same steps in saving #wq : saving the changes on a file Other commands #cal : calendar #cal 2011 : calendar for the whole 2011 #date : current date #ls --help same as #man ls #man (any command) : to see help for any command #!(number of the command) : run previous command with its number If you write the whole command and you want to edit it you can use Ctrl a : to go back to the beginning of the line Ctrl e : to go to the end of the line #mkdir /mike/{d1,d2,d3,d4,} : way of creating many files under (mike) directory

#cat filename | less same as #less filename : to see the contents of the file line by line #cat filename1 > filename2 : copying the contents of file1 to new file2 #cat > filenametype something.Ctrl-z : the new file is created #touch Desktop/filename : to create a blank file on the desktop #|| : shows the recent command && : allow to run several commands at the same time #tee : add text to an existing file

INSTALLING IN TEXT MODE Boot from CD Type : linux text GOING BACK TO GRAPHIC MODE CRTL ALT F7 START X CHVT 7 GOING TO TEXT CTRL ALT F1 File system hierarchy standard / = root directory /bin = system commands and binaries /boot = bootloader /dev = devices files /etc = computer specific configuration files /home = user files

/lib = programming library like DLLs /mnt = temp mounting points Pushd and popd Pushd = save directory reference Popd = retrieve directory reference Both make it easy

MANAGING DIRECTORIES Rmdir = remove directory Mv = to rename or move a directory Rm p = removing a directory that is not empty Mkdir mike linux = creates two directories mike and linux Mkdir mike linux = creates one directory called mike linux -f = forcing copy,delete -u = updating the target file when copying #ln filename1 filename2 = creates a link between flename1 and filename2 #ln s = symbolic link

File information commands #file = describe the type of file #stat = gets the info of the file #test = tests the file

Finding files #find . atime0 = shows the files that have been accessed in the last 24hours #locate ls = used to locate where LS is located #whereis ls = shows the location of ls giving the whole path #whatis = shows what is ls MOUNTING #mkdir /tmpcdrom = making directory for mounting #mount /dev/cdrom /tmpcdrom = mounting the cdrom to the tmpcdrom directory #mount /dev/sdb1 /flash = mounting the flash under flash directory #cp Desktop/filename /flash = copying from the desktop to flash #rm /flash/filename = removing filename from flash #unmount /dev/sdb1 = unmounting flash USERS AND GROUP Creating users The PASSWD file stores the info about every users (/etc/passwd) UID = user identificationthe number starts from 500 (root UID starts from 0) Bash shell is created A group and GID with the sane users name is created Password information is stored in /etc/shadow Group information is stored in /etc/group Note: user has default home directory under /home/username/ and for root is /root #useradd user1 = creating user name user1 the same as #adduser user1 #passwd user1 = creating password for user1

#usermod [options] username = making changes to the user #chfn [options] [username] = change the properties of a user(locking) #finger username = allows you to see the users information (old command) #groupadd [options] group_name = creating users groups #passwd d [user] = to delete the password #usermod G username = allows you to add user to the existing group #tail -1 /etc/group = to show the last line of the group #userdel [-r]username = delete a user #groupdel = delete groups File ownership #newgrp = #chown [user] specifed file = change owner of a specified file #chgrp [name] specified file= change group owner of a specified file #ls l [particular file] prompots you the below format Dir/file User permissions D/ R W X Group permissions R X Others permissions R X

Followed by : root rootfirst root meaning the owner or user the second root meaning the group plus the date it was created and the name of the file

Permissions are given in numbers Read = 4 Write = 2 Execute = 1 Dir/file User permissions Group permissions Others permissions

D/ -

If you want to give WRITE permission to the group you give 2(based on the above table) #chmod [path to a particular file]= to give permissions #chmod 754 [particular file or folder] = this means we are giving the user RWX permission we are giving the group RX permission we are giving the others R permission #chmod [u,g,o] +/- [r,w,x] [specified file] = used to add or remove permissions #umask = defines default permissions and the default umask is 022 File 666 022 644 folder 777 022 755

If we change unmask it can make effect on default permissions Dir = drwxr-xr-x File = -rw-rr UMASK is the substractive method of changing default permissions of files and folder

Special permissions Dir/file User permissions D/ R W S Group permissions R S Others permissions R T

#chmod 0755 = the lead zero means there is no sticky bit you are giving

#chmod 6755 = giving special permission and sticky bit on the sixth column #chmod [u,g,o]+[s,t] = to apply special permissions MANAGING AND INSTALLING PACKAGES Packages/applications are also called RPM(Red hat Package Manager) RPM command is applied on RED HAT VERSIONS All packages are inside the folder called SERVER(dir) found inside the O.S cd #mount /dev/cdrom /mnt = mounting the cdrom to /mnt dir #ls /mnt/server = listing the available packages inside the SERVER dir #rpm iv [package] = to installation a package and see the process going on #rpm q(i) [package] = to see if a specified package is installed #rpm e [package] = to uninstall a package #apt-get install [package name] #dpkg i [package name] #dpkg l = listing the packages installed #apt-cach show = listing installed packages =============================================================== #apt-get remove [package name] = removing a specified packages #dpkg r [package name] = removing a package Apt-get autoremove = removing without asking EXTRACTING #tar zxvf [filename]= available options of uncompressing the files Z = compress/uncompress X= V = listing processed files

F= CREATING PARTITIONS #fdisk l = lists the existing partitions #df = lists mounted existing partitions or disk #fdisk /dev/sad = creating new partitions N = for new partition First scylendor press enter Second +spaceM = give partition space P = to see the partition list W = write and exit #partprobe = to activate new partition without restart #mke2fs j /dev/sd4 = format the partition #mount /dev/sd4 /secret = mount partition under /secret Note : if you want to mount a partition permanently we have to make an entry in /etc/fstab file #parted [options] device [command] #

#vi /etc/fstab /dev/sd5 :wq /secret ext3 defaults 00

REQUIREMENTS Create two partitions 100MB mount it to /batch1/music (temporarily) 200MB mount it /batch1/personal (permanently)

INCREASING SWAP PARTITION AFTER INSTALLATION 1 create a partition with swap ID (82) 2 mount it permanently in /etc/fstab 3 partprobe 4 mke2fs j /dev/sda11 (formatting swap partition which was created) then partprobe and run mount a 5- increasing swap - mkswap /dev/sda11 (making swap) - verify is this swap partition mounted under /etc/fstab Swapon a (to activate) Swapon s (to see swap partition)

QUOTAS 1 limits disk usage (blocks or inodes) 2 tied to file systems (set on per file system basis) 3- can be configured for users and groups TASK : enable soft limit 50MB and 100MB for rahi user on /home Steps to enable quota support

1.enable quota support per file system in /etc/fstab a.defaults,usrquota,grpquota 2.remount the file system(s) a.mount o remount / (mount o remount /home1) (restart pc) b.use mount to confirm that usrquota,grpquota support are enables c.quotacheck /home d.quotaon /home e.edquota u rahi make entried accordingly requirement f. requota a or #quota username NOTE : the block are measured in 1K increments. i.e 20000 blocks is roughly 20MB

RAID FEATURES 1.ability to increase availability and reliability of data TASK1 Create a RAID-1 device (/dev/md0..n) a.fdisk/dev/sda to create 2 usable raw partitions with raid extension.I created /dev/sda5 and /dev/sda6

b.partprobe /dev/sda5.6 to force a kernel update of the partition layout of the disk : /dev/sda5 and /dev/sda6 c.mdam c /dev/md0 l 1 n 2 /dev/sda5 /dev/sda6 d.cat/proc/mdsta : list active RAID (md) information #mdam detail /dev/md0 (check detail) e. mke2fs j /dev/md0 overlays a file system on the RAID device f. mkdir/raid1 g. mount/dev/md0 /raid h. update: /etc/fstab NOTE: use mdadm query /dev/md0 to get information about a raid device

PROCESSES #ps f = lists full details about the process in your current shell #ps ef = lists full details about the processes across all terminals including daemons #ps l = lists the ull details ,plus the process flag (associated with the permissions),process state.wait channel and more

KILLING PROCESSES #sighup(1) = hang up #siginit (2) = interrupts foreground proc #sigquit (3) = quit and save to core #sigterm (15) = default kill command #sigkill (9) = absolute kill #pgrep = finds matching processes to kill #pkill = kills the process you name #killall = kills all the process by the name you provide Signal trapping Some processes are immune to the soigterm command for killing Use the sigkill for those Killing parent and child processes

BACKUP AND RESTORE Compressind and decompressing files Gzip compress/decompress files Gunzip decompresses gzip files Compressing by gzip

#gzip file1 > file1.gz = compresses file1 to file1.gz #gzip l file1.gz = details of compressed file #gunzip filename = extract or decompress file Bzip2 #bzip2 c file1 > file1.bz2 #bzip2 d 1million.txt.bz2 (decompress) Use full ectracting things #tar xvf filename.tar #tar xzvf filename.tar.gz #dd if=/dev/cdrom of=/soft/rhel.iso = making ISO file

Scheduling tasks #at press enter and type the task to be performed at that particular time CRONTAB FORMAT * Min * hour * d.o.m * month * d.o.w command >> destination

#crontab e 30 17 * * * init 0 */2 * * * * cal */1 * * * * ping 127.0.0.1 */1 * * * * /bin/echo hello :wq #service crond restart #crontab l = to check what you set #crontab r = to delete scheduled jobs

>> >> >> >>

/dev/tty1 /dev/console /dev/tty1 /dev/tty1

MONITORING TOOLS #mpstat = multiple processors #iostat = i/o for each disk #sar = system activity mon #free = memory and swap space #top = CPU stats,memory,swap #uptime #vmstat = swap performance

NETWORKING Class A 1.0.0.0 126.0.0.0 Class B 128.0.0.0 191.255.0.0 Class C 192.0.0.0 223.255.255.0 Class D 224.0.0.0 239.0.0.0 Class E 240.0.0.0 255.0.0.0 IPV6

128bit = 2 power 128 addresses Hexadecimal notation with colons No need for classful addressing PORTS 20/21 FTP 25 SMTP 53 DNS 80 HTTP 110 POP3 443 SSL #less etc/services = top check the port numbers NETWORK CONFIGURATION #ifconfig = checking the ip address #ifconfig [device name] [ip address] netmask [] broadcast []= setup a new ip address #setup > select network > follow the instruction and give the ip #system-config-network = give the IP addres graphicaly #service network restart #chkconfig network on = to start the service permanently #ifup eth0 (ifconfig eth0 up)= enable the NIC #ifdown eth0 (ifconfig eth0 down)= disable the NIC #route = to manage your routing table #dhclient eth0 = requesting the ip address from the DHCP #dhcpcd = #dhp3-client = #cat /etc/sysconfig/network-scripts/ifcfg-eth0 = to see the details about eth0

DHCP SERVER SERVICES Dhcp3-server package Dhcp daemon Dhcp.leases database INSTALLING THE DHCP SERVICES #mount /dev/cdrom /mnt/ = to mount the cdrom to mnt directory #rpm iv /mnt/server/dhchp-3.0.5.7.el5.i386.rpm #cat /etc/dhcpd.conf = sample file for dhcp #cp /usr/share/doc/dhcp*/dhcpd.conf.cample /etc/dhcpd.conf #vi /etc/dhcpd.conf = edit the file #service dhcpd restart #chkconfig dhcpd on SHARING FILES #showmount e = to see shared data on local pc #showmount e [ip address] = to see shared data on a specified computer To share /rahi for all and /rdb only for rdb users #vi /etc/exports /rahi /rdb /rdb2 :wq *(rw,sync) 192.168.0.0/255.255.255.0 (rw,sync) rdb.com(rw,sync)

#service nfs restart #chkconfig nfs on

How to access client side #mount t nfs 192.168.0.1:/rahi /jkl = mounting temporarily Mounting permanently #vi /etc/fstab 192.168.0.1:/rahi :wq /jkl auto defaults 0 0

PRINTING #lpr = print document #lpc = status of the of the printer #lpq = view print jobs #lprm = remove orint jobs from the queue INTEROPERABILITY Samba we use SWAT service to configure it to share /win dir with windows computers #mount /dev/cdrom /mnt/ = mounting #rpm iv /mnt/Server/xinetd -2.3.14-10.el5.i386.rpm = installing dependency #rpm iv /mnt/Server/samba-3.0.25b.0.el5.4.i386.rpm = installing samba rpm #rpm iv /mnt/Server/samba-swat-3.0.25b-0.el5.4.i386.rpm = install rpm #vi /etc/samba/smb.conf (edit in last line) [rdb windows dir] Comment = for rdb users only Path = /win Public = yes Browsable = yes Writable = yes :wq #service smb restart #chkconfig smb on

INSTALLING SAMBA NOTE : ultimately,user must authenticate to the local linux file system Task 1 Install SWAT a.yum y install samba* (or) samba-swat

configure /etc/samba/smb.conf and after run #testparm (to check file error) #vi /etc/samba/smb.com *(in last)* [rahi data] Comment = for rahi only Path = /rahi Valid users = user1,user2,user3,user4 Read list = user1,user2 Write list = user3,user4 Hosts allow = 192.168.0.0/255.255.255.0 :wq #service smb restart also disable selinux & firewall #testparm (to check file entries) #chcon t samba_share_t /rahi (enable samba share) #smbpasswd a user100 (give password) #smbclient //192.168.0.1 /rahi U user100 (ip of samba server & share name) NOTE : on windows client access data that is shared by samba

INSTALLING SAMBA #mount /dev/cdrom /mnt #cd /mnt/Server/ #rpm iv xinetd-2.3.14-10.el5.i386.rpm #rpm iv perl-convert-ASN1-0.20-1.1.noarch.rpm #rpm iv samba-3.0.25b-0.el5.4.i386.rpm #rpm iv samba-swat-3.0.25b-0.el5.4.i386.rpm Now configure samba file #vi /etc/samba/smb.conf (edit in last) [rahi data] Comment = for rahi only Path = /rahi Valid users = user1,user2 Read list = user2,user1 Write list = user1 Host allow = 192.168.0.0/255.255.255.0 :wq #service smb restart #chkconfig smb on #testparm (to check entried) #chcon t samba_share_t /rahi ENABLE SHARE #smbpassword a user1 set smb password for user Access on windows

SECURITY #lokkit = to see the firewall configuration interface CREATING A WEB SERVER Install httpd rpm with dependencies #rpm iv apr-1.2.7-11.i386.rpm #rpm iv postgresql-libs-8.1.9-1.el5.i386.rpm #rpm iv apr-util-1.2.7-6.i386.rpm #rpm iv httpd-2.2.3-11.el5.i386.rpm

#cp Desktop/inde.html /var/www/html #ls /var/www/html/

#vi /etc/httpd/conf/httpd.conf

(last line)

<Virtualhost 192.168.0.100:80> ServerAdmin root@localhost.localdomain Documentroot /var/www/html ServerName localhost.localdomain Errorlog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </virtualhost> :wq #service httpd restart #chkconfig httpd on

HOW TO BREAK THE ROOT PASSWORD - restart the machine - press allow keys when the starting redscreen appears on the screen - press e to edit the commands before booting - press e - press space - press 1 or s - press b - a shell comes then set the new password for root Tom_ntambara@yahoo.com t.ntambara@kist.ac.rw

SSH Secure Shell.SSH is more secure that telnet used to access device anywhere in network via text mode.SSH has port number 22.also its better,more secure and easy to use in network environement. Note: rpm is used openssh which is default installed in linux.if its not installed we can install it manually. #service sshd restart #chkconfig sshd on How to access client side #ssh ip #ssh username@ip/name #ssh root@192.168.0.100

FTP File Transfer Protocol is used to transfer files from one pc to another.it has the port number 20,21 Note : it uses vsftpd daemon/services in linux.and default path of ftp is /var/ftp/pub also default user is anonymous and password is also anonymous How to enable ftp on pc1 #rpm iv vsftpd-2.0.5-10.el5.i386.rpm #service vsftpd restart #chkconfig vsftpd on Note1 : now put/paste some data in /var/ftp dir. It will be available on client side. Note2 : you can login on client via simple user and anonymous user,but root can login default Basic commands on client side #ftp ip #mget filename #mput filename #bye #cd #ls (to access the ftp server) (to access/download file from server) (to upload files on server) (to close.disconnect ftp session with ftp) (to change dir) (to see the contents)

TROUBLESHOOTING Run levels (0) shutdown (1) single user mode (3) text mode (5) graphic mode (6) restart How to set run level #vi /etc/inittab Change the id :[number] : default: to the run level number you want #wq #init 6 to reboot your system How to change the title of O.S and increasing the timing of the red screen #vi /etc/grub.conf Edit the timeout to the number you want (timing comes in seconds) Edit the line that comes after title to the new name you want of your O.S Networking troubleshooting utilities #ping #ifconfig/iwconfig #ifdown/ifup (disable/enable NIC) #route (to check the current route table in our pc) #traceroute (to trace the router) #ftp ip (connect via ftp) #telnet ip (connect via telnet) #ssh ip (connect via ssh) #netstat (check network status)

Configuration:

Configuration of disk usage quotas on Linux - Perform the following as root: 1. Edit file /etc/fstab to add qualifier "usrquota" or "grpquota" to the partition. The following file system mounting options can be specified in /etc/fstab: grpquota, noquota, quota and usrquota. (These options are also accepted by the mount command but ignored.) The filesystem when mounted will show up in the file /etc/mtab, the list of all currently mounted filesystems.) o To enable user quota support on a file system, add "usrquota" to the fourth field containing the word "defaults".
... /dev/hda2 ... o /home ext3 defaults,usrquota 1 1

Replace "usrquota" with "grpquota", should you need group quota support on a file system.
/home ext3 defaults,grpquota 1 1

... /dev/hda2 ... o

Need both user quota and group quota support on a file system?
/home ext3 defaults,usrquota,grpquota 1 1

... /dev/hda2 ...

o This enables user and group quotas support on the /home file system. 2. touch /partition/aquota.user where the partition might be /home or some partition defined in /etc/fstab. then chmod 600 /partition/aquota.user

The file should be owned by root. Quotas may also be set for groups by using the file aquota.group Quota file names:
o o

Quota Version 2 (Linux 2.4/2.6 kernel: Red Hat 7.1+/8/9,FC 1-3):


aquota.user, aquota.group

Quota Version 1 (Linux 2.2 kernel: Red Hat 6, 7.0): quota.user,


quota.group

The files can be converted/upgraded using the convertquota command.

3. Re-boot or re-mount file partition with quotas. o Re-boot: shutdown -r now o Re-mount partition: mount -o remount /partition After re-booting or re-mounting the file system, the partition will show up in the list of mounted filesystems as having quotas. Check /etc/mtab:
... /dev/hda5 / ext3 rw,usrquota 0 0 ...

4. quotacheck -vgum /partition or


quotacheck -vguma o For example (Linux -vguma

kernel 2.4+: Red Hat 7.1+, Fedora): quotacheck

quotacheck: WARNING - Quotafile //aquota.user was probably truncated. ... quotacheck: Scanning /dev/hda5 [/] done quotacheck: Checked 9998 directories and 179487 files

For example (Linux kernel 2.2: Red Hat 6/7.0): quotacheck -v


/dev/hda6

System response:
Scanning /dev/hda6 [/home] done Checked 444 directories and 3136 files Using quotafile /home/quota.user

5. Quotacheck is used to scan a file system for disk usages, and updates the quota record file "quota.user/aquota.user" to the most recent state. It is recommended thet quotacheck be run at bootup (part of Redhat default installation) 6. Man page: quotacheck - scan a filesystem for disk usage, create, check and repair quota files 7. quotaon -av System Response: /dev/hda6: user quotas turned on quotaon - enable disk quotas on a file system. quotaoff - turn off disk quotas for a file system. Man page: quotaon - turn filesystem quotas on and off

8. edquota -u user_id Edit directly using vi editor commands. (See below for more info.) For example: edquota -u user1 o System Response (RH 7+):
Disk quotas for user user1 (uid 501): Filesystem blocks inodes soft hard /dev/hda5 1944 120 0 0 soft 0 hard 0

blocks: 1k blocks inodes: Number of entries in directory file soft: Max number of blocks/inodes user may have on partition before warning is issued and grace persiod countdown begins. If set to "0" (zero) then no limit is enforced. hard: Max number of blocks/inodes user may have on partition. If set to "0" (zero) then no limit is enforced. System Response (RH 6):
Quotas for user user1: /dev/sdb6: blocks in use: 56, limits (soft = 0, hard = 0) hard = 0) inodes in use: 50, limits (soft = 0,

Something failed if you get the response:


hard = 0) = 0) /dev/sdb6: blocks in use: 0, limits (soft = 0, inodes in use: 0, limits (soft = 0, hard

Edit limits:
Quotas for user user1: /dev/hda6: blocks in use: 992, limits (soft = 50000, hard = 55000) inodes in use: 71, limits (soft = 10000, hard = 11000)

9. If editing group quotas: edquota -g group_name 10. Man page: edquota - edit user quotas 11. List quotas:
quota -u user_id

For example: quota -u user1 System response:


Disk quotas for user user1 (uid 501): Filesystem blocks quota limit limit grace /dev/hda6 992 50000 55000 11000 grace files 71 quota 10000

If this does not respond similar to the above, then restart the computer: shutdown
-r now

Man page: quota - display disk usage and limits Quota Reports:

Report on all users over quota limits: quota -q Quota summary report: repquota -a
*** Report for user quotas on device /dev/hda5 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace --------------------------------------------------------------------root -- 4335200 0 0 181502 0 0 bin -15644 0 0 101 0 0 ... user1 -1944 0 0 120 0 0

No limits shown with this user as limits are set to 0. Man page: repquota - summarize quotas for a filesystem. Cron: Quotacheck should scan the file system via cronjob periodically (say, every week?). Add a script to the /etc/cron.weekly/ directory. File: /etc/cron.weekly/runQuotacheck

Linux Kernel 2.4: Red Hat 7.1 - Fedora Core 3:

#!/bin/bash /sbin/quotacheck -vguma #!/bin/bash

Linux Kernel 2.2: Red Hat 6/7.0:

/sbin/quotacheck -v -a

(Remember to chmod +x /etc/cron.weekly/runQuotacheck) Edquota Note: The "edquota" command puts you into a "vi" editing mode so knowledge of the "vi" editor is necessary. Another editor may be specified with the EDITOR environment variable. You are NOT editing the quota.user file directly. The /partition/quota.user or quota.group file is a binary file which you do not edit directly. The command edquota gives you an ascii interface with the text prepared for you. When you ":wq" to save the file from the vi session, it is converted to binary by the edquota command and stored in the quota.user file. Assigning quota for a bunch of users with the same value. To rapidly set quotas for all users, on my system to the same value as user user1, I would first edit user user1's quota information by hand, then execute:
edquota -p user1 `awk -F: '$3 > 499 {print $1}' /etc/passwd`

This assumes that the user uid's start from 500 and increment upwards. "blocks in use" is the total number of blocks (in kilobytes) a user has comsumed on a partition. "inodes in use" is the total number of files a user has on a partition. edquota options: Option -r -m -u -g -p user-id -F format -F vfsold -F vfsv0 -F rpc -F xfs -f /filesystem -t -T Description Edit quotas on remote server using RPC. Remote server must be configured with the daemon rpc.rquotad Edit user quota Edit group quota Duplicate the quotas based on existing prototype user Format: vfsold - version 1 vfsv0 - version 2 rpc - quotas over NFS xfs - quotas for XFS filesystem Perform on specified filesystem. Default is to apply on all filesystems with quotas Edit the soft time limits for each filesystem. Edit time for user/group when softlimit is enforced. Specify number and unit or "unset"

Soft Limit and Hard Limits: Soft limit indicates the maximum amount of disk usage a quota user has on a partition. When combined with "grace period", it acts as the border line, which a quota user is issued warnings about his impending quota violation when passed. Hard limit works only when "grace period" is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his "hard limit". Grace Period: "Grace Period" is configured with the command "edquota -t", "grace period" is a time limit before the "soft limit" is enforced for a file system with quota enabled. Time units of sec(onds), min(utes), hour(s), day(s), week(s), and month(s) can be used. This is what you'll see with the command "edquota -t": System response:

Linux Kernel 2.4+: Red Hat 7.1+/Fedora:

Grace period before enforcing soft limits for users: Time units may be: days, hours, minutes, or seconds Filesystem Block grace period Inode grace period /dev/hda5 7days 7days

Linux Kernel 2.2: Red Hat 6/7.0:

Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for users: /dev/hda2: block grace period: 0 days, file grace period: 0 days

Change the 0 days part to any length of time you feel reasonable. A good choice might be 7 days (or 1 week). Quota files: (non-XFS file systems) The edquota command will create/edit the quota file at the root of the file system. (See /etc/mtab for the list of the currently mounted filesystems.)

Version 2: aquota.user, aquota.group Version 1: quota.user, quota.group

The Linux Kernel: The default Red Hat/Fedora Core Linux kernel is shipped quota ready. If you have streamlined your kernel by rebuilding it with fewer options, make sure it has been configured with quotas support. When using the tools xconfig or menuconfig

be sure to reply y to:


Quota support (CONFIG_QUOTA) [n] y

Fedora Core 3: grep CONFIG_QUOTA /usr/src/redhat/SOURCES/kernel2.6.9-x86_64.config

Response:
CONFIG_QUOTA=y CONFIG_QUOTACTL=y

The Redhat default init script /etc/rc.d/rc.sysinit will also contain a point in the script to run quotacheck:

Red Hat 6, 7.0:

if [ -x /sbin/quotacheck ]; then echo "Checking root filesystem quotas" /sbin/quotacheck -v -a fi

And turn quota checking on:

if [ -x /usr/sbin/quotaon ] then echo "Turning on quota." /usr/sbin/quotaon -v -a fi

Links/Information: Also note that system limits may be set in the configuration file: /etc/security/limits.conf. Here file size limits may be set for core dumps and data files as well as resource limits such as max cpu time and number of processes. More Quota Info:

http://www.freebsd.org/handbook/quotas.html

Exploits: http://listweb.bilkent.edu.tr/linux/06/0653.html Software Available From: ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz Linux man pages:

quota - display disk usage and limits rquota - implement quotas on remote machines fstab - static information about the filesystems edquota - edit user quotas setquota - set disk quotas (Command line editor) quotacheck - scan a filesystem for disk usage, create, check and repair quota files quotaon - turn filesystem quotas on quotaoff - turn filesystem quotas off repquota - produce a summary of quota information for a file system convertquota - convert quota from old file format to new one. Convert quota.user to aquota.user quotactl - manipulate disk quotas (C programmer interface) Question 1 A customer wants internal office information to be accessible by employees through a Web browser. Which of the following Linux services should be used? A. Squid B. MySQL C. Apache D. sendmail

Question 2 Which of the following should be done before installing Linux on a home computer? A. Upgrade the computer's memory to at least 64 MB B. Create ext2 and swap partitions on the hard drive C. Verify the hardware on the Linux hardware compatibility list D. Defragment the drive using the computer's current operating system

Question 3 Which of the following packages is usually more important for a "workstation" installation than a "server" installation? A. DNS Server B. DHCP Server C. Proxy Server D. XFree86 Server

Question 4 A new employee having a problem with account login has the following entry

in the /etc/passwd file: user1:*:51:501:John Doe:/home/user1:/bin/bash What is wrong with this entry in the /etc/passwd file? A. The UID is not valid. B. The account is locked. C. The UID and GID must match. D. Spaces are not permitted between the first and last name.

Question 5 After having worked for several months, a PC fails to boot and indicates that the HDD has bad sectors. Which is the first action to take? A. Reboot the system to remove the message. B. Run the manufacturer's Diagnostic Utility. C. Replace the defective HDD and reload the system. D. Run Scandisk and Defrag to repair the damaged sectors.

Question 6 A customer wants to determine which TCP ports are in use on his Linux server. Which of the following commands should be used? A. tftp B. lsport C. minicom D. netstat

Question 7 A Linux superuser is unable to delete a file. The user is also unable to change permission for the file. What is the problem? A. The file is actually a hard link. B. The file has the immutable flag set. C. The file has been fragmented across directories. D. The superuser does not have permission to access the file.

Question 8 Which of the following commands can be used to save and resume editing the file in the vi editor? A. :w

B. :x C. :v D. :s!

Question 9 A system technician needs to determine which hardware modules are loaded on a particular Linux server. Which of the following commands will perform this task? A. lsmod B. modules C. insmod -list D. modprobe -list

Question 10 What is the first step in troubleshooting a system problem? A. Collect information B. Test a possible solution C. Make a hypothesis about a solution D. Try to modify the configuration files

Vous aimerez peut-être aussi