LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Best place to make a directory for Samba? (https://www.linuxquestions.org/questions/linux-newbie-8/best-place-to-make-a-directory-for-samba-4175469737/)

Altiris 07-15-2013 05:28 PM

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


Kustom42 07-15-2013 05:38 PM

Doesnt matter where you put it as long as you know where you put it and the filesystem has enough room.

yancek 07-15-2013 05:44 PM

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.

Z038 07-15-2013 05:50 PM

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.

Altiris 07-15-2013 06:39 PM

So what about in /usr,is that fine?

Kustom42 07-15-2013 06:49 PM

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.

Altiris 07-15-2013 06:53 PM

Quote:

Originally Posted by Kustom42 (Post 4990870)
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.

Kustom42 07-15-2013 07:05 PM

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.

Altiris 07-15-2013 08:42 PM

Quote:

Originally Posted by Kustom42 (Post 4990885)
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.

evo2 07-15-2013 08:49 PM

Hi,

Quote:

Originally Posted by Altiris (Post 4990862)
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.

Kustom42 07-16-2013 12:30 PM

Quote:

Originally Posted by evo2 (Post 4990936)
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

evo2 07-16-2013 06:18 PM

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.

Kustom42 07-16-2013 06:21 PM

Quote:

Originally Posted by evo2 (Post 4991574)
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.

Kustom42 07-16-2013 06:24 PM

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.

TobiSGD 07-16-2013 06:41 PM

Quote:

Originally Posted by Kustom42 (Post 4991575)
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.


All times are GMT -5. The time now is 05:02 PM.