Page 1 of 1

(SOLVED) Stuck on a Bash tutorial (SUID)

Posted: Mon Feb 10, 2020 5:21 pm
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.

Re: Stuck on a Bash tutorial (SUID)

Posted: Mon Feb 10, 2020 5:35 pm
by MrEen
I can only guess they want you to notice the difference between ls -l /etc/passwd and ls -l /usr/bin/passwd

Re: Stuck on a Bash tutorial (SUID)

Posted: Mon Feb 10, 2020 5:58 pm
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 :?

Re: Stuck on a Bash tutorial (SUID)

Posted: Wed Feb 12, 2020 3:00 pm
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.

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

Posted: Wed Feb 12, 2020 3:31 pm
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'
$

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

Posted: Wed Feb 12, 2020 5:42 pm
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.

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

Posted: Thu Feb 13, 2020 5:01 pm
by deck_luck
If you are using the gnu coreutils the "ls" should have the same colors.