0% found this document useful (0 votes)
20 views32 pages

Week5 Permission Help Admin

The document discusses file and directory permissions in UNIX/Linux systems and provides commands and utilities for system administration. It covers setting file permissions using the chmod command in both octal and symbolic modes. Important system administration utilities like ps, sudo, top, df are described. Information on user accounts and groups is stored in /etc/passwd and /etc/group files. Commands like man, info, whatis, apropos are explained for getting help in UNIX/Linux.

Uploaded by

bitsj2112915
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views32 pages

Week5 Permission Help Admin

The document discusses file and directory permissions in UNIX/Linux systems and provides commands and utilities for system administration. It covers setting file permissions using the chmod command in both octal and symbolic modes. Important system administration utilities like ps, sudo, top, df are described. Information on user accounts and groups is stored in /etc/passwd and /etc/group files. Commands like man, info, whatis, apropos are explained for getting help in UNIX/Linux.

Uploaded by

bitsj2112915
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

CPAN133-OPERATING SYSTEMS

UNIX /LINUX FILE/DIRECTORY PERMISSIONS


Getting help
and
Admin Utilities
OUTCOMES
2

 File and directory permission (review)


 Getting Help in UNIX/Linux:
 man ,info, whatis, apropos
 Basic Unix Admin Utilities
ps, sudo,top,df,iname,history
UNIX /LINUX
FILE/DIRECTOR
Y PERMISSIONS
FILE PERMISSIONS
22

 As a multi-user system Linux relies on permissions


to make sure the right user is able to do the right
things.
 Permissions manage who can read, write, or
execute files.
COMMAND
23

 This command is used to change the mode


(permissions) of a file or directory.

$ chmod [options]
filename(s)
CHMOD COMMAND
24

 Only the file’s owner or the superuser can change


the mode of a file or directory.
 chmod supports two distinct ways of specifying
mode changes:
 octal number representation
 symbolic representation.


CHMOD COMMAND
(CONT’D)
25

 Permission Mapping
Octal Binary File Mode
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx
PERMISSION
22

 $ > foo.txt
 $ ls -l
foo.txt
CHMOD COMMAND
(CONT’D)
26

 Octal representation: permissions may be


specified as a sequence of 3 octal digits
 Example:

$ chmod 600 private.txt

$ chmod 711 data


KNOWLEDGE CHECK

$ chmod 6 private.txt

What will be the access permission and


for whom?
CHMOD COMMAND (CONT’D)
27

 Symbolic representation: Permissions may be specified


symbolically

 Using symbols: u (user), g (group), o (other), a (all),


r (read), w (write), x (execute), + (add permission),
- (take away permission) and = (assign permission).

 Example:

$ chmod u=rw,go=-rw
private.txt
CHMOD COMMAND
(CONT’D)
28

 The chmod command can be used with the


–R option:

$ chmod -R go+r Playground


UNIX/LINUX SYSTEM
ADMINISTRATOR
29

 A system administrator manages the system


  Also called the superuser
 Adds new users
 Deletes old accounts
 Ensures that system performs services well and
efficiently for all users
  Unique user name: root
 Ordinary users are all other users
THE SYSTEM ADMINISTRATOR’S COMMAND
LINE

30

 Default setting:[root@hostname
root]#
 hostname:
name of computer the
system administrator logged in to
 May simply be localhost: refers to the local
computer
IMPORTANT
31

 It is not considered good form to be in the system


as an admin user: all sorts of things can happen
if you are not careful.
 In your home directory you can create any
subdirectories and set permissions for it.
SUDO COMMAND
32

 This command is used to perform commands


as the superuser or another user.

$ sudo [-options] command


SOME ADMIN UTILITIES

 ps
 list all processes (programs) that are running, along with their
process ID (PID)

 uname
 Uname command displays important information about the
system such as — Kernel name, Host name, Kernel release
number, Processor type, etc.,

Example:
uname -a
SOME ADMIN UTILITIES

 df
 Displays the file system disk space usage.
Example:
$ df -k (displays output in bytes)
$ df -h (human readable format)

 top
 top command displays the top processes in the system ( by
default sorted by cpu usage )
WHERE ARE THESE INFORMATION COMING
FROM?
33

 Like so many things in Linux, it comes from a


couple of text files…
WHERE ARE THESE INFORMATION
COMING FROM?
35

 User accounts are defined in the /etc/passwd file


 groups are defined in the /etc/group file.
 When user accounts and groups are created, these
files are modified along with /etc/shadow , which
holds information about the user’s password.
 For each user account, the /etc/passwd file
defines :
 the user (login) name, the uid, the gid, the account’s
real
name, the home directory, and the login shell.

WHERE ARE THESE INFORMATION
COMING FROM?
36


 If you examine the contents of /etc/passwd and
/etc/group , you will notice that besides the regular
user accounts there are accounts for the superuser
(uid 0) and various other system users.
Getting Help in UNIX/Linux
WHO COMMAND
4

 Determines information about who is logged in


 Important for the administrator
 Commonly used options include:
 whoami to see what account you are using
 -H to show column headings
 -u to show idle time for each user
 -q for a quick list and total of users logged in
 -b to verify when the system was last
booted
MAN COMMAND
5

 Syntax: $ man commandname


 Example: $ man mkdir

The results are usually a multi-page description of


the command and the available options and
arguments.
MAN COMMAND
6

 Syntax: $ man commandname


 Example: $ man mkdir

Man uses less to show the information – so you can


page through it. Control z quilts the program back to
the prompt.
MAN COMMAND
 The typical chapters for man:
9

Section Contents

1 User commands
2 Programming interfaces for kernel system calls
3 Programming interfaces to the C library
4 Special files such as device nodes and drivers
5 File formats
6 Games and amusements such as screensavers
7 Miscellaneous
8 System administration commands
MAN COMMAND
10

 To specify a section number, we use man like this:

 Syntax: $man section


search_term
 Example: $man 5 passwd
HELP COMMAND

 Provide more information on another


command.
 Syntax: $help
 Example: $ls --help
COMMAND
11

 Displays a Very Brief Description of a Command

 Syntax: $whatis commandname


 Example: $whatis ls
ls (1) - list contents
directory
INFO COMMAND
12

 If you type info then the command,


for example info ls,

then you will see the same information as you


would in the man page but the viewer is much
easier to use.
APROPOS
13

 When not sure of the exact name of a command use


apropos:

 Syntax: $ apropos search-term


 Example: $apropos copy

 NOTE: The man command with the -k option


performs exactly the same function as apropos.
APROPOS
14

[me@linuxbox ~]$ apropos floppy


1. create_floppy_devices (8) - udev callout to create all possible
floppy device based on the CMOS type
2. fdformat (8) - Low-level formats a floppy disk
3. floppy (8) - format floppy disks
4. gfloppy (1) - a simple floppy formatter for the GNOME
5. mbadblocks (1) - tests a floppy disk, and marks the bad
6. blocks in the FAT
7. mformat (1) - add an MSDOS filesystem to a low-level
formatted
floppy disk
8.

 The first field in each line of output is the name of the


man page, and the second field shows the section.

You might also like