Loading...
Linux Interview Questions

File Permission

1.What are file permissions in Linux .How do you change permissions?
A) Linux uses read (r), write (w), execute (x) permissions for owner, group, and others.
Using chmod

2. How do you check file permissions?
A)

ls -l filename

3. How do you change file ownership?
A) 

chown username:groupname file.txt

4.How do you change only the group ownership?
A)

chgrp groupname file.txt

5.What is the difference between chmod 777 and chmod 755?
A)

  • 777 → everyone can read, write, execute
  • 755 → owner can read/write/execute, others read/execute only

6.What is umask in Linux?

A) umask (User Mask or User File-Creation Mode Mask) defines the default permission set for newly created files and directories. It subtracts permissions from the system’s default (666 for files, 777 for directories).

7.What are SUID, SGID, and Sticky bit? How do you set?

A)

SUID → file executes with owner’s permissions

SGID → file executes with group permissions / directory files inherit group

Sticky bit → only owner can delete file in shared directory (/tmp)

8.Explain different file system types in Linux?
A)
ext4: It manages files with improved performance and reliability.
XFS: It scales for large storage systems with high throughput.
Btrfs: It provides features like snapshots and RAID support.
FAT32: It facilitates compatibility with various operating systems and devices.
NTFS: It allows accessing files in dual-boot setups or external drives.
ZFS: It offers advanced functionalities such as data compression and deduplication.

9.What is a File System?
A) A file system is a method used by an operating system to store, organize, and manage files on a storage device (like HDD, SSD, or USB).

10.What is an Inode?
A) An inode (Index Node) is a data structure in a Linux file system that stores metadata about a file, but not the file name or actual content.

11.What happens if you set chmod 000 file.txt?

A) No one can read, write, or execute the file.Only root can change it back.

Leave a Reply

Your email address will not be published. Required fields are marked *