Virtuozzo(tm) have one very intresting feature: you can log into namebased site by SSH with only one SSH instance, runned on host.
So you have not need to have several ports for SSH access.
For VServer I have found tool, created by Alec Thomas (you can find it here: http://swapoff.org/LinuxVServer.html) that allow to do that (or close to that) on linux-vserver.
I have made small change in vslogin: it get gecos field of user, that named in environment variable LOGNAME, not via userid, so all vserver users are now have one uid - 9999 on vserver host.
There also created passwd and shadow sync daemon in perl, that update host /etc/passwd and /etc/shadow with contents of vservers' passwd and shadow.
But, better to use nss_vserver module, get info on it at Howto_HostAuth
So, to get one auth point for all users - host ssh (in general - anything, that can auth, can be authorized via PAM on host), you need to:
- install SGI::FAM and Proc::Daemon from CPAN.
- copy syncshadows daemon to /usr/local/sbin
- copy syncshadows init.d script ot /etc/init.d/ (or /etc/rc.d/init.d)
- create links to it from rcX.d directiories (/etc/rcX.d or /etc/rc.d/rcX.d/)
- Run /etc/init.d/syncshadows start
- run "make" at vslogin directory and copy vslogin binary to /sbin/
- chmod u+s /sbin/vslogin
- chmod o-rwx /sbin/vslogin; chgrp vslogin /sbin/vslogin to allow /sbin/vslogin execution only by users in group vserver. needs vslogin group, but you'll have it "automatically" if nss_vserver is configured!
- echo /sbin/vslogin >> /etc/shells
That's all! Now you can log into your vserver by run
- on host created stubs in form user@vserver and vserver-user for allowing to use domain form where available, and just dash form where not available.
Download vslogin and syncshadows daemon at http://dev.call2ru.com/vserverauth.tar.gz
When you SSH to a server you get an IP number. This IP number can be used to select which of the VServers you want to connect to. Of course this only works if each of the VServers have an individual IP number.
The process is as follows:
- Setup SSHD to bind to 0.0.0.0 - any IP (or rather ALL IPs)
- Replace LOGIN Script of users you want to support the above
- SSH as any user @ any host
- The login script picks up the IP number, checks for each IP in the list of running servers
- Login script then runs "enter" on the server and "su" to the valid user.
And it is logged in with a single SSH.
I am just perfecting the login script (currently about a 20 line perl script, reviewing the possible C script for better SUID support) - Scott Penrose - firstname.lastname@example.org
Warning! Do not give user accounts on host to other users! Any user can change its own gecos field and log into any vserver by any user!
If you find that trying to ssh to the guest keeps logging you into the host, check the note on ssh on this page: http://linux-vserver.org/some_hints_from_john.