Reviewed by Aditya Kumar · Last reviewed 2026-03-24
To change file or directory permissions in a Unix like system, use the chmod (change mode) command. It allows specifying permissions numerically (octal) or symbolically, controlling read, write, and…
This easy-level General/Other question appears frequently in data engineering interviews at companies like Citi. While less common, it tests deeper understanding that distinguishes strong candidates.
Start by clearly defining the core concept being asked about. Interviewers want to see that you understand the fundamentals before diving into implementation details. Structure your answer with a definition, then explain the practical application with a concise example. The expert answer includes a code example that demonstrates the implementation pattern.
To change file or directory permissions in a Unix-like system, use the chmod (change mode) command. It allows specifying permissions numerically (octal) or symbolically, controlling read, write, and execute access for the owner, group, and others.
chmodThe chmod command takes a mode and a file/directory path.
* Numeric (Octal) Mode: This is the most common and precise method. Permissions are represented by a three-digit octal number, where each digit corresponds to the owner, group, and others, respectively. Each digit is a sum of:
* 4 for read (r)
* 2 for write (w)
* 1 for execute (x)
For example, 755 means:
* Owner: 4+2+1 = 7 (read, write, execute)
* Group: 4+1 = 5 (read, execute)
* Others: 4+1 = 5 (read, execute)
* Symbolic Mode: This method uses letters to specify changes.
* Who: u (user/owner), g (group), o (others), a (all)
* Operation: + (add permission), - (remove permission), = (set exact permission)
* Permissions: r (read), w (write), x (execute)
Example: chmod u+x,g-w my_script.sh adds execute permission for the owner and removes write permission for the group.
To change the owner or group of a file/directory, use the chown command (e.g., chown newuser:newgroup myfile.txt). For recursive changes to a directory and its contents, use the -R flag with chmod or chown, like chmod -R 644 my_data_directory/.
The principle of least privilege is paramount: grant only the permissions necessary for a task.
* Data Files: A common permission for data files (e.g., CSVs, Parquet files, logs) is 644 (rw-r--r--). This allows the owner to read and write, while the group and others can only read. This prevents accidental modification or deletion by unauthorized users.
* Executable Scripts/Directories: For shell scripts or directories, 755 (rwxr-xr-x) is typical. The owner can read, write, and execute. Group and others can read and execute. Directories require execute permission for users to cd into them and list their contents.
Avoid 777 (rwxrwxrwx) as it grants full read, write, and execute access to everyone, posing a significant security risk for sensitive data or critical scripts in production data pipelines.
# Set a script to be executable by owner, readable/executable by group/others
chmod 755 my_data_processor.sh
In the interview, also mention that proper file permissions are a fundamental aspect of data security and compliance, ensuring that sensitive data (e.g., in a data lake or logs) is protected from unauthorized access or modification by service accounts or users within a data platform.
Red Flag: chmod 777. Pro-Move: '755 for scripts, 600 for secrets; we use umask in CI to enforce defaults.'
Some links below are affiliate links. If you buy through them we may earn a small commission at no extra cost to you — it helps keep DataEngPrep free.
According to DataEngPrep.tech, this is one of the most frequently asked General/Other interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.