(SOLVED) Stuck on a Bash tutorial (SUID)

Forum rules
Before you post please read how to get help
Post Reply
DDB
Level 1
Level 1
Posts: 13
Joined: Mon Feb 03, 2020 4:07 pm

(SOLVED) Stuck on a Bash tutorial (SUID)

Post by DDB »

Hi,

I am doing the following tutorial regarding SUID: https://linuxjourney.com/lesson/setuid-set-user-id

I am stuck on the exercise on the right. "Look at the permission for /etc/passwd in detail, do you notice anything else? Files with SUID enabled are also easily distinguishable."

Looking at the below file, I am struggling to find anything significant regarding it? The root can read and write, everyone else can read the file.
-rw-r--r-- 1 root root 2487 Feb 1 13:29 /etc/passwd

Does anyone have any idea what the question is referring to?

Thank you.
Last edited by DDB on Wed Feb 12, 2020 3:00 pm, edited 1 time in total.

User avatar
MrEen
Level 17
Level 17
Posts: 7065
Joined: Mon Jun 12, 2017 8:39 pm

Re: Stuck on a Bash tutorial (SUID)

Post by MrEen »

I can only guess they want you to notice the difference between ls -l /etc/passwd and ls -l /usr/bin/passwd

User avatar
WharfRat
Level 21
Level 21
Posts: 13770
Joined: Thu Apr 07, 2011 8:15 pm

Re: Stuck on a Bash tutorial (SUID)

Post by WharfRat »

Since it states
Files with SUID enabled are also easily distinguishable
maybe it's referring to the red color of a file with the suid set :?
ImageImage

DDB
Level 1
Level 1
Posts: 13
Joined: Mon Feb 03, 2020 4:07 pm

Re: Stuck on a Bash tutorial (SUID)

Post by DDB »

WharfRat wrote:
Mon Feb 10, 2020 5:58 pm
Since it states
Files with SUID enabled are also easily distinguishable
maybe it's referring to the red color of a file with the suid set :?
I think this must be it. I did not realise files with SUID permissions were red.

Thank you. I will mark as solved.

User avatar
deck_luck
Level 4
Level 4
Posts: 423
Joined: Mon May 27, 2019 6:57 pm
Location: here

Re: (SOLVED) Stuck on a Bash tutorial (SUID)

Post by deck_luck »

I think Mr Een reply is the most plausible. I believe they are attempting to demonstrate the permission bits. When the suid bit is set, it has the "S" character where the x or normal executable bit usually resides.
For example:

Code: Select all

$ ls -l *suid*
-rwx------ 1 root root 0 Feb 12 13:17 mynosuid
-rwS------ 1 root root 0 Feb 12 13:17 mysuid
$
Likewise, it is great to have the "ls -l" command display the file in red. However, do not expect it to be in red unless the "ls" color option has been enable. Most Linux Mint distros will have an alias to enable the "ls" color capability whenever using a plain "ls" command.

Code: Select all

$alias ls
ls='ls --color=auto'
$
💡Give a man a fish, and you feed him for a day. Teach a man to fish, and you feed him for a lifetime. ✝️ 🐧Linux Mint 19.1 XFCE
How to get help How to mark topic as [Solved]

DDB
Level 1
Level 1
Posts: 13
Joined: Mon Feb 03, 2020 4:07 pm

Re: (SOLVED) Stuck on a Bash tutorial (SUID)

Post by DDB »

I see. I think I was probably just overthinking the question and I'm pretty happy with that topic now.

On the subject of colours in the terminal however. Are all these colours standard? Are they the same across distros? I noticed in the terminal preferences you can change colour palettes? It seems to me if they are not standardised it might not be that useful a feature.

Many thanks.

User avatar
deck_luck
Level 4
Level 4
Posts: 423
Joined: Mon May 27, 2019 6:57 pm
Location: here

Re: (SOLVED) Stuck on a Bash tutorial (SUID)

Post by deck_luck »

If you are using the gnu coreutils the "ls" should have the same colors.
💡Give a man a fish, and you feed him for a day. Teach a man to fish, and you feed him for a lifetime. ✝️ 🐧Linux Mint 19.1 XFCE
How to get help How to mark topic as [Solved]

Post Reply

Return to “Scripts & Bash”