?
Solved

cannot read/write/copy a file thru nfs

Posted on 2003-03-11
17
Medium Priority
?
290 Views
Last Modified: 2013-12-27
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!
0
Comment
Question by:pretz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 3
17 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 8116263
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 !

 
0
 

Author Comment

by:pretz
ID: 8116328
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.
0
 

Author Comment

by:pretz
ID: 8116424
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:pretz
ID: 8116568
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8117113
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 !!!


0
 

Author Comment

by:pretz
ID: 8117596
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
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8117923
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.



0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8121559
silly question: what do you need mandatory locking for?
(it's very unusual in UNIX, except for special purpose like databases)
0
 

Author Comment

by:pretz
ID: 8124115
yes, you're right. It is a file for the essbase database.
0
 

Author Comment

by:pretz
ID: 8124150
yes, you're right. It is a file for the essbase database.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8128576
if it is locked, why do want to write it?

sounds like you try to do the wrong things ...
0
 

Author Comment

by:pretz
ID: 8189104
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8189612
so, case close ?
0
 

Author Comment

by:pretz
ID: 8192397
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8192525
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
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 150 total points
ID: 8194352
NFS cannot do what you want if there is a application which holds a exclusive lock.
Anyway, NFS is knwon to have serious problems with exclusive locks, so take care what you do
0
 

Author Comment

by:pretz
ID: 8194714
ahoffmann,
Thank you!!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question