LinuxQuestions.org
Help answer threads with 0 replies.
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 04-23-2015, 08:58 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
view only permission?


hi all,

i know there is read (4) write (2) execute (1) and you can set it for owner, user other but i just want to know is there such a permission as just browsing the directory ie view only, so the user cant read/open or execute the file just view the filename in the directory?

thanks

rob
 
Old 04-23-2015, 09:22 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Yes. Do:

Code:
chmod a=r dirname
You may set permissions for group and/or other and not owner if you like.
 
Old 04-23-2015, 09:56 AM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
what is the option a for?

i know r is recursive
 
Old 04-23-2015, 11:21 AM   #4
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
basically i have created an apache server and have got it to show my directory under docuroot on a web browser so it lists directorys and files, but i dont want the end users to actually open/read the files, i just want them to browse directorys and list the filenames in the directorys, i have tried your command but to no avail

when i type in -

chmod a=r /var/www/html/view

when i refresh the webpage i get this
Attached Thumbnails
Click image for larger version

Name:	apache_dir_list.JPG
Views:	19
Size:	21.4 KB
ID:	18220  
 
Old 04-24-2015, 12:08 AM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
'a' stands for all (ugo).

Just check this with 'ls' command locally. Perhaps html folder has also restricted permissions.
 
Old 04-24-2015, 03:41 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
r is for reading, not for recursive.
You need to set permissions on the dir to allow reading its content and you need to disable(or set) read/execute permission on files/dirs inside the dir one by one.
 
Old 04-24-2015, 08:01 AM   #7
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
awesome i have done it

so

chmod -R 755 /var/www/html/view

i can open all files under root and all files under sub folders on a web browser

but when i issue this command

chmod 700 $(find /var/www/html/view/ -type f)

when i then try to open files again i get a forbidden page

many thanks, much appreciate everyones help

rob
 
Old 04-24-2015, 12:19 PM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
glad to help you
if you really want to say thanks just click on yes.

Your command may fail if the list of the files was too long. In that case you can also try to use:
Code:
find  /var/www/html/view/ -type f -print0 | xargs -0 chmod 700
or
find  /var/www/html/view/ -type f -exec chmod 700 '{}' \+
 
1 members found this post helpful.
  


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
Permission Denied when trying to view another users quota Chris E Linux - Software 1 03-16-2009 12:59 PM
BASH (Linux) - View file permission linux_linux Linux - Software 4 03-15-2008 09:42 PM
command to view permission of directories babu198649 Linux - Newbie 9 10-27-2007 07:56 AM
View a File's Permission in ther Terminal darkarcon2015 Linux - Newbie 3 09-25-2005 12:55 PM
You dont have permission to view this server! Alexander.s Linux - Software 2 04-25-2005 04:45 PM

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

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