LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 06-02-2018, 06:35 PM   #1
miltonuser
LQ Newbie
 
Registered: Jun 2018
Posts: 1

Rep: Reputation: Disabled
Chmod Permissions


I am very new to linux and I am trying to understand how exactly permissions work in linux.

I have few questions.
1) Do root have permission to delete any file of any users?


2)How can you configure a directory which allows other users copy files in it but not read them? Would 755 permission would work? I tried doing that but I kept getting access denied.


3)What exactly does execute permission does? For example, i tried setting a directory which has both permission read and write but execute. I was not even able to enter directory or do with anything with it. I am really confused about execution command.


4) Does the permission at the directory level dictates if we can remove a certain file in the directory? For example a file is located in directory x which has all the permissions but the directory which the file is located can be only accessed by root. Can anyone delete that file?


Thanks a lot
 
Old 06-02-2018, 07:00 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
1st thing is tko check the man page of any command you dont understand, in this case
Code:
man chmod
The execute bit when set on a folder alows you to enter the folder either for reading/writing or cd'ing, so if you remove the execute bit you will not be able to cd into the folder or list its contents.
 
Old 06-08-2018, 02:24 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Yes, please review the man page. You need to learn how to translate the octal values to what you'd see with ls -l, as the ls output is clearer.
man chmod will also show you how to to use rwx instead of the octal to change permissions.
That said:
Quote:
1) Do root have permission to delete any file of any users?
Yes. It's the main reason for the recommendation to not use a root login routinely.
Quote:
2)How can you configure a directory which allows other users copy files in it but not read them? Would 755 permission would work? I tried doing that but I kept getting access denied.
755 doesn't allow anyone but the owner of the directory to write into it. [rwxr-xr-x]
I don't think it's possible to set permissions on a directory that will allow others to write but not read. If the permissions are set to 766 [rwxrw-rw-], others can't see into the directory to write (copy files in) to it, even tho the write permissions is set.
Quote:
3)What exactly does execute permission does? For example, i tried setting a directory which has both permission read and write but execute. I was not even able to enter directory or do with anything with it. I am really confused about execution command.
Keith Hedger already answered this one well.
Quote:
4) Does the permission at the directory level dictates if we can remove a certain file in the directory? For example a file is located in directory x which has all the permissions but the directory which the file is located can be only accessed by root. Can anyone delete that file?
Your example doesn't match the question, exactly, but no, whether or not a file can be removed isn't affected by the permissions of the containing directory, except that the user needs to be able to "see" into the directory to act on the file. (that is, the execute bit must be set)
Your example asks if the directory only allows root access, can a file with 777 permissions in that directory be acted upon by others? No.

Last edited by scasey; 06-08-2018 at 02:30 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chmod: changing permissions mm_kanish05 Linux - Software 1 06-24-2012 01:08 AM
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 01:10 PM
chmod help and permissions pcorajr Linux - Newbie 4 02-27-2006 02:43 AM
Changing permissions (chmod) teyesahr Linux - Newbie 1 07-31-2003 04:52 PM
chmod and file permissions help qages Linux - General 5 01-27-2003 06:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 06:25 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
Open Source Consulting | Domain Registration