File management in Unix Interview questions


Total available count: 13
Subject - Operating System
Subsubject - File management in Unix

How do you change File Access Permissions?

Every file has the following attributes:

  • Owner's user ID ( 16 bit integer ).

  • Owner's group ID ( 16 bit integer ).

  • File access mode word

    'r w x -r w x- r w x' 

    (user permission-group permission-others permission)

    r-read, w-write, x-execute.

    To change the access mode, we use chmod(filename,mode).

    Code Practise 1:

    To change the mode of myfile to 'rw-rw-r--' (ie. read, write permission for user - read, write permission for group - only read permission for others)  we give the args as:

    chmod(myfile,0664) .

    Each operation is represented by discrete values 

    'r' is 4

    'w' is 2

    'x' is 1

    Therefore, for 'rw' the value is 6(4+2).

    Code Practise 2:

    To change the mode of myfile to 'rwxr--r--' we give the args as:

    chmod(myfile,0744).




Next 5 interview question(s)

1
What are the Unix system calls for I/O?
2
Brief about the directory representation in UNIX?
3
What is inode?
4
How are devices represented in UNIX?
5

What is 'inode'?