LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-08-2009, 05:43 PM   #1
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Rep: Reputation: 75
slocate and security


I have just noticed something using slocate which seems like a security risk.

I have a user, katy on my system. slocate katy shows me all her files.

Quote:
alan@LavanKossot:~$ slocate katy
.......
/home/katy/Aleph Machane/To Do.doc
/home/katy/Aleph Machane/GENERAL SHIUR TIPS.doc
/home/katy/Aleph Machane/snapshot1.png
/home/katy/Aleph Machane/snapshot5.png
/home/katy/Aleph Machane/snapshot4.png
/home/katy/Aleph Machane/snapshot3.png
/home/katy/Aleph Machane/snapshot2.png
alan@LavanKossot:~$ cp /home/katy/Aleph\ Machane/To\ Do.doc ./
alan@LavanKossot:~$
I can then read the file To Do.doc

Now katy could have prevented this by making her folders and file read only but she would not think to do this. Similarly katy could see all my files.
 
Old 03-08-2009, 05:55 PM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
What is the result of ls -ld /home/katy
 
Old 03-08-2009, 06:02 PM   #3
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
You can add /home/<user> to your PRUNEPATH in /etc/updatedb.conf.

Personally I set all users home directory to 700 and have a shared document directory with permission 770. This is only used to copy files between users and not for storing files.
 
Old 03-08-2009, 06:05 PM   #4
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
Quote:
alan@LavanKossot:~$ ls -ld /home/katy
drwx--x--x 43 katy users 4096 2009-03-08 22:43 /home/katy/
but also note

Quote:
alan@LavanKossot:~$ cd /home/katy/
alan@LavanKossot:/home/katy$
Something odd going on here
 
Old 03-08-2009, 06:14 PM   #5
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
Quote:
alan@LavanKossot:/home/katy$ ls
/bin/ls: cannot open directory .: Permission denied
alan@LavanKossot:/home/katy$ cd /home/katy/Aleph\ Machane
alan@LavanKossot:/home/katy/Aleph Machane$ ls
Aleph\ Folders.pdf Yomi.xls
Aleph\ template\ 2(2).dot camp\ t-shirt.bmp
Folder\ Covers\ individual....doc morals.odt
Folder\ Covers.doc shiur\ stuff.doc
GENERAL\ SHIUR\ TIPS.doc shiur\ stuff.odt
Hadrach\ tips\ -\ K's\ and\ T's.odt snapshot1.png
Hadracha\ tips\ -\ K's\ and\ T's.doc snapshot10.png
So I cannot see files in her home directory but I can go to and browse folders in sub-directories
 
Old 03-08-2009, 06:18 PM   #6
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Knock the permissions on /home/katy down to mode 700. It's not a problen with slocate, rather too permissive mode on that directory.
 
Old 03-08-2009, 06:20 PM   #7
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
Nothing wrong. With the permission you can go to the sub-directories (depending on their permissions) of /home/katy but you can not see what is in /home/katy (you need r to see the content of a directory). As root do chmod 700 /home/katy then trying viewing her files.

Last edited by tux_dude; 03-09-2009 at 10:26 AM.
 
Old 03-08-2009, 06:22 PM   #8
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
Quote:
root@LavanKossot:/home/alan# chmod 700 /home/katy/
root@LavanKossot:/home/alan# exit
exit
alan@LavanKossot:~$ cd /home/katy/Aleph\ Machane
-bash: cd: /home/katy/Aleph Machane: Permission denied
That seems to solve the problem.

But doesn't slackware default to drwx--x--x? Are the default slackware permissions to permissive?

Last edited by arubin; 03-08-2009 at 06:25 PM.
 
Old 03-08-2009, 07:43 PM   #9
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
I wouldn't call it too permissive. This gives you some access to the users directory, but you were unable to list the content of the directory. Look into file/directory permission (google) for more info on the subject. Also look into umask to explain the default file permissions for users.

Another option would be to add a list of default directories to /etc/skel with your required permissions. This will create a list of standard directory when you add a user.
 
Old 03-09-2009, 03:25 AM   #10
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
Obviously I am able to make things more secure if I want to. However, I do not expect a user of the system to have this knowledge. Indeed I have now been running linux/slackware for 5 years and I have just discovered that in a default setup any user is able to browse the subdirectories of any other user. Why should the default be drwx--x--x rather than drwx------?
 
Old 03-09-2009, 07:11 AM   #11
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,183

Rep: Reputation: 237Reputation: 237Reputation: 237
To my memory it was for some old mail program to work properly.
 
Old 03-09-2009, 08:24 AM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,906

Rep: Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026
I agree, user home directories are way too sensitive to be left open like this by default. It's especially bad when you consider that the default umask is 0022. There'll be no end of common dotfiles and directories left readable in a users home directory.

Like Tux_dude, I chmod 700 all my users home directories for this very reason.
 
Old 03-09-2009, 11:08 AM   #13
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
Quote:
Obviously I am able to make things more secure if I want to. However, I do not expect a user of the system to have this knowledge.
System security is not the responsibility of the user but the sys admin who should have this knowledge. You can always modify the default security to lock down the system.
Quote:
Why should the default be drwx--x--x rather than drwx------?
To my knowledge, this has been the default permission on user directory on Linux for quite a while. This allows external apps such as mail and web server to access the user home folder. This allows enough access to traverse the user home directory but not view its content (why ls /home/katy failed).
 
Old 03-09-2009, 12:34 PM   #14
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
This is set from the /usr/sbin/adduser script as follows:

Code:
# Defaults
defhome=/home
defshell=/bin/bash
defchmod=711 # home dir permissions - may be preferable to use 701, however.
defgroup=users
If using the native /usr/sbin/useradd like so :
Code:
useradd -s/bin/bash -m  test4
then the home directory /home/test4 will be created with 0755 permissions.
 
Old 03-09-2009, 01:07 PM   #15
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
I do not understand what the difference in effect between 701 and 711 would be.
 
  


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
using slocate dh2k Slackware 4 08-14-2008 08:06 PM
how to create automatically the /var/lib/slocate/slocate.db irhernan Linux - Newbie 3 09-12-2006 02:29 PM
slocate dajomu Ubuntu 1 09-16-2005 08:08 PM
help with slocate plan9 Slackware 8 07-10-2004 01:41 AM
Using slocate in RH 7.2 hominy Linux - Newbie 1 08-10-2003 02:59 PM

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

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