LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-15-2013, 06:28 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 555

Rep: Reputation: Disabled
Best place to make a directory for Samba?


I am running CentOS 6.4 with SELInux. I would like to know what would the ideal or best solution as to where to create a directory for Samba. This directory will be shared by myself and one other person, privacy isnt really a big thing for me right now. I was thinking making a directory called "SambaShared" either on the root of the filesystem or in the /usr file. What would you suggest?

Please note the following-
Making directories in the /home folder isnt really an option due to SELinux, on restart SELinux will re-write the permissions forcing me to constantly have to use some command such as "setsebool" everytime I restart the PC.


Some notes from Samba for you guys-
Code:
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba_share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
 
Old 07-15-2013, 06:38 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Doesnt matter where you put it as long as you know where you put it and the filesystem has enough room.
 
Old 07-15-2013, 06:44 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,990

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Creating a directory in the / of the filesystem should no be a problem. I use a sub-directory of the /mnt partition, just a personal choice.
 
Old 07-15-2013, 06:50 PM   #4
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 165Reputation: 165
I also use a subdirectory of /mnt for samba and nfs mounts. It's just easier for me to remember if I stick them all in the same place.
 
Old 07-15-2013, 07:39 PM   #5
Altiris
Member
 
Registered: Mar 2013
Posts: 555

Original Poster
Rep: Reputation: Disabled
So what about in /usr,is that fine?
 
Old 07-15-2013, 07:49 PM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
You can place it wherever you want. This is where being a good sys admin comes into play.

Do a df -h, examine how much space you think you might need for your samba share, and then make your own decision.


As other have said they all have their personal preference. I have always made a separate file system because my samba shares were writable by users and we all know a user can be dumb and try to upload a 500 GB video they found online of kittens and would not check to see there was only 300GB left before they tried to upload it. That way they could only bring that filesystem to a halt and my root was never in danger.
 
Old 07-15-2013, 07:53 PM   #7
Altiris
Member
 
Registered: Mar 2013
Posts: 555

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Kustom42 View Post
You can place it wherever you want. This is where being a good sys admin comes into play.

Do a df -h, examine how much space you think you might need for your samba share, and then make your own decision.


As other have said they all have their personal preference. I have always made a separate file system because my samba shares were writable by users and we all know a user can be dumb and try to upload a 500 GB video they found online of kittens and would not check to see there was only 300GB left before they tried to upload it. That way they could only bring that filesystem to a halt and my root was never in danger.
Ahhh smart smart, I might make that on my second partition. However I set the partition to have my first user own it and id also have to have that partition always mounted which I sort of see as a security flaw, meaning if somehow a virus gets in it wont be ablet to touch that partition if it wasnt mounted. Its better than my OS disk getting filled up though.

Last edited by Altiris; 07-15-2013 at 07:55 PM.
 
Old 07-15-2013, 08:05 PM   #8
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
I chuckle because you mention virus and partition, both of which are moot points in the Linux world.


Yes a Linux system can be compromised. However, if someone does compromise the system that means they have elevated themselves to super user(root) privileges and in theory could mount or unmount or do whatever they wanted.
 
Old 07-15-2013, 09:42 PM   #9
Altiris
Member
 
Registered: Mar 2013
Posts: 555

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Kustom42 View Post
I chuckle because you mention virus and partition, both of which are moot points in the Linux world.


Yes a Linux system can be compromised. However, if someone does compromise the system that means they have elevated themselves to super user(root) privileges and in theory could mount or unmount or do whatever they wanted.
Oh yeah, you right. lol.
 
Old 07-15-2013, 09:49 PM   #10
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

Quote:
Originally Posted by Altiris View Post
So what about in /usr,is that fine?
No, that would be quite a bad place. Despite the name, users should not be putting data under /usr.

See, for example http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE18

Evo2.
 
Old 07-16-2013, 01:30 PM   #11
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
Originally Posted by evo2 View Post
Hi,



No, that would be quite a bad place. Despite the name, users should not be putting data under /usr.

See, for example http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE18

Evo2.

Shenanigans. /usr is apart of the user's path for a reason and any scripts created that are to be used by all users should be placed in one of its subs, usually /usr/local/bin/.

The directory "/usr/" should never be directly written to, but creating a sub dir under it is perfectly acceptable and is noted on the link you provided under FHS 2.3
 
Old 07-16-2013, 07:18 PM   #12
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

perhaps I missed something, but I was under the impression that this was not going to be static data.
The 2nd sentence in the section I linked to states:

"/usr is shareable, read-only data"

Evo2.
 
Old 07-16-2013, 07:21 PM   #13
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
Originally Posted by evo2 View Post
Hi,

perhaps I missed something, but I was under the impression that this was not going to be static data.
The 2nd sentence in the section I linked to states:

"/usr is shareable, read-only data"

Evo2.

Evo2 you aren't reading deep enough. The FHS states that "/usr/" should not be written to. But "/usr/local/sambashare" or even "/usr/sambashare" is perfectly acceptable within the FHS. The local subfolder of FHS is basically made for this purpose, although the original design was to be a place for users to place all of their own custom created binaries and scripts.
 
Old 07-16-2013, 07:24 PM   #14
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
http://www.pathname.com/fhs/pub/fhs-2.3.html#AEN1450


I guess it should be in /usr/local/ as creating your own sub under /usr/ is nto advised as it could be overwritten. But anything inside of /usr/local is perfectly safe.
 
Old 07-16-2013, 07:41 PM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
Quote:
Originally Posted by Kustom42 View Post
Evo2 you aren't reading deep enough. The FHS states that "/usr/" should not be written to. But "/usr/local/sambashare" or even "/usr/sambashare" is perfectly acceptable within the FHS. The local subfolder of FHS is basically made for this purpose, although the original design was to be a place for users to place all of their own custom created binaries and scripts.
Actually no, this is not the place where it should go. The FHS clearly states that
Quote:
The /usr/local hierarchy is for use by the system administrator when installing software locally.
That /usr should be read-only applies to all sub-directories of it (including /usr/local), it has nothing to do at all with users sharing data.
The /srv directory is the right place for services
Quote:
which require a single tree for readonly data, writable data and scripts
Which includes the Samba service.
Of course this all only applies if you want to be FHS compliant, otherwise just put it were you want.
 
1 members found this post helpful.
  


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
[SOLVED] How can I md5 recursively and place a checksum file in each directory? peter1234 Linux - General 10 11-14-2012 02:01 PM
https - do i need to place copy in other directory too? lespaul74 Linux - Server 2 05-06-2009 01:38 AM
make samba display only the directory you want webb.ryan Linux - Newbie 4 10-30-2007 05:39 AM
Easy Question, can I place any directory onto another server? lexington Linux - Newbie 4 05-26-2004 02:38 PM
How to make an entire drive or directory available to Win box using Samba ? lostboy Linux - General 7 05-05-2003 08:41 PM


All times are GMT -5. The time now is 04:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration