Article 4PX1S SUID more explanation needed

SUID more explanation needed

by
makupl
from LinuxQuestions.org on (#4PX1S)
I'm trying to understand SUID functionality.

So what I try is to create script.sh which modifies let say file a.txt.
The script.sh is owned by specific user, let say test1 and group test1. Also file a.txt is same user and group. Now I do not allow to write for other users to file a.txt, however I set rws------ on script.sh (SUID is set)
File a.txt has permissions rwxr--r--. Now when I execute script.sh as user test2 I got permission error on a.txt.
I understood execution of script.sh is fired from user test2 but as it was run by user test1 who actually has write permisions to a.txt file.
Must be I understand it wrongly. I understood user test2 can't modify a.txt file directly but using script.sh may change accordingly if script.sh requires it.latest?d=yIl2AUoC8zA latest?i=QrZAgqCO4jI:chomHWIQC-0:F7zBnMy latest?i=QrZAgqCO4jI:chomHWIQC-0:V_sGLiP latest?d=qj6IDK7rITs latest?i=QrZAgqCO4jI:chomHWIQC-0:gIN9vFwQrZAgqCO4jI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments