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 12-18-2008, 08:56 AM   #1
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
Smile file permissons


Hi
does anyone know what permision i need to give a file to allow users to
copy or open but cant delete the file or do i need to give the permisions to the folder
 
Old 12-18-2008, 10:09 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,328

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by mahmoud View Post
Hi
does anyone know what permision i need to give a file to allow users to
copy or open but cant delete the file or do i need to give the permisions to the folder
That would be read access, but you don't say how deep. Do you want owner read only, owner-group read only, or world read only?

chmod 400 (owner only)
chmod 440 (owner-group)
chmod 444 (everyone)

"man chmod" for more information.
 
Old 12-18-2008, 11:02 AM   #3
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
thanks just what i wanted
 
Old 12-18-2008, 12:19 PM   #4
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Rep: Reputation: 41
Hi There,

I think Chmod will not work properly, if permissions are going to be assigned at user level.
I mean to say that if a user is trying to alter permissions for another user, then chmod will let you do so.
Anyways, this is the detailed description regarding permissions at different levels :
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Hope this might help you....

Kapil.
 
Old 12-21-2008, 02:34 AM   #5
rajeshkerala
Member
 
Registered: Mar 2008
Posts: 35

Rep: Reputation: 15
I think putting that file in /tmp folder will do the job. /tmp being a sticky directory wont allow users to delete the file, but they can copy or read the file..
Is it correct what I am saying...?
 
Old 12-21-2008, 08:53 AM   #6
bdox
Member
 
Registered: Feb 2005
Location: SoL iii
Distribution: Mandriva 2007
Posts: 110

Rep: Reputation: 15
Quote:
I think putting that file in /tmp folder will do the job. /tmp being a sticky directory wont allow users to delete the file, but they can copy or read the file..
Is it correct what I am saying...?
I don't think it's a good idea. the files could be eventually deleted as that directory is meant for temporary files and some automatic programs delete files there periodically...
 
Old 12-24-2008, 07:30 AM   #7
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
Ok, then create a directory with sticky bit..
chmod 1755 <directory name>
 
Old 12-24-2008, 02:15 PM   #8
bdox
Member
 
Registered: Feb 2005
Location: SoL iii
Distribution: Mandriva 2007
Posts: 110

Rep: Reputation: 15
Yes, I think the best is to create a forder and as root do:
chmod 444 <directory name>
...
 
Old 12-24-2008, 04:51 PM   #9
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 59
Whether or not a file can be deleted has to do with the permissions of the directory it's in, not the file itself. You could create a file, belonging to root and set its permissions to 000, but if it's in my $HOME directory, I can delete it.
Code:
root /home/telemachus # chown root:root zero 
root /home/telemachus # chmod 000 zero 
root /home/telemachus # ls -l zero 
---------- 1 root root 0 2008-12-24 16:48 zero
root /home/telemachus # exit
exit
telemachus ~ $ rm zero 
rm: remove write-protected regular empty file `zero'? y
telemachus ~ $ ls
bin    changes       Desktop  firstclass  images_backup  lib  musica    storage
books  debian_stuff  firefox  iliumSvn    kernels        man  practice  tint2
So, my point is that you need to think more about the permissions of the directories where you will store the files, not just the files themselves.
See here for more: http://www.albany.edu/faculty/gms/ho...rmissions.html
 
Old 12-24-2008, 10:18 PM   #10
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Rep: Reputation: 15
I go with Telemachos
 
Old 12-24-2008, 11:13 PM   #11
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
Mr.Telmachos,
So what do u suggest as the ideal solution for the question generated by mahmoud..Is n't that putting the file in a directory with sticky bit added to it?
 
Old 12-25-2008, 01:14 AM   #12
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
hey mahmoud,use sticky bit on those files
 
Old 12-25-2008, 01:26 AM   #13
sumit dash
Member
 
Registered: Jul 2007
Location: Hyderabad
Distribution: Red Hat
Posts: 33

Rep: Reputation: 15
hi

Hi frnd,

Simply use sticky bit all users can read and add but canot delte any file from it
 
  


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
Permissons of directory Permaximus Linux - General 5 11-05-2005 05:21 PM
file permissons on fat32 disk - won't change Enoon Linux - Newbie 5 10-07-2005 01:03 PM
Proftp permissons Haiyadragon Linux - General 0 09-13-2004 09:28 AM
awstats permissons tommytomato Linux - General 0 06-14-2004 12:52 AM
permissons rights tommytomato Linux - Newbie 2 02-02-2004 06:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:34 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