chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp'
Clash Royale CLAN TAG#URR8PPP
up vote
6
down vote
favorite
Whenever I'm trying to execute this line to configure SELinux to install xrdp from this tutorial:
# chcon --type=bin_t /usr/sbin/xrdp
# chcon --type=bin_t /usr/sbin/xrdp-sesman
I get these errors:
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp'
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp-sesman'
Any help will be much appreciated
I'm on CentOS 7.2 64 bit.
If you need any more details ask them in the comments and I will reply asap.
linux centos selinux
add a comment |
up vote
6
down vote
favorite
Whenever I'm trying to execute this line to configure SELinux to install xrdp from this tutorial:
# chcon --type=bin_t /usr/sbin/xrdp
# chcon --type=bin_t /usr/sbin/xrdp-sesman
I get these errors:
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp'
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp-sesman'
Any help will be much appreciated
I'm on CentOS 7.2 64 bit.
If you need any more details ask them in the comments and I will reply asap.
linux centos selinux
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
Whenever I'm trying to execute this line to configure SELinux to install xrdp from this tutorial:
# chcon --type=bin_t /usr/sbin/xrdp
# chcon --type=bin_t /usr/sbin/xrdp-sesman
I get these errors:
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp'
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp-sesman'
Any help will be much appreciated
I'm on CentOS 7.2 64 bit.
If you need any more details ask them in the comments and I will reply asap.
linux centos selinux
Whenever I'm trying to execute this line to configure SELinux to install xrdp from this tutorial:
# chcon --type=bin_t /usr/sbin/xrdp
# chcon --type=bin_t /usr/sbin/xrdp-sesman
I get these errors:
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp'
chcon: can't apply partial context to unlabeled file '/usr/sbin/xrdp-sesman'
Any help will be much appreciated
I'm on CentOS 7.2 64 bit.
If you need any more details ask them in the comments and I will reply asap.
linux centos selinux
linux centos selinux
edited Mar 16 '17 at 12:08
fedorqui
3,97221955
3,97221955
asked Apr 5 '16 at 8:23
TheOnlyOne
31112
31112
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
4
down vote
Your command has to give more information. It has been discussed before (but I see no duplicates).
For example,
- in chcon: can't apply partial context to unlabeled file while installing nagios with SELinux, Sergei Lomakov pointed out that it was first necessary to label the files using
semanage
. - in Linux chcon: can't apply partial context to unlabeled file, the suggested solution uses the complete type in the
chcon
command (but you would have to first determine the type usingls -Z
). The complete type would usually have a colon (:
) in the name, because it represents a hierarchy.
For example, ls -lZ
gives these tags for a sample listing:
$ ls -lZ msginit msgmerge msgunfmt
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msginit
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgmerge
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgunfmt
and chcon
is expecting something like unconfined_u:object_r:bin_t:s0
in its argument. A bin_t
is only partial information.
The referenced procedure should have worked, and the use of chcon
redundant. Checking my CentOS7, I happen to have xrdp
installed, and a listing shows
$ ls -lZ xrdp xrdp-chansrv xrdp-sesman xrdp-sessvc
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-chansrv
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sesman
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sessvc
The system_u
field is the SELinux user, the object_r
field is the role, bin_t
is the type and s0
is the (default) level. The files in /usr/sbin
get their context from a pattern shown by semanage fcontext -l
(but there are a lot of matches). In following the guide, you may have removed the pattern for the xrdp
— or even for /usr/sbin
. However, you can be more explicit in the command, by specifying the user and role using chcon
:
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp-sesman
Alternatively, if the patterns are intact but (for instance) you had moved the files rather than installing them, you could repair things using
restorecon -v /usr/sbin/xrdp
restorecon -v /usr/sbin/xrdp-sesman
Further reading:
- 5.6. SELinux Contexts – Labeling Files
- 5.6.2. Persistent Changes: semanage fcontext
restorecon
- restore file(s) default SELinux security contexts.chcon
- change file SELinux security context
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
add a comment |
up vote
2
down vote
I'm also on CentOS 7, and this works for me:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
add a comment |
up vote
-1
down vote
It might help someone, so here is my simple 2 cents. If you somehow disabled selinux, you might face this issue. to resolve this, just change the selinux back to normal.
open
/etc/selinux/config
and change
SELINUX=disabled
back to
SELINUX=enforcing
Hope this helps someone.
New contributor
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Your command has to give more information. It has been discussed before (but I see no duplicates).
For example,
- in chcon: can't apply partial context to unlabeled file while installing nagios with SELinux, Sergei Lomakov pointed out that it was first necessary to label the files using
semanage
. - in Linux chcon: can't apply partial context to unlabeled file, the suggested solution uses the complete type in the
chcon
command (but you would have to first determine the type usingls -Z
). The complete type would usually have a colon (:
) in the name, because it represents a hierarchy.
For example, ls -lZ
gives these tags for a sample listing:
$ ls -lZ msginit msgmerge msgunfmt
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msginit
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgmerge
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgunfmt
and chcon
is expecting something like unconfined_u:object_r:bin_t:s0
in its argument. A bin_t
is only partial information.
The referenced procedure should have worked, and the use of chcon
redundant. Checking my CentOS7, I happen to have xrdp
installed, and a listing shows
$ ls -lZ xrdp xrdp-chansrv xrdp-sesman xrdp-sessvc
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-chansrv
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sesman
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sessvc
The system_u
field is the SELinux user, the object_r
field is the role, bin_t
is the type and s0
is the (default) level. The files in /usr/sbin
get their context from a pattern shown by semanage fcontext -l
(but there are a lot of matches). In following the guide, you may have removed the pattern for the xrdp
— or even for /usr/sbin
. However, you can be more explicit in the command, by specifying the user and role using chcon
:
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp-sesman
Alternatively, if the patterns are intact but (for instance) you had moved the files rather than installing them, you could repair things using
restorecon -v /usr/sbin/xrdp
restorecon -v /usr/sbin/xrdp-sesman
Further reading:
- 5.6. SELinux Contexts – Labeling Files
- 5.6.2. Persistent Changes: semanage fcontext
restorecon
- restore file(s) default SELinux security contexts.chcon
- change file SELinux security context
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
add a comment |
up vote
4
down vote
Your command has to give more information. It has been discussed before (but I see no duplicates).
For example,
- in chcon: can't apply partial context to unlabeled file while installing nagios with SELinux, Sergei Lomakov pointed out that it was first necessary to label the files using
semanage
. - in Linux chcon: can't apply partial context to unlabeled file, the suggested solution uses the complete type in the
chcon
command (but you would have to first determine the type usingls -Z
). The complete type would usually have a colon (:
) in the name, because it represents a hierarchy.
For example, ls -lZ
gives these tags for a sample listing:
$ ls -lZ msginit msgmerge msgunfmt
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msginit
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgmerge
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgunfmt
and chcon
is expecting something like unconfined_u:object_r:bin_t:s0
in its argument. A bin_t
is only partial information.
The referenced procedure should have worked, and the use of chcon
redundant. Checking my CentOS7, I happen to have xrdp
installed, and a listing shows
$ ls -lZ xrdp xrdp-chansrv xrdp-sesman xrdp-sessvc
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-chansrv
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sesman
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sessvc
The system_u
field is the SELinux user, the object_r
field is the role, bin_t
is the type and s0
is the (default) level. The files in /usr/sbin
get their context from a pattern shown by semanage fcontext -l
(but there are a lot of matches). In following the guide, you may have removed the pattern for the xrdp
— or even for /usr/sbin
. However, you can be more explicit in the command, by specifying the user and role using chcon
:
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp-sesman
Alternatively, if the patterns are intact but (for instance) you had moved the files rather than installing them, you could repair things using
restorecon -v /usr/sbin/xrdp
restorecon -v /usr/sbin/xrdp-sesman
Further reading:
- 5.6. SELinux Contexts – Labeling Files
- 5.6.2. Persistent Changes: semanage fcontext
restorecon
- restore file(s) default SELinux security contexts.chcon
- change file SELinux security context
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
add a comment |
up vote
4
down vote
up vote
4
down vote
Your command has to give more information. It has been discussed before (but I see no duplicates).
For example,
- in chcon: can't apply partial context to unlabeled file while installing nagios with SELinux, Sergei Lomakov pointed out that it was first necessary to label the files using
semanage
. - in Linux chcon: can't apply partial context to unlabeled file, the suggested solution uses the complete type in the
chcon
command (but you would have to first determine the type usingls -Z
). The complete type would usually have a colon (:
) in the name, because it represents a hierarchy.
For example, ls -lZ
gives these tags for a sample listing:
$ ls -lZ msginit msgmerge msgunfmt
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msginit
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgmerge
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgunfmt
and chcon
is expecting something like unconfined_u:object_r:bin_t:s0
in its argument. A bin_t
is only partial information.
The referenced procedure should have worked, and the use of chcon
redundant. Checking my CentOS7, I happen to have xrdp
installed, and a listing shows
$ ls -lZ xrdp xrdp-chansrv xrdp-sesman xrdp-sessvc
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-chansrv
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sesman
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sessvc
The system_u
field is the SELinux user, the object_r
field is the role, bin_t
is the type and s0
is the (default) level. The files in /usr/sbin
get their context from a pattern shown by semanage fcontext -l
(but there are a lot of matches). In following the guide, you may have removed the pattern for the xrdp
— or even for /usr/sbin
. However, you can be more explicit in the command, by specifying the user and role using chcon
:
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp-sesman
Alternatively, if the patterns are intact but (for instance) you had moved the files rather than installing them, you could repair things using
restorecon -v /usr/sbin/xrdp
restorecon -v /usr/sbin/xrdp-sesman
Further reading:
- 5.6. SELinux Contexts – Labeling Files
- 5.6.2. Persistent Changes: semanage fcontext
restorecon
- restore file(s) default SELinux security contexts.chcon
- change file SELinux security context
Your command has to give more information. It has been discussed before (but I see no duplicates).
For example,
- in chcon: can't apply partial context to unlabeled file while installing nagios with SELinux, Sergei Lomakov pointed out that it was first necessary to label the files using
semanage
. - in Linux chcon: can't apply partial context to unlabeled file, the suggested solution uses the complete type in the
chcon
command (but you would have to first determine the type usingls -Z
). The complete type would usually have a colon (:
) in the name, because it represents a hierarchy.
For example, ls -lZ
gives these tags for a sample listing:
$ ls -lZ msginit msgmerge msgunfmt
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msginit
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgmerge
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 msgunfmt
and chcon
is expecting something like unconfined_u:object_r:bin_t:s0
in its argument. A bin_t
is only partial information.
The referenced procedure should have worked, and the use of chcon
redundant. Checking my CentOS7, I happen to have xrdp
installed, and a listing shows
$ ls -lZ xrdp xrdp-chansrv xrdp-sesman xrdp-sessvc
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-chansrv
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sesman
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 xrdp-sessvc
The system_u
field is the SELinux user, the object_r
field is the role, bin_t
is the type and s0
is the (default) level. The files in /usr/sbin
get their context from a pattern shown by semanage fcontext -l
(but there are a lot of matches). In following the guide, you may have removed the pattern for the xrdp
— or even for /usr/sbin
. However, you can be more explicit in the command, by specifying the user and role using chcon
:
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp
chcon -u system_u -r object_r --type=bin_t /usr/sbin/xrdp-sesman
Alternatively, if the patterns are intact but (for instance) you had moved the files rather than installing them, you could repair things using
restorecon -v /usr/sbin/xrdp
restorecon -v /usr/sbin/xrdp-sesman
Further reading:
- 5.6. SELinux Contexts – Labeling Files
- 5.6.2. Persistent Changes: semanage fcontext
restorecon
- restore file(s) default SELinux security contexts.chcon
- change file SELinux security context
edited May 23 '17 at 12:39
Community♦
1
1
answered Apr 5 '16 at 8:35
Thomas Dickey
51.4k594164
51.4k594164
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
add a comment |
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
3
3
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
I still don't get it , Can you tell me what command would be the fix for it then ? as I'm not really familiar with linux Neither SELinux :(
– TheOnlyOne
Apr 5 '16 at 14:57
add a comment |
up vote
2
down vote
I'm also on CentOS 7, and this works for me:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
add a comment |
up vote
2
down vote
I'm also on CentOS 7, and this works for me:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
add a comment |
up vote
2
down vote
up vote
2
down vote
I'm also on CentOS 7, and this works for me:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
I'm also on CentOS 7, and this works for me:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
answered Dec 20 '17 at 4:49
Thinh Phan
243
243
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
add a comment |
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
While Thomas gave a pretty comprehensive answer, the solution is not that straightforward. I had to do a lot of try and error till I reached these two commands, which are actually working
– Adelin
Feb 13 at 10:19
add a comment |
up vote
-1
down vote
It might help someone, so here is my simple 2 cents. If you somehow disabled selinux, you might face this issue. to resolve this, just change the selinux back to normal.
open
/etc/selinux/config
and change
SELINUX=disabled
back to
SELINUX=enforcing
Hope this helps someone.
New contributor
add a comment |
up vote
-1
down vote
It might help someone, so here is my simple 2 cents. If you somehow disabled selinux, you might face this issue. to resolve this, just change the selinux back to normal.
open
/etc/selinux/config
and change
SELINUX=disabled
back to
SELINUX=enforcing
Hope this helps someone.
New contributor
add a comment |
up vote
-1
down vote
up vote
-1
down vote
It might help someone, so here is my simple 2 cents. If you somehow disabled selinux, you might face this issue. to resolve this, just change the selinux back to normal.
open
/etc/selinux/config
and change
SELINUX=disabled
back to
SELINUX=enforcing
Hope this helps someone.
New contributor
It might help someone, so here is my simple 2 cents. If you somehow disabled selinux, you might face this issue. to resolve this, just change the selinux back to normal.
open
/etc/selinux/config
and change
SELINUX=disabled
back to
SELINUX=enforcing
Hope this helps someone.
New contributor
New contributor
answered Nov 19 at 4:03
Md. Tawfiqul Bari
1
1
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f274360%2fchcon-cant-apply-partial-context-to-unlabeled-file-usr-sbin-xrdp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown