IDs associated with each process and file’s mode word

原创 2006年05月17日 21:54:00

IDs associated with each process and file’s mode word

 

IDs associated with each process

Every process has seven or more IDs associated with it. The basic seven IDs are: process ID, real IDs (real user ID, real group ID), effective IDs (effective user ID, effective group ID), saved IDs (saved set-user-ID, saved set-group-ID). The most important ID is process ID (read Process ID and special processes.doc).

 

These IDs are used for:

Process ID: distinguish one process from another

Real IDs:     identify who we really are

Effective IDs:    used for file access permission checks

Saved IDs:

 

There are corresponding get functions to get these IDs except saved IDs.

Process ID: getpid, getppid

Real IDs:     getuid, getgid

Effective IDs:    geteuid, getegid

"Note that none of these functions has an error return."

 

The other six IDs are initialized as follows:

Real IDs:     "taken from our entry in the password file when we log in."

Effective IDs:    "Normally, the effective user ID equals the real user ID, and the effective group ID equals the real group ID."

Saved IDs: "contain copies of the effective user ID and the effective group ID when a program is executed."

 

File's mode word

Position:

File's mode word is the i_mode member of the ext3_inode structure and can be copied to the st_mode member of the stat structure using one of the stat functions. It is called word because the i_mode member is 16 bits.

 

Bits:

15-12: file type bits

11: set-user-ID bit

10: set-group-ID bit

9: sticky bit

8-0: access permission bits

           8 7 6: owner access permission

           5 4 3: group access permission

           2 1 0: other access permission

 

Associated command(s) & function(s)

chmod(1), chmod(2), fchmod(2)

NOTE: These can only change low 12 bits of file's mode word.

 

[important]Relationship between set-user-ID bit, set-group-ID bit in a file's mode word and effective IDs associated with the process executing this file.

If the set-user-ID bit in a file's mode word is set to 1, the effective user ID associated with the process executing this file will change to the user ID of the file's owner. Same with the set-group-ID bit.

Example

下面是文件A对应的struct ext3_inode中的i_mode member,也就是文件A的文件模式字:

1000110110110100

"4-3-9"分段看

1000 100 110110100

a) regular file

b) 执行该文件的进程的effective user ID会改变,而effective group ID不会。

c) rw-rw-r--

mode > type

相关文章推荐

home-ids-with-snort-and-snorby

参考: https://techanarchy.net/2015/01/home-ids-with-snort-and-snorby/需要的组件 snort 监控原始流量,并将原始流量与rules对...

struts 配置出现错误 There is no Action mapped for namespace [/] and action name [findPage] associated with

struts配置报错,其中的一种解决方案, struts PUBLIC "-//Apache Software Foundation//DTD Struts Configura...

There is no Action mapped for namespace [/] and action name [hello] associated with context path [/d

下午在做struts2的demo时遇到以下问题: There is no Action mapped for namespace [/] and action name [Login] asso...

There is no Action mapped for namespace [/] and action name [hello2] associated with context path [/

There is no Action mapped for namespace [/] and action name [Login] associated with context path [/e

昨晚学习web开发时,就遇到这个令人头疼的问题。 百度谷歌了

iOS 上架报错:PLA 1.2 The seller and company names associated with your app do not reflect the name “XX"

app属于金融类的,第一次提交被拒: PLA 1.2 The seller and company names associated with your app do not reflect the...

使用Struts2时出现There is no Action mapped for namespace [/] and action name [??] associated with conte

今天开始学习Struts2,看着视频学,在学到Struts2的action的配置时,遇到一个问题,即标题所示,找了一个多钟的错,才发现哪里出错了。 There is no Action mapped ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:IDs associated with each process and file’s mode word
举报原因:
原因补充:

(最多只允许输入30个字)