I have 2 Ubuntu Linux boxes with similar directory structures, LX02 and LX04. When I ssh from a terminal on LX02 to LX04 and go to my main scripting directory, /root/sbin, I see a different set of subdirectories than when I go the same directory from a terminal session on LX04. Why?
DETAILS
Both machines have a /0 directory that contains mountpoint directories for each remote host as in...
/0/LX02
/0/LX04
/etc/fstab contains entries to mount the remote host's root (/) directory to these. There is a 'mount bind' entry to mount the local (/) directory which avoids special coding for the local host in scripts.
/root/sbin is a symlink to /usr/local/sbin on each machine.
The local /root/sbin directory on LX02 looks like...
root@LX02:/ cd /root/sbin
root@LX02:~/sbin ls -l | grep '^d'
drwxr-x--- 2 root root 4096 2011-07-16 00:49 Archives-sbin-20110825
drwxr-x--- 2 root root 4096 2010-07-28 08:13 lst
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Misc
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Slates
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Tomboy
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Ubuntu_8.04
drwxr-x--- 2 root root 4096 2010-07-28 08:13 www
drwxr-xr-x 2 root root 4096 2012-09-27 12:48 zim
Going to /0/LX04/root/sbin from an LX02 terminal session results in...
root@LX02:/0/LX04/root/sbin cd /0/LX04/root/sbin
root@LX02:/0/LX04/root/sbin ls -l | grep '^d'
drwxr-x--- 2 root root 4096 2011-07-16 00:49 Archives-sbin-20110825
drwxr-x--- 2 root root 4096 2010-07-28 08:13 lst
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Misc
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Slates
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Tomboy
drwxr-xr-x 2 root root 4096 2012-04-11 09:28 Ubuntu_8.04
drwxr-x--- 2 root root 4096 2010-07-28 08:13 www
drwxr-xr-x 2 root root 4096 2012-09-27 12:48 zim
However, the /root/sbin directory on LX04 actually looks like...
root@LX04:/ cd /root/sbin
root@LX04:~/sbin ls -l | grep '^d'
drwx------ 4 root root 12288 2011-12-23 03:23 Archives
drwx------ 2 root root 4096 2011-07-16 00:49 Archives-sbin-20110825
drwxr-xr-x 3 root root 4096 2012-11-14 00:22 Examples
drwxr-x--- 2 root root 4096 2011-04-29 13:50 fnc
drwxr-x--- 2 root root 4096 2011-05-19 15:00 lst
drwxr-xr-x 3 root root 4096 2012-10-28 10:01 Synergy
drwxr-x--- 2 root root 4096 2011-03-10 20:54 tmp
drwxr-x--- 2 root root 4096 2011-03-10 20:54 www
grep root /etc/passwdreturn on both machines? – jippie Nov 18 '12 at 18:14