1 '\" te
   2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
   3 .\" The contents of this file are subject to the terms of the Common
   4 .\" Development and Distribution License (the "License").  You may not use this
   5 .\" file except in compliance with the License.
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or
   7 .\" http://www.opensolaris.org/os/licensing.  See the License for the specific
   8 .\" language governing permissions and limitations under the License.
   9 .\" When distributing Covered Code, include this CDDL HEADER in each file and
  10 .\" include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable,
  11 .\" add the following below this CDDL HEADER, with the fields enclosed by
  12 .\" brackets "[]" replaced with your own identifying information:
  13 .\" Portions Copyright [yyyy] [name of copyright owner]
  14 .\" Copyright 2013 DEY Storage Systems, Inc.
  15 .\" Copyright (c) 2014 Gary Mills
  16 .TH ZLOGIN 1 "Jan 22, 2014"
  17 .SH NAME
  18 zlogin \- enter a zone
  19 .SH SYNOPSIS
  20 .LP
  21 .nf
  22 \fBzlogin\fR [\fB-CEQ\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR
  23 .fi
  24 
  25 .LP
  26 .nf
  27 \fBzlogin\fR [\fB-nEQS\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR \fIutility\fR
  28      [\fIargument\fR]...
  29 .fi
  30 
  31 .SH DESCRIPTION
  32 .sp
  33 .LP
  34 The \fBzlogin\fR utility is used by the administrator to enter an operating
  35 system zone. Only a superuser operating in the global system zone can use this
  36 utility.
  37 .sp
  38 .LP
  39 \fBzlogin\fR operates in one of three modes:
  40 .sp
  41 .ne 2
  42 .na
  43 \fBInteractive Mode\fR
  44 .ad
  45 .RS 24n
  46 If no utility argument is given and the stdin file descriptor for the
  47 \fBzlogin\fR process is a tty device, \fBzlogin\fR operates in \fBinteractive
  48 mode\fR. In this mode, \fBzlogin\fR creates a new pseudo terminal for use
  49 within the login session. Programs requiring a tty device, for example,
  50 \fBvi\fR(1), work properly in this mode. In this mode, \fBzlogin\fR invokes
  51 \fBlogin\fR(1) to provide a suitable login session.
  52 .RE
  53 
  54 .sp
  55 .ne 2
  56 .na
  57 \fBNon-Interactive Mode\fR
  58 .ad
  59 .RS 24n
  60 If a utility is specified, \fBzlogin\fR operates in \fBnon-interactive mode\fR.
  61 This mode can be useful for script authors since stdin, stdout, and stderr are
  62 preserved and the exit status of \fIutility\fR is returned upon termination. In
  63 this mode, \fBzlogin\fR invokes \fBsu\fR(1M) in order to set up the user's
  64 environment and to provide a login environment.
  65 .sp
  66 The specified command is passed as a string and interpreted by a shell running
  67 in the non-global zone. See \fBrsh\fR(1).
  68 .RE
  69 
  70 .sp
  71 .ne 2
  72 .na
  73 \fBConsole Mode\fR
  74 .ad
  75 .RS 24n
  76 If the \fB-C\fR option is specified, the user is connected to the zone console
  77 device and \fBzlogin\fR operates in \fBconsole mode\fR. The zone console is
  78 available once the zone is in the installed  state. Connections to the console
  79 are persistent across reboot of the zone.
  80 .RE
  81 
  82 .SH OPTIONS
  83 .sp
  84 .LP
  85 The following options are supported:
  86 .sp
  87 .ne 2
  88 .na
  89 \fB\fB-C\fR\fR
  90 .ad
  91 .RS 15n
  92 Connects to the zone console.
  93 .RE
  94 
  95 .sp
  96 .ne 2
  97 .na
  98 \fB\fB-e\fR \fIc\fR\fR
  99 .ad
 100 .RS 15n
 101 Specifies a different escape character, \fIc\fR, for the key sequence used to
 102 access extended functions and to disconnect from the login. The default escape
 103 character is the tilde (\fB~\fR).
 104 .RE
 105 
 106 .sp
 107 .ne 2
 108 .na
 109 \fB\fB-E\fR\fR
 110 .ad
 111 .RS 15n
 112 Disables the ability to access extended functions or to disconnect from the
 113 login by using the escape sequence character.
 114 .RE
 115 
 116 .sp
 117 .ne 2
 118 .na
 119 \fB\fB-l\fR \fIusername\fR\fR
 120 .ad
 121 .RS 15n
 122 Specifies a different \fIusername\fR for the zone login. If you do not use this
 123 option, the zone username used is "root". This option is invalid if the
 124 \fB-C\fR option is specified.
 125 .RE
 126 
 127 .sp
 128 .ne 2
 129 .na
 130 \fB-n\fR
 131 .ad
 132 .RS 15n
 133 Redirect the input of \fBzlogin\fR to \fB/dev/null\fR.
 134 This option is useful when the command running in the local zone
 135 and the shell which invokes \fBzlogin\fR both read from standard input.
 136 .RE
 137 
 138 .sp
 139 .ne 2
 140 .na
 141 \fB-Q\fR
 142 .ad
 143 .RS 15n
 144 Specifies quiet mode operation.  In quiet mode, extra messages indicating the
 145 the function of \fBzlogin\fR will not be displayed, giving the possibility
 146 to present the appearance that the command is running locally rather than
 147 in another zone.
 148 .RE
 149 
 150 .sp
 151 .ne 2
 152 .na
 153 \fB\fB-S\fR\fR
 154 .ad
 155 .RS 15n
 156 "Safe" login mode. \fBzlogin\fR does minimal processing and does not invoke
 157 \fBlogin\fR(1) or \fBsu\fR(1M). The \fB-S\fR option can not be used if a
 158 username is specified through the \fB-l\fR option, and cannot be used with
 159 console logins. This mode should only be used to recover a damaged zone when
 160 other forms of login have become impossible.
 161 .RE
 162 
 163 .SS "Escape Sequences"
 164 .sp
 165 .LP
 166 Lines that you type that start with the tilde character (\fB~\fR) are "escape
 167 sequences". The escape character can be changed using the \fB-e\fR option.
 168 .sp
 169 .ne 2
 170 .na
 171 \fB\fB~.\fR\fR
 172 .ad
 173 .RS 6n
 174 Disconnects from the zone. This is not the same as a logout, because the local
 175 host breaks the connection with no warning to the zone's end.
 176 .RE
 177 
 178 .SH SECURITY
 179 .sp
 180 .LP
 181 Once a process has been placed in a zone other than the global zone, the
 182 process cannot change zone again, nor can any of its children.
 183 .SH OPERANDS
 184 .sp
 185 .LP
 186 The following operands are supported:
 187 .sp
 188 .ne 2
 189 .na
 190 \fB\fIzonename\fR\fR
 191 .ad
 192 .RS 15n
 193 The name of the zone to be entered.
 194 .RE
 195 
 196 .sp
 197 .ne 2
 198 .na
 199 \fB\fIutility\fR\fR
 200 .ad
 201 .RS 15n
 202 The utility to be run in the specified zone.
 203 .RE
 204 
 205 .sp
 206 .ne 2
 207 .na
 208 \fB\fIargument...\fR\fR
 209 .ad
 210 .RS 15n
 211 Arguments passed to the utility.
 212 .RE
 213 
 214 .SH EXIT STATUS
 215 .sp
 216 .LP
 217 In interactive and non-interactive modes, the \fBzlogin\fR utility exits when
 218 the command or shell in the non-global zone exits. In non-interactive mode, the
 219 exit status of the remote program is returned as the exit status of
 220 \fBzlogin\fR. In interactive mode and console login mode, the exit status is
 221 not returned. \fBzlogin\fR returns a \fB0\fR exit status as long as no
 222 connection-related error occurred.
 223 .sp
 224 .LP
 225 In all modes, in the event that a connection to the zone cannot be established,
 226 the connection fails unexpectedly, or the user is lacking sufficient privilege
 227 to perform the requested operation, \fBzlogin\fR exits with status \fB1\fR.
 228 .sp
 229 .LP
 230 To summarize, the following exit values are returned:
 231 .sp
 232 .ne 2
 233 .na
 234 \fB\fB0\fR\fR
 235 .ad
 236 .RS 7n
 237 Successful entry.
 238 .RE
 239 
 240 .sp
 241 .ne 2
 242 .na
 243 \fB\fB1\fR\fR
 244 .ad
 245 .RS 7n
 246 Permission denied, or failure to enter the zone.
 247 .RE
 248 
 249 .sp
 250 .ne 2
 251 .na
 252 \fBAny\fR
 253 .ad
 254 .RS 7n
 255 Return code from utility, or from \fBsu\fR(1M) if operating in non-interactive
 256 mode.
 257 .RE
 258 
 259 .SH ATTRIBUTES
 260 .sp
 261 .LP
 262 See \fBattributes\fR(5) for descriptions of the following attributes:
 263 .sp
 264 
 265 .sp
 266 .TS
 267 box;
 268 c | c
 269 l | l .
 270 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 271 _
 272 Interface Stability     Evolving
 273 .TE
 274 
 275 .SH SEE ALSO
 276 .sp
 277 .LP
 278 \fBlogin\fR(1), \fBrsh\fR(1), \fBvi\fR(1), \fBsu\fR(1M), \fBzoneadm\fR(1M),
 279 \fBzonecfg\fR(1M), \fBattributes\fR(5), \fBzones\fR(5)
 280 .SH NOTES
 281 .sp
 282 .LP
 283 \fBzlogin\fR fails if its open files or any portion of its address space
 284 corresponds to an NFS file. This includes the executable itself or the shared
 285 libraries.