Skip to content

Linux Basic 04

Introduction

EHCTF

Category: Misc

Write-up date: 03/03/2025

Question: Trong linux, cách để set một file mà owner có quyền viết, thực thi đọc; Group và Other User không có quyền gì cả

Point: 200

Solve

There are 3 role that affect user file:

  • Owner: owner of the file.
  • Group: group owner of the file.
  • Other: anyone else.

And the permission of the group denoted from left to right like example show in the image below:

alt text

In linux, permission show in two type: the decimal one and the symbol one. And in the most case, the adminstator usually using the decimal one so we will dig deeper into that.

There are 4 basic permission, each denote in decimal is:

  • read: 4 (100)
  • write: 2 (010)
  • execute: 1 (001)
  • deny: 0 (000)

Base on how we present each, we can simply take the sum of two permission to create a new complex permission. For example, the owner of the file want to have read and write file, we can represent that as 4 + 2 = 6.

So, in order to make the owner have the read, write and execute file, we can set the permission to 4 (read) + 2 ( write) + 1 (execute) = 7.

And the groups and other, the problem doesn't mention so we default to 0.

Combine all the permission above, we have the represent permission for this file is 700.

To set file, we have to use the linux grant permission call chmod, and combine with the permission above to set permission to owner read and write only, we use chmod 700. But since we not sure if we is the owner or not, let's add sudo to the first of the command

FLAG: EHCTF{sudo_chmod_700}