[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Virtual Home directory puzzler
Here's one that I've been mulling over, and don't seem to be finding the right
piece of information that makes it trivial and clear.
Situation and background:
OS is Solaris 5.8 (Solaris8), FYI, so Linux only solutions may not help unless
I can find an equivalent Solaris feature (or common Open Source tool).
I have a host server, HOST.domain.com on IP 192.168.10.
I'll refer to this host as HOST and IP10 for brevity.
This hostname is the canonical hostname for the server.
I have virtual host ABC.domain.com on IP 192.168.1.11.
I'll refer to this host as ABC and IP11 for brevity.
IP11 is a virtual IP aliased onto the same interface as IP10.
I have virtual host DEF.domain.com on IP 192.168.1.12.
I'll refer to this host as DEF and IP12 for brevity.
IP12 is a virtual IP aliased onto the same interface as IP10.
In summary, interface eth0 is receiving traffic for IP10, IP11, and IP12.
I have an account, 'user' on HOST, with a home directory /home/user.
Under this directory, I have two subdirectories, ABC and DEF, named for the
virtual host.
Here's the puzzler:
If I ssh in to ABC as 'user', my home directory is /home/user on HOST.
If I ssh in to DEF as 'user', my home directory is /home/user on HOST.
Is there a way to determine within my BOURNE shell (sorry, bash not available)
which host I initiated the ssh session with? i.e. which host did I ssh *to*?
The reason is that if I ssh'd to ABC, I want to change directories to the ABC
subdirectory and startup there. If I ssh'd to DEF, I want to change
directories to DEF and startup there. i.e. virtual hosting with multiple
"home" directories.
On the face of it, this sounds easy. But it fails when there are multiple
people ssh'ing to HOST, ABC, and DEF from the same host you are.
And the $HOST environment varible holds the canonical machine name - not the
host you ssh'd into. So in this example, $HOST would always be 'HOST'.
I've already tried tracking down the connection via netstat for an ESTABLISHED
connection from my own REMOTE_HOST ip address on port 22. However, in the
above scenario (with other people from the same REMOTE_HOST initiating
connections to the other hostnames), this breaks down and you can't tell
*which* connection is owned by your process.
I can track down my pty in /proc. But I can't find the piece that links the
connection to my process to figure out which host I sshd into in the first
place. Hence today's puzzler.
Mike808/
--
() Join the ASCII ribbon campaign against HTML email and Microsoft-specific
/\ attachments. If I wanted to read HTML, I would have visited your website!
Support open standards.
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.