How to escape from zlogin
zlogin(1M) is used to login from a global zone to a local zone. It can also be used to execute commands in a local zone. And, it can be used to login to the console of the zone.
The console is where you can see the zone boot messages and other important information. It is the equivalent of the display connected to the desktop or the serial port on a server. It is very useful tool to debug problems.
To connect to the zone console you run it like this
# zlogin -C my-local-zone
If the zone has already booted you need to press enter once to get the login prompt. There is only one small problem though.
The default escape character to get away from the console zlogin is ~. which happen to be the same as the ssh escape characters. If you ssh into the global zone and then zlogin into a local zone and press the escape characters it will kill your ssh session. Not always what you want to do.
The solution is to run zlogin like this
# zlogin -e\# -C my-local-zone
This turns the escape character into the following combination #.. Ok, I agree this is not the most practical combination either because this is the same combination used to get into the ALOM unit on most Sparc machines. But at least I very seldom work on zones when I work on the physical console of a server. So as long as you keep that in mind you should be safe.
Please take your time and read my other posts about zones, Automatic Zone Installation Part 1 and Part 2.
Do you need system administration assistance? If you like what you are reading please consider subscribing to the RSS feed. If you have feedback or if you find the article useful please leave a comment below.


You could just remember to type ~~. if you’re coming in via SSH, or you could even do “ssh -e none mysolarisbox” if you know you won’t need to ~. the ssh session.
Thanks for this post. I’ve been wondering how to get around this quirk.
cos, thanks for your advice. It is even better than my proposed solution :-).