why there is a only_changed_user in restorecon?
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.
Quoted 11 lines · Liu Jian
I wonder why there is special check on the
only_changed_userin the restorecon. After
'chcon -usysterm_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_contextfor customizable files, or the user section, if it has changed.
...Yes, we can 'restorcecon -F
/home/user/file' get the original labelBut 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.