LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-25-2008, 05:45 PM   #1
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Rep: Reputation: 30
How do I give jsmith r & w permissions for myfile.txt?


Chmod'ing doesn't seem to be the answer to this, since it makes no mention of individual users. So how do I let jsmith alone read and write to myfile.txt?
 
Old 04-25-2008, 06:05 PM   #2
poet_imp
LQ Newbie
 
Registered: Nov 2007
Location: Tucson, AZ
Distribution: Kubuntu/Gutsy
Posts: 26

Rep: Reputation: 15
Let see if When jsmith was create a group by the same name was also created and jsmith is a part of that group.

grep ^jsmith /etc/passwd
jsmith:x:1000:1000:John Smith,,,:/home/jsmith:/bin/bash

grep ^jsmith /etc/group
jsmith:x:1000:

The above says that the jsmith group has the gid of 1000 and that the user jsmith's default group is 1000, so we are good.

Now look at the file: (I am going to assume that YOU are lumix)

ls -l myfile.txt
-rw------- 1 lumix lumix 6895 2008-04-18 12:24 myfile.txt

First change the group

chgrp jsmith myfile.txt

Next change the permissions

chmod g+rw myfile.txt

Look at what we have done:

ls -l myfile.txt
-rw-rw---- 1 lumix jsmith 6895 2008-04-18 12:24 myfile.txt

Both lumix and jsmith now have full access to that file. He can read it and write to it but he can not delete it or rename it. Since you own the directory the file is in you can remove or rename the file.

Is this what you were looking for?
 
Old 04-25-2008, 06:47 PM   #3
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
Poet_imp's method will work, but you might want to look at ACL's. There's a quick tutorial here (it's old, FC2, but should show you how ACL's work). It saves having to create groups for every user, and in general is very powerful.
 
  


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
How to give myself root permissions royeo Linux - Newbie 11 08-12-2006 03:01 AM
Why "./myfile" instead of just "myfile"? (to run executable) rusty_turkey Linux - Newbie 7 06-12-2006 08:17 PM
How to give permissions for users....... manikantha Linux - General 1 03-17-2005 04:27 AM
Not able to give execute permissions needanyhelp? Linux - General 4 08-20-2004 05:19 AM
How do I give mounting permissions? TheMusicGuy Linux - Security 4 04-20-2004 09:16 PM


All times are GMT -5. The time now is 12:36 PM.

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