[Nottingham] suid / sgid file params puzzle ... or a bug?

Martin martin at ml1.co.uk
Fri May 28 10:46:19 BST 2004


Folks,

I'm trying to use the set user id and set group id bits, but this
doesn't work as I expected...


A bash script run as root calls a program that has the suid and sgid
bits set. Eg:

#!/bin/bash
/home/user1/FAH4Console-Linux.exe &

And ls -l gives:

-rwsr-s---  1 user1 user1 241K Mar 23 21:16 FAH4Console-Linux.exe*

The FAH4Console-Linux.exe runs as user1 ok. However, other programs that
are then called up by FAH4Console-Linux.exe run as root!

(The FAH4Console-Linux.exe is a binary prog.)

One way round this is to use:
su --command=$fah4 user1

(where $fah4 is /home/user1/FAH4Console-Linux.exe)

Then, all the programs run as user1 as expected.


So, what's happening?
What's the difference between the two??


Bemused,
Martin


-- 
----------------
Martin Lomas
martin at ml1.co.uk
----------------



More information about the Nottingham mailing list