LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-23-2012, 03:06 AM   #1
sahana12
LQ Newbie
 
Registered: Aug 2012
Location: Bangalore
Posts: 4

Rep: Reputation: Disabled
Creating files in nfs mount as different user


in server:
in /etc/exports:
/hello *(rw,no_root_squash)
started nfs

in client:
mounted /hello on /hello1

Now I have to check whether can I create file "file" on /hello with user1 and same file "file" on /hello1 mount point with different user user2. If can , How to do ? If not, why its not possible? May I know the answers please.

Last edited by sahana12; 08-23-2012 at 03:10 AM.
 
Old 08-23-2012, 08:59 AM   #2
byannoni
Member
 
Registered: Aug 2012
Location: /home/byannoni
Distribution: Arch
Posts: 128

Rep: Reputation: 36
To act as user2, run this:
Code:
su user2
 
Old 08-23-2012, 07:46 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Sounds a bit like homework, but anyway...

1. use touch cmd http://linux.die.net/man/1/touch

2. use
Code:
su - user2
The ' - ' gives you user2's env, otherwise you keep your own ... This can be important.
 
Old 08-23-2012, 07:57 PM   #4
byannoni
Member
 
Registered: Aug 2012
Location: /home/byannoni
Distribution: Arch
Posts: 128

Rep: Reputation: 36
Quote:
Originally Posted by chrism01 View Post
The ' - ' gives you user2's env, otherwise you keep your own ... This can be important.
Good point, forgot to mention that.
 
Old 08-24-2012, 01:58 AM   #5
sahana12
LQ Newbie
 
Registered: Aug 2012
Location: Bangalore
Posts: 4

Original Poster
Rep: Reputation: Disabled
on client:
as root ran command:
mount -t nfs -o vers=3 <server-ip>:/hello /hello
cd /hello
ls -l
-rw-r--r-- 1 root root 12 Aug 23 01:46 userfile

now :
su - user
cd /hello

touch userfile
touch: cannot touch `userfile': Permission denied

Is this expected behaviour?
 
Old 08-24-2012, 06:53 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Depends who owns the mounted dir and perms.
Note also that nfs is done by uid, not username; the uid at both ends must match
See Chap 18 http://www.linuxtopia.org/online_boo...ion/index.html
 
Old 08-24-2012, 08:41 AM   #7
byannoni
Member
 
Registered: Aug 2012
Location: /home/byannoni
Distribution: Arch
Posts: 128

Rep: Reputation: 36
Quote:
Originally Posted by sahana12 View Post
-rw-r--r-- 1 root root 12 Aug 23 01:46 userfile
Code:
root root    means that root owns the file.
-rw-r--r--   means that only the owner has the permission to write to the file.
So you need to do this if you want user to be able to touch it:
Code:
chmod o+w userfile
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new user in a mount point other than / rajesh_bu2001 Linux - Newbie 7 10-20-2010 09:54 AM
[SOLVED] Creating local NFS mounted home directory for remote LDAP authenticated user someshpr Linux - Newbie 2 12-15-2009 07:14 PM
nfs mount ok but cannot access some files michael.barnes Linux - Networking 2 01-25-2007 05:38 PM
NFS Mount as an ORDINARY USER fahad26 Linux - Networking 4 07-24-2005 03:15 AM
NFS Mount as an ORDINARY USER fahad26 Linux - Newbie 1 06-22-2005 03:30 AM


All times are GMT -5. The time now is 10:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration