HTB Academy Linux Fundamentals

Im having trouble answering this question guys i hope you can help me

What is the index number of the “sudoers” file in the “/etc” directory?

i used commands like ls -a, ls -n sudoers inside "/etc/ directory but nothing works i don’t know what’s the meaning of index number

4 Likes

So the index number, or inode, is a number that is unique to a file in the Unix filesystem. It is an identifying number the OS will use when storing and retrieving the data. Data has two pieces to it - the metadata (permissions, file size, etc) along with the actual data itself.

You can find the inode of a particular file by using either of the below commands:

ls -i /home/mav3n/user.txt or stat /home/mav3n/user.txt

7 Likes

Type your comment> @mav3n said:

So the index number, or inode, is a number that is unique to a file in the Unix filesystem. It is an identifying number the OS will use when storing and retrieving the data. Data has two pieces to it - the metadata (permissions, file size, etc) along with the actual data itself.

You can find the inode of a particular file by using either of the below commands:

ls -i /home/mav3n/user.txt or stat /home/mav3n/user.txt

Thank you so much bro this really helps!

1 Like

Happy to help.

Cheers!

2 Likes

Hi!
I used the two commands to get the number, and I got to the same number, the problem is that when trying to answer the question it tells me that the answer is wrong … what could be happening?.

Edit:
I check the number of the sudoers in a target machine

1 Like

@NicolasCuevas said:

Hi!
I used the two commands to get the number, and I got to the same number, the problem is that when trying to answer the question it tells me that the answer is wrong … what could be happening?.

Edit:
I check the number of the sudoers in a target machine

Chances are high that it has a different index number on each different machine.

2 Likes

First - Be sure you are shelled into the target machine.
ssh htb-student@[target ip address]

Enter password - was given to you

So, lets take the long but simple path so you can see where you are going.

Step 1.
change directory to etc
cd /etc

Step 2.
list directory contents of etc
ls

Step 3.
You will see a long list of files. Find ‘sudoers’ so you know you are in the right place.

Step 4
ls -i and find the number next to sudoers.

Thats it. A Simple way
cd /etc
ls -i

And no, HTB didnt talk about the -i anywhere that I could see.

Happy Hunting

5 Likes

the only thing you need to do is use the command ls -i /etc/sudoers

1 Like

Hi guys, I’ve got an issue

On the same question, i’ve tried both

ls -i /etc/sudoers
stat /etc/sudoers

The result is

Inode: 964110

but it don’t accept the answer! Also tried to restart the machine, but it doesn’t resolve the problem

How can I do? Is a HTB bug?

EDIT: solved accessing via ssh, it gave me another index number, wich was the right answer

1 Like

can yall help me on the question what is the index number of the sudoers file in the ect directory

1 Like

the result was 1573625

yes ! first you must spawn your ssh target .
SSH with the IP addres with user “htb-student” and password "that is given to and than search for that machine ls -i /etc/sudoers/ or stat /etc/sudoers/

1 Like

YES CONECTION LIKE THAT

ssh htb-student@10.*.*.* 

and paste the password

HTB_@cademy_stdnt!

and yep you are ready to respon the answer

ls -i /etc/sudoers
3 Likes

i did that , its says no such file or directory,

guys i followed this path :
sudo -i
(this is for root?)

-i/etc/sudoers

ls
ls -all

ls -i

stat/etc
stat /etc/sudoers

but i found the nodes and everything , and nothing works fine :frowning:

1 Like

Continuing the discussion from HTB Academy Linux Fundamentals:

Continuing the discussion from HTB Academy Linux Fundamentals:

Hi,
I’m also trouble I got a Index number, but when i put index number on answer box it tells wrong answer.
any suggestion???

the answer is:147627

  1. cd /etc
  2. ls -i
  3. You should find /sudoers and you will get 147627.

good luck !!

1 Like

Hello this answer is correct but the problem is HTB Academy VM is updated but the questions are looking answers according to old VM based on which they made questions and thats the reason everyone is getting error of wrong answer

Simple answer is

ls -i | grep -i "sudoers"

ls = listing
i = inode
| = pipe
and file name with “—”

Correct ans = 147627