Skip to contentSkip to conversation

why there is a only_changed_user in restorecon?

DISCUSSION Liu Jian 2 participants 2 messages Aug 20, 2007 SELinux security module

lore
Share & tools
lore

Liu Jian

author
#0 lore raw

I wonder why there is special check on the only_changed_user in the restorecon. After
'chcon -u systerm_u /home/user/file', the secruity label of the file is changed from 'user_u:object_r:user_home_t' to 'system_u:object_r:user_home_t'. But 'restorecon /home/user/file' can not restore its label to original.

'man restorecon', you can see:

...

-F Force reset of context to match file_context for customizable files, or the user section, if it has changed.
...

Yes, we can 'restorcecon -F /home/user/file' get the original label

But why there is special check on the only_changed_user? any reason...

Signature · 8 lines
by Liu Jian
----------
email to: [email protected]

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 11 lines · Liu Jian

I wonder why there is special check on the only_changed_user in the restorecon. After
'chcon -u systerm_u /home/user/file', the secruity label of the file is changed from 'user_u:object_r:user_home_t' to 'system_u:object_r:user_home_t'. But 'restorecon /home/user/file' can not restore its label to original.

'man restorecon', you can see:

...

Quoted 8 lines

-F Force reset of context to match file_context for customizable files, or the user section, if it has changed.
...

Yes, we can 'restorcecon -F /home/user/file' get the original label

But why there is special check on the only_changed_user? any reason...

As I recall, it was to avoid extraneous relabeling of files. New files inherit the SELinux user of the creating process, and thus may not correspond with the initial state defined in the file_contexts specification.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.