1836636 Members
2015 Online
110102 Solutions
New Discussion

Remote file access

 
SOLVED
Go to solution
bhoang
Advisor

Remote file access

Is there a way to access a file that resides on a remote host using the link command?
I tried to use a symblic link to link a local file to a remote file, and this does not work!

e.g. ln -s local_file remote_host:/file. TIA.
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: Remote file access

Hi:

The answer is no at least not like that. You can export the filesystem via NFS and then mount the filesystem via NFS on the local system.

After exporting on the remote system you can then
mount -F nfs remotehost:/fs1 /remfs1

You can then do a symbolic link something like this:
ln -s /remfs1/myfile1 /myhomedir/myfile1

Clay
If it ain't broke, I can fix that.
Sachin Patel
Honored Contributor

Re: Remote file access

Hi Bach,
You have to export that file system.
For example
1.your filename on remote system is /home/bach/runme.
2. you are trying to run that file from client1

On remote system
#vi /etc/exports file and export /home
/home -access=client1
#exportfs -va (to export /home)

on client
#cd /
#mkdir tmphome
#mount server:/home /tmphome
#ln -s /tmphome/bach/runme /home/bach/runme
#cd /home/bach
and run "runme" it will run it from remote system.

Sachin
Is photography a hobby or another way to spend $
bhoang
Advisor

Re: Remote file access

Hi Clay, Due to disk space limitation on the local host, I thought I can use the symbolic link concept...
linuxfan
Honored Contributor

Re: Remote file access

Hi Bach,

When you nfs mount a filesystem, you are not using up disk space on your local system.
If you don't want to use NFS, the other option is to use AUTOFS(/automount).

-Regards
I am RU
They think they know but don't. At least I know I don't know - Socrates
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Remote file access

Hi:

Whether by hard mount or automount (both use NFS) you are not eating up disk space on the local machine (other than the mountpoint entries - and they are trivial.).

Clay
If it ain't broke, I can fix that.
bhoang
Advisor

Re: Remote file access

Thanks a lot everyone! It works fine.
linuxfan
Honored Contributor

Re: Remote file access


Thanks Clay, I meant to say if Bach didn't want to use hardmount, he could use automount. I do know that they both use NFS.

I am not sure what is his requirement, maybe he can get away with writing a script, which looks for any changes in the script on the remote node and transfers the file(using ftp/rcp/scp) or even better just use rdist to copy the file from the remote node to the local node, rather than hardmounting or automounting. But then again, I am not sure what are Bach's requirements/limitations.

-Regards
I am RU
They think they know but don't. At least I know I don't know - Socrates
Magdi KAMAL
Respected Contributor

Re: Remote file access

Hi Bach,

You may do an export of the remote directory containing the file to symbolic link ( with exportfs ) like :

#exportfs -i -o rw=server1:server2 /myDir

This command exports the directory "myDir" with read and write permessions to server1 and server2

Then on the local server, mount the NFS direcory by the following command :

#mount -F nfs -o soft,intr,rw remoteServer:/myDir /users/remoteDir/myLocalDir

This command mount the remote directory "myDir" on the remote server "remoteServer" on the local directory "myLocalDir" with read and write permissions.

Now you can issue your symbolic link using the mounted directory "myLocalDir" like :

#ln -s /users/remoteDir/myLocalDir/remoteFile /tmp/symbolicLinkOnRemoteFile

Magdi