0

I created two file , one abc.sh and another myfile . The content of abc.sh is :

#!/bin/bash
echo "hi" >> myfile

The current permission and owner for both file is: abc.sh : rwsrw-r-x owner -> main(user) main(group)

myfile : -rw-rw-r-- owner -> main(user) main(group)

Note : the setuid bit is set on abc.sh file.

Now , if login as user user2 and run abc.sh file as user2 who is not owner and does not belong to group . I expect the script to be run successfully and content to be updated in myfile ,since the setuid is set and script will run as user main. also myfile has write permission for main user .

However , I still get permission denied error ? What is the reason for it ? please , correct me if I am mistaken.

0 Answers0