LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-09-2016, 10:10 AM   #1
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Rep: Reputation: 17
Permissions Directories Executable for Others


Finding that I had a directory that was not executable for others when it should have been, I fixed it,and that helped my LXDE Desktop operate better.

I am using the package users method.

Since I probably need to change some other directories as such, I ran the command:

To find directories without permissions of others executable, and list long list format human readable directories only, tee to log file:
Code:
find / -type d ! -perm -o+x | xargs ls -lhd 2>&1 | tee nonexecutabledirectories.txt
So now that I have the list, , , as a general rule, what directories should be, and should not be executable by others?

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
Old 07-09-2016, 03:03 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by Wayne Sallee View Post
as a general rule, what directories should be, and should not be executable by others?
The executable bit has a somewhat different meaning in directories than it does in files. In directories the executable bit means that the permitted users can traverse the directory on their way to the files and directories within the directory in question.

So if a user can access the files and directories within a directory in any way then that directory needs the executable bit to be set on.

--------------------
Steve Stites
 
Old 07-10-2016, 09:04 AM   #3
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by jailbait View Post
The executable bit has a somewhat different meaning in directories than it does in files. In directories the executable bit means that the permitted users can traverse the directory on their way to the files and directories within the directory in question.

So if a user can access the files and directories within a directory in any way then that directory needs the executable bit to be set on.

--------------------
Steve Stites
Yes I know that.

The issue is some directories you do not want to be executable by others for security, but other directories, while it might seem nice to prevent that directory from being executable, it will prevent parts of the operating system from working correctly when a person logs in to the desktop as a regular user.

I have compared the list of such directories and compared them to the directories on a linux distribution.

So my question is "as a general rule, what directories should be, and should not be executable by others?"

Or maybe a better question would be, what directories would one definitely not want to be set executable for others.

Just asking if anyone has a real opinion on the matter.

I know what the execution bit means.

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
Old 07-10-2016, 10:07 AM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
If you want any file or directory to be accessible to others then the executable bit must be set for others in all directories in the path to the accessible file or directory. So you make a list of what files and directories can be accessed by others and then set the others executable bit in all directories that must be traversed in order to reach the files and directories that you are allowing others access to. You do not set the others executable bit in the directories that others have no need to traverse.

---------------------
Steve Stites
 
Old 07-11-2016, 12:35 PM   #5
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Original Poster
Rep: Reputation: 17
Yes, I know that.

My question is more of what particular common directories, as a rule of thumb should and should not be executable, if someone has a general opinion on that.

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
Old 07-11-2016, 12:39 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
I seriously doubt any distro would ship with incorrect directory/file permissions. What directories you found had incorrect permissions in your system?
 
Old 07-11-2016, 02:02 PM   #7
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Emerson View Post
I seriously doubt any distro would ship with incorrect directory/file permissions. What directories you found had incorrect permissions in your system?
This is the LFS forum.

LFS is a book that tells how to build Linux from scratch.

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
Old 07-11-2016, 05:21 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
When I search on CentOS 6 and Fedora 23 systems
Code:
find / -xdev -type d ! -perm -10 -perm -40
the only directories I find that are group-readable but not group-executable are ~/.pki/ in root's and users' home directories. I do find a few directories on Fedora 23 that are group-executable but not group-readable (i.e., you can access a file if you already know its name, but you cannot list the names). Those are /var/spool/cups/ (mode 710), and /var/log/gdm/ and several /var/lib/libvirt/ directories (mode 711).
 
Old 07-12-2016, 01:33 AM   #9
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
Maybe this is useful,

Linux Filesystem Hierarchy
 
Old 07-12-2016, 09:45 AM   #10
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Original Poster
Rep: Reputation: 17
Code:
To find directories without permissions of others executable, and using newline delimiter, list long list format human readable directories only, tee to log file:
find / -type d ! -perm -o+x | xargs -d "\n" ls -lhd 2>&1 | tee nonexecutabledirectories.txt
I updated the code to use the delimiter new line, as the previous was giving some errors with file directory names with spaces.

Or to make a simple list without long listing:
Code:
find / -type d ! -perm -o+x | tee nonexecutabledirectoriesshort.txt
For some reason I'm getting more directories listed with this short code, and in different order.

Running this short list code on Mandriva 2010. I'm finding that the directories listed are:

Code:
/.dbus
/.dbus/session-bus
A number of directories in
/root/
A number of directories in
/tmp/
/dev/vboxusb
A number of directories in
/etc/
A lot in
/var/
A lot in
/home/
A lot in
/proc/
/lost+found
And the following seem strange that they would be not -o x:
/usr/lib/mozilla/extensions
/usr/share/doc/libgd-devel
/lib/firmware/rtlwifi
Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
Old 07-12-2016, 10:16 AM   #11
Wayne Sallee
Member
 
Registered: Jun 2011
Location: Florida
Distribution: The one that I built. (lfs)
Posts: 269

Original Poster
Rep: Reputation: 17
On my lfs computer my list is:

Quote:
/usr/share/polkit-1/rules.d
/lost+found
/run/lock/lvm
A lot in
/proc/
/root
A number of directories in
/root/
/etc/polkit-1/rules.d
/etc/cups/ssl
A lot in
/home/
/var/cache/ldconfig
/var/cache/cups
/var/lib/sshd
/var/lib/NetworkManager
/var/spool/cups
/var/spool/cups/tmp
/usr/libexec
was previously not -o+x so I fixed that, and my desktop worked better. So that is what started my question.

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executable format without +x permissions Mig21 Linux - Software 23 10-08-2007 05:58 PM
Permissions and directories arubin Slackware 6 09-21-2007 03:56 AM
Executable permissions jared78 Linux - General 3 12-03-2005 08:54 PM
Mount NTFS so that files are not executable buts directories are nasty_daemon Slackware 6 09-20-2005 01:51 AM
Changing Permissions on Directories... bob4432 Linux - Newbie 6 06-25-2004 02:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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