LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-16-2005, 06:36 AM   #1
superstition
LQ Newbie
 
Registered: May 2005
Posts: 10

Rep: Reputation: 0

ex:
- --S --- --x root root test.exe

When test.exe is running, the SUID's value = 0 . However ,


- --- --S --x root root test.exe

test.exe is running, the SGID's value != 0 .

SGID's value is amazing !!

What's wrong with SGID ?

Make SGID's value become zero unless group's authority has (x) and big

S bocomes small s . - --- --s --x root root test.exe

When test.exe running ,why doen't group's authority (S)

make the SGID = 0 ??

Last edited by superstition; 08-18-2005 at 09:30 PM.
 
Old 08-17-2005, 03:18 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Ok, that made little (or no) sense to me.

However, If you set the setgid bit but NOT the group execute bit (i.e., chmod g+s,g-x), this indicates mandatory file locking on the file, and has NO impact on execution.

http://www.unix.com/showpost.php?p=73757&postcount=4
 
Old 08-18-2005, 03:51 PM   #3
superstition
LQ Newbie
 
Registered: May 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Thans for your reply. Now, I find another problem.



Normal rule:
EUID: used for privilege checks (except for the filesystem) .
ex: files's read/write/excute
FSUID:used for filesystem access checks.
ex: Filesystem Object Attributes(rwx setuid setgid user group...).

Now , suppose a user called kennedy(500) executes a program,and
its file has its setuid(root) bit set.

RUID=500 , EUID=SUID=FSUID=0.

Situation 1:
I change FSUID's value =500 ,the program
can't use function execl() to execute another file.

RUID=500,EUID=SUID=0,FSUID=500.

Situation 2:
I change EUID's value =500, the program can use
function execl() to execute any file.

RUID=500=EUID ,SUID=0,FSUID=0.

Summary:
Why checking privilege is FSUID do it not EUID?

I test many times to find out the problem about EUID/FSUID.

What's wrong with the EUID ? It confuses me !!

Please tell me the reason. -.-

Last edited by superstition; 08-18-2005 at 08:09 PM.
 
Old 08-18-2005, 05:39 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Please show sample code demonstrating this.
 
Old 08-18-2005, 06:44 PM   #5
superstition
LQ Newbie
 
Registered: May 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Situation 1 sample code:

#include<stdlib.h>
#include<unistd.h>

#include<stdio.h>
#include<sys/fsuid.h>

int main()

{


setfsuid(getuid());
int pid=fork();
if(pid==0)
{
if(execl("/root/3","3",(char*)0)==-1)
printf("failed\n");
}
while(1);

}

[root@localhost root]# ps -o ruid -o euid -o suid -o fsuid -o fname -a
RUID EUID SUID FSUID COMMAND
0 0 0 0 su
500 500 500 500 bash
500 0 0 500 1
500 0 0 500 1
0 0 0 0 ps


----------------------------------------------------------

Situation 2 sample code:

#include<stdlib.h>
#include<unistd.h>

#include<stdio.h>
#include<sys/fsuid.h>

int main()

{
int suid=geteuid();
seteuid(getuid());
setfsuid(suid);
int pid=fork();
if(pid==0)
{
if(execl("/root/3","3",(char*)0)==-1)
printf("failed\n");
}
while(1);

}

[root@localhost root]# ps -o ruid -o euid -o suid -o fsuid -o fname -a
RUID EUID SUID FSUID COMMAND
0 0 0 0 su
500 500 500 500 bash
500 500 0 0 1
500 500 500 500 3
0 0 0 0 ps


---s--s--x 1 root root 12289 8ды 19 07:41 1
---x--x--- 1 root sys 11636 8ды 18 11:08 3

1's group is root, 3's group is sys ,so compared with owner(user).

Last edited by superstition; 08-18-2005 at 11:00 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setgid: operation not permitted Johnburrell Linux From Scratch 10 03-07-2010 05:03 AM
authority: setgid is invalid to SGID superstition Linux - Security 0 08-16-2005 11:57 AM
setuid + setgid files... jd32 Linux - Security 2 10-16-2004 11:10 AM
Permissions (Setuid, Setgid, etc) Please help MelLinux Linux - General 1 10-18-2002 11:33 PM
[alert] (22) Invalid argument : setgid : unable to set group id to Group 4294967295 Niraj Linux - Networking 1 12-13-2001 06:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration