From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5141 invoked from network); 27 Sep 2002 11:03:38 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 27 Sep 2002 11:03:38 -0000 Received: (qmail 16590 invoked by alias); 27 Sep 2002 11:03:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5395 Received: (qmail 16579 invoked from network); 27 Sep 2002 11:03:18 -0000 From: Borzenkov Andrey To: "'Eric De Mund'" , zsh-users@sunsite.dk Subject: RE: how can I make a local directory be a symlink to a remote one? Date: Fri, 27 Sep 2002 15:03:04 +0400 Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B445@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <15764.10974.397264.908108@idiom.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal > > How can I make a local directory be a virtual symbolic link to a remote > directory? (Where "remote" means accessible via ssh(1) and friends.) > > For example, I'd like file copies (cp(1)'s) to and from my local ~/foo > directory to actually be scp(1)'s to and from my remote ~/foo directory, > and ls(1)'s of my local ~/foo directory to actually be ssh(1)-invoked > ls(1)'s of my remote ~/foo directory. In the first case, I could > implement this with a script that, say, checked for commands of the form > "cp file ... ~/foo", rewriting them as "scp file ... rhost:~/foo", but > that seems inelegant. > > Can anyone point me to a Zsh idiom or meme that would permit me to do > this? Or is this better implemented in some non-Zsh way? > I do not see anything inelegant in zsh functions, but ... It is of course possible to write shell functions for ls, cp, mv & friends that would intercept access to specific directories and call ssh for them. But you of course understand that it will work only when you use these commands, more over, only when you use them from inside of shell. Any other program trying to access these directories will see just a normal local ones. To do what you want transparently you need one of - shared library that will be preloaded and will intercept syscalls for open, creat, stat, etc in specific directories (you may check SAMBA for example implementation, they do exactly the same for SMB access). This solution unfortunately is not truly portable because not every system supports library preloading, besides it does not work for statically linked programs. - implement new file system in kernel. -andrey