Gentoo Archives: gentoo-hardened

From: Victor Banatean <Pie_Oh_Pah@×××.net>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] Can't start eterm and xterm as normal user using X under SELinux and hardened gcc
Date: Fri, 24 Sep 2004 21:34:46
Message-Id: 4154952F.6000108@gmx.net
In Reply to: Re: [gentoo-hardened] Can't start eterm and xterm as normal user using X under SELinux and hardened gcc by Barry Dunn
1 Hi there,
2
3 thanks for your hints/help first.
4
5 >On Fri, 24 Sep 2004 16:51:11 +0200
6 >Victor Banatean <Pie_Oh_Pah@×××.net> wrote:
7 >
8 >
9 >
10 >>Hi everyone,
11 >>
12 >>I have a problem using eterm and xterm when starting X as a normal
13 >>user, as soon as I switch to root no problem at all.
14 >>
15 >>This is the error message for eterm and xterm:
16 >>Eterm: Error: Can't open pseudo-tty -- No such file or directory
17 >>Eterm: Error: Unable to run sub-command
18 >>
19 >>xterm: Error 32, errno 2: No such file or directory
20 >>Reason: get_pty: not enough ptys
21 >>
22 >>
23 >>
24 >>>
25 >>>Are you using udev-030? I had the same problem recently and
26 >>>emerging udev-032 fixed it. In both cases I had tty udev perms
27 >>>set to root:tty:0660, but I assumed the error was caused by a tty entry
28 >>>in 50-udev.rules, which in 032 was changed from
29 >>>KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k"
30 >>>to
31 >>>KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k"
32 >>>
33 >>>Hope that helps,
34 >>>
35 >>>Barry
36 >>>
37 >>>
38 >>>
39 >>>>Hi Victor,
40 >>>>
41 >>>>This sounds like you're having issues with device
42 >>>>permissions. You might be able to use "strace xterm"
43 >>>>to figure out where things get messed up. AFAIK
44 >>>>xterm will connect to /dev/tty and your user will have to
45 >>>>have rw permissions for it to do so. If your permissions
46 >>>>are different try to chmod them.
47 >>>>
48 >>>>MARKUS
49 >>>>
50 >>>>
51 >>>>This is most likely the case. The current /dev/tty in the SELinux
52 >>>>stages is 0600, when it should be 0644.
53 >>>>Whoops, I mean 0666.
54 >>>>
55 >>>>
56 >>>> -- Chris PeBenito
57 >>>
58 >>
59 >>
60
61 To get rid of the problem with the xterm there are two
62 possibilities:
63
64 1. chmod 666 /dev/tty
65 2. emerge udev-030 and process
66 "/etc/udev/permissions.d/50-udev.permissions":
67
68 # /etc/udev/udev.permissions: permission/ownership map for udev
69 # $Header:
70 /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3
71 2004/01/01 03:41:24 azarah Exp $
72
73 # console devices
74 console:root:tty:0600
75 tty:root:tty:0666 => this line is relevant
76 tty[0-9]*:root:tty:0660
77 vc/[0-9]*:root:tty:0660
78
79 At the Eterm problem I tried the following things:
80
81 1. chmod 666 /dev/ptmx and chmod 666 pty*
82 2. process the two files
83 "/etc/udev/permissions.d/50-udev.permissions" :
84
85 # /etc/udev/udev.permissions: permission/ownership map for udev
86 # $Header:
87 /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3
88 2004/01/01 03:41:24 azarah Exp $
89
90 # console devices
91 console:root:tty:0600
92 tty:root:tty:0666
93 tty[0-9]*:root:tty:0660
94 vc/[0-9]*:root:tty:0660
95
96 # pty devices
97 # Set this to 0660 if you only want users belonging to tty group
98 # to be able to allocate PTYs
99 ptmx:root:tty:0666 => relevant line, standard value
100 # pty[p-za-e][0-9a-f]*:root:tty:0660
101 pty[p-za-e][0-9a-f]*:root:tty:0666 => relevant line, I changed it to
102 this value
103 tty[p-za-e][0-9a-f]*:root:tty:0660
104 pty/m*:root:tty:0660
105 vc/s*:root:tty:0660
106
107 and "/etc/udev/rules.d/50-udev.rules" :
108
109 # /etc/udev/udev.rules: device naming rules for udev
110 #
111 # Gentoo specific rules, based a bit on devfs rules, but much simpler.
112 #
113 # There are a number of modifiers that are allowed to be used in
114 some of the
115 # fields. See the udev man page for a full description of them.
116 :
117 :
118 # pty devices
119 KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k"
120 # KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k"
121 KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" =>
122 relevant line, I changed it to this value
123 :
124 :
125
126 However there is no change, Eterm will not start, the same error message.
127
128 Nevertheless I found a solution, but I do not prefer it, so I'll will
129 try it again
130 tomorrow. If anyone have a good idea or hint,please tell it.
131
132 So my solution is to put the normal user at the "tty" group.
133 I guess this one is a bad suggestion, but it works :-D. I hope we will find
134 a better one tomorrow.
135
136 Thanks a lot for your help.
137 Good night.
138 See you tomorrow.
139
140 Victor
141
142 --
143 gentoo-hardened@g.o mailing list

Replies