Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

cannot read/write/copy a file thru nfs

Posted on 2003-03-11
17
Medium Priority
?
299 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

564 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