1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
.\" $OpenBSD: hosts.equiv.5,v 1.7 2002/05/06 23:34:33 millert Exp $
.\"
.\" Copyright (c) 1997 Todd Vierling
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Todd Vierling <tv@pobox.com>.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 26, 1997
.Dt HOSTS.EQUIV 5
.Os
.Sh NAME
.Nm hosts.equiv ,
.Nm .rhosts
.Nd trusted remote hosts and host-user pairs
.Sh DESCRIPTION
The
.Nm hosts.equiv
and
.Nm .rhosts
files list hosts and users which are
.Dq trusted
by the local host when a connection is made via
.Xr rshd 8 ,
or any other server that uses
.Xr ruserok 3 .
This mechanism bypasses password checks, and is required for access via
.Xr rsh 1 .
.Pp
Each line of these files has the format:
.Pp
.Bd -unfilled -offset indent -compact
hostname [username]
.Ed
.Pp
The
.Ar hostname
may be specified as a host name (typically a fully qualified host
name in a DNS environment) or address,
.Ar +@netgroup
(from which only the host names are checked),
or a
.Sq +
wildcard (allow all hosts).
.Pp
The
.Ar username ,
if specified, may be given as a user name on the remote host,
.Ar +@netgroup
(from which only the user names are checked),
or a
.Sq +
wildcard (allow all remote users).
.Pp
If a
.Ar username
is specified, only that user from the specified host may login to the
local machine.
If a
.Ar username
is not specified, any user may login with the same user name.
.Sh EXAMPLES
.Li somehost
.Bd -filled -offset indent -compact
A common usage; users on
.Ar somehost
may login to the local host as the same user name.
.Ed
.Li somehost username
.Bd -filled -offset indent -compact
The user
.Ar username
on
.Ar somehost
may login to the local host.
If specified in
.Pa /etc/hosts.equiv ,
the user may login with only the same user name.
.Ed
.Li +@anetgroup username
.Bd -filled -offset indent -compact
The user
.Ar username
may login to the local host from any machine listed in the netgroup
.Ar anetgroup .
.Ed
.Bd -literal -compact
+
+ +
.Ed
.Bd -filled -offset indent -compact
Two severe security hazards.
In the first case, allows a user on any
machine to login to the local host as the same user name.
In the second
case, allows any user on any machine to login to the local host (as any
user, if in
.Pa /etc/hosts.equiv ) .
.Ed
.Sh WARNINGS
The user name checks provided by this mechanism are
.Em not
secure, as the remote user name is received by the server unchecked
for validity.
Therefore this mechanism should only be used
in an environment where all hosts are completely trusted.
.Pp
A numeric host address instead of a host name can help security
considerations somewhat; the address is then used directly by
.Xr iruserok 3 .
.Pp
When a user name (or netgroup, or
.Sq + )
is specified in
.Pa /etc/hosts.equiv ,
that user (or group of users, or all users, respectively) may login to
the local host as
.Em any local user .
Usernames in
.Pa /etc/hosts.equiv
should therefore be used with extreme caution, or not at all.
.Pp
A
.Pa .rhosts
file must be owned by the user whose home directory it resides in, and
must be writable only by that user.
.Pp
Logins as root only check root's
.Pa .rhosts
file; the
.Pa /etc/hosts.equiv
file is not checked for security.
Access permitted through root's
.Pa .rhosts
file is typically only for
.Xr rsh 1 .
.Sh FILES
.Bl -tag -width /etc/hosts.equiv -compact
.It Pa /etc/hosts.equiv
global trusted host-user pairs list
.It Pa ~/.rhosts
per-user trusted host-user pairs list
.El
.Sh SEE ALSO
.Xr rcp 1 ,
.Xr rsh 1 ,
.Xr rcmd 3 ,
.Xr ruserok 3 ,
.Xr netgroup 5
.Sh HISTORY
The
.Nm .rhosts
file format appeared in
.Bx 4.2 .
.Sh BUGS
The
.Xr ruserok 3
implementation currently skips negative entries (preceded with a
.Sq \&-
sign) and does not treat them as
.Dq short-circuit
negative entries.
|