Link to home
Start Free TrialLog in
Avatar of pretz
pretz

asked on

cannot read/write/copy a file thru nfs

Hi,

I have encountered the following problem:

1. I nfs shared a directory, say, /d100 of host A, to host B with rw permission
2. Then I mounted the A:/d100 in Host B with rw permission again.
3. From Host B, I tried to access the mounted nfs dir. There is a file with the following permission set:
   r-xr-lr-x  owner1 group1  data.txt
4. Then as owner1 (both uid and gid are the same in Host A and Host B), I could neither cat nor copy the file data.txt, saying that permission denied. However for other files without the mandatory lock, I could always read/write them.
5. Then I move back to Host A, login as owner1, I can read/write the file data.txt locally.

Please kindly give me some idea how it is working..... to do read/write operations on mandatory locking files thru nfs... Many thanks!
Avatar of yuzh
yuzh

How do your set up the "share" in your NFS server, look at
 /etc/dfs/dfstab file in you NFS server to make sure that it is shared with rw permission !

 
Avatar of pretz

ASKER

Hello,

Yes it's a read/write permission.

I can read/write files without the mandatory lock in that shared dir in the remote host, but not those with mandatory locking.
Avatar of pretz

ASKER

Hello,

Yes it's a read/write permission.

I can read/write files without the mandatory lock in that shared dir in the remote host, but not those with mandatory locking.
Avatar of pretz

ASKER

Hello,

Yes it's a read/write permission.

I can read/write files without the mandatory lock in that shared dir in the remote host, but not those with mandatory locking.
From the Sun docs:
Mandatory locking works only for local files. Mandatory locking is not supported when accessing files through NFS.

Have a look at the following page for more details:

http://docs.sun.com/db/doc/806-4125/6jd7pe6at?a=view

http://docs.sun.com/db/doc/806-4750/6jdqdflt4?a=view

http://www.netsys.com/bsdi-users/2002-04/msg00059.html

So you can't do it with NFS !!!


Avatar of pretz

ASKER

thanks for the info

however when I tried to cat/cp the 'locked' file thru nfs, I was prompted 'permission denied'
but when I tried the cat/cp command on others files, they works and I can read/write on the nfs directory. (i.e., the nfs is mounted as rw successfully)

So how can I perform read/write on the locked files in nfs mounted dir? Although for doc. it said mandatory locking is not supported in nfs, the fact is I really cannot do any rw operation on it.
Many thanks
I think you end up have to use "tar + ssh", "rsync + ssh", or rcp / ftp (not secure to do the job).

rsync and openssh can be download from : (free):

http://sunfreeware.com/

Here's an example for copy file from box1 to box2, use tar + ssh: (tarnsfer everything under /mydir-box1 to box2, login name fred)

cd /mydir-box1
tar cf - . | ssh fred@box2" (cd /mydir-box2/backup; tar xvf - )"

once you have secure shell setup, do a
man ssh
to learn more about secure shell.



silly question: what do you need mandatory locking for?
(it's very unusual in UNIX, except for special purpose like databases)
Avatar of pretz

ASKER

yes, you're right. It is a file for the essbase database.
Avatar of pretz

ASKER

yes, you're right. It is a file for the essbase database.
if it is locked, why do want to write it?

sounds like you try to do the wrong things ...
Avatar of pretz

ASKER

Hi,

Since it was upon user's request. I did ask him why he needed to do so. He wanted to copy the file to the testing server.
Finally he tried to copy it thru ftp and it did work.
so, case close ?
Avatar of pretz

ASKER

Actually I just want to know whether it is possible to do a nfs copy of this kind of files. By using ftp the file permission cannot be preserved.
If you want to preserved the file permission you can use tar to creatw a tar ball, use ftp to transfer the tar ball and then untar it.

man tar

to learn how to use tar
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pretz

ASKER

ahoffmann,
Thank you!!!