samba share setup?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
Minty_64
Level 3
Level 3
Posts: 101
Joined: Mon Jun 30, 2014 3:18 am

samba share setup?

Post by Minty_64 »

I'm trying to set up my home network as described here on youtube, I know it's ubuntu but I want to do the same as she did in linux mint mate 17.1

basically the process removes chmod 777 and lets you use a group based permission system.
I'm not sure what to do because I cannot really share files over samba without a password and without having bin/bash or bin/sh so i can have bin/false without chmod 777.

lots of ands :/

[edit] with this method i cannot write/add/delete, says permission denied, how can i reproduce these results? or did i make a mistake?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
We cannot solve our problems with the same thinking we used in creating them - Albert Einstein
kukamuumuka

Re: samba share setup?

Post by kukamuumuka »

My way:

Code: Select all

sudo apt-get install samba samba-common
sudo apt-get install system-config-samba cifs-utils
.... add a samba user

Code: Select all

sudo smbpasswd -a username
/etc/samba/smb.conf file

Code: Select all

[global]
   workgroup = WORKGROUP
   server string = mint-pc2
   netbios name = mint-pc2
   printcap name = /dev/null
   load printers = no
   disable spoolss = yes
   printing = bsd
   log file = /var/log/samba/log.%m
   max log size = 50
   security = user
   dns proxy = no
   map to guest = Bad User
   unix extensions = false
   oplocks = no
   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
   write cache size = 131072
   use sendfile = true
   getwd cache = yes
   min receivefile size = 16384
   public = yes
 
#============================ Share Definitions ==============================
 
# Public, read only
[open]
        comment = open
        read only = yes
        # use this only for read only shares!
        fake oplocks = yes
        path = /home/mint/open
 
[ protected]
        comment = protected
        public = no
        valid users = mint
        read only = no
        writeable = yes
        path = /home/mint/protected
... restart samba

Code: Select all

sudo service smbd restart
PS. Firewall must be off.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: samba share setup?

Post by altair4 »

with this method i cannot write/add/delete, says permission denied, how can i reproduce these results? or did i make a mistake?
Yes you did make a mistake, You followed that HowTo. What a convoluted mess. And BTW, 777 on llama doesn't give "any random user access to your computer" it gives any random user read / write access to the folder being shared.

Anywho, you might want to post the output of the following command so we can see how you are currently set up:

Code: Select all

testparm -s
And you need to specify exactly what this means:
I'm not sure what to do because I cannot really share files over samba without a password and without having bin/bash or bin/sh so i can have bin/false without chmod 777.
Do you want clients to share folders without a user name or password?
Or you do want this it's just that it didn't work?

You need to specify exactly what you want this share to do:
Do you want all client users to have read / write access to everything in the share?
Do you want the user on the server to have read / write access to everything in the share?

The last one is important because if you followed the howto when "nobody" adds a file to the share the server user won't be able to do anything with it.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
Minty_64
Level 3
Level 3
Posts: 101
Joined: Mon Jun 30, 2014 3:18 am

Re: samba share setup?

Post by Minty_64 »

ok so what I want is specific users to have access to the share folder without having to use a password.

and why does samba need 777 for read and write access because 776 or 766 doesn't allow for any writing, I'm confused, does execute mean anyone with access can launch a program in the shared file?
We cannot solve our problems with the same thinking we used in creating them - Albert Einstein
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: samba share setup?

Post by altair4 »

ok so what I want is specific users to have access to the share folder without having to use a password.
Let's say I have 4 users on the network: mom, dad, son, daughter.

I can create a share that allows only mom and dad to access it:
[share]
path = /mnt/ParentShare
read only = no
guest ok = no
valid users = mom, dad
The only way for samba to differentiate between the parents and the children is for each one to pass credentials when they access the share. So you will have to create those users on the samba server and then add them to the samba password database.

There are two sets of permissions involved here. Samba determines what the client user may do but Linux permissions determines what the client user can do. The Linux permissions always has to be the same or greater than the samba permissions. So in the above share example you could set the Linux permissions to 777 which would allow everyone to access the folder but then use the "valid users" option in the share definition as a gatekeeper that allows only mom and dad access.

Linux permissions on Folders always has to have the execute bit set which enables the folder to be "opened".

The other issue is what is your definition of write. The above share will allow both mom and dad to add files to the share but they may not be able to edit each others files. If you want that to happen the share will need to be altered. It can be something as simple as adding a "force user" option but that depends on your requirements.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Andrew33

Re: samba share setup?

Post by Andrew33 »

administrollaattori wrote:My way:

Code: Select all

sudo apt-get install samba samba-common
sudo apt-get install system-config-samba cifs-utils
.... add a samba user

Code: Select all

sudo smbpasswd -a username
/etc/samba/smb.conf file

Code: Select all

[global]
   workgroup = WORKGROUP
   server string = mint-pc2
   netbios name = mint-pc2
   printcap name = /dev/null
   load printers = no
   disable spoolss = yes
   printing = bsd
   log file = /var/log/samba/log.%m
   max log size = 50
   security = user
   dns proxy = no
   map to guest = Bad User
   unix extensions = false
   oplocks = no
   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
   write cache size = 131072
   use sendfile = true
   getwd cache = yes
   min receivefile size = 16384
   public = yes
 
#============================ Share Definitions ==============================
 
# Public, read only
[open]
        comment = open
        read only = yes
        # use this only for read only shares!
        fake oplocks = yes
        path = /home/mint/open
 
[ protected]
        comment = protected
        public = no
        valid users = mint
        read only = no
        writeable = yes
        path = /home/mint/protected
... restart samba

Code: Select all

sudo service smbd restart
PS. Firewall must be off.
Hey administrollaattori;

In the "Global" section, is it imperative that all that typing need be put in there, or can it be tailored to an individuals specific smb.conf file....I'm trying to do the same thing, setting up shares on a small "home" network, in my case, two machines running LMDE2 17.2 Mint Mate. I use to have all this down-pat before, but got away from LMDE for awhile....different distro's have different smb.conf files, and they have changed the way it's worded and configure....also, there is "No" "share" option in the dropdown menu as there was before when trying to share files in one's network.

My laptop that I'm on right now, is dual boot with Win7 on the other side, only I can't access linux files from there (that side of the hdd)....any suggestions...thanks in advance...

Andrew
User avatar
Minty_64
Level 3
Level 3
Posts: 101
Joined: Mon Jun 30, 2014 3:18 am

Re: samba share setup?

Post by Minty_64 »

ok so what I want is to have my share file with settings as 766, or 776, as to not allow execute. I think what I'm trying to say is that I want to stop execution of code remotely over the network, if I'm going to use users with passwords I get this message when adding a samba user with the smbpasswd command.

Code: Select all

Failed to add entry for user username.
I'm not sure what all I did but somewhere fallowing the video guide settings must have been "damaged" or set something wrong that needs to be undone.

[edit] so I bypassed adding a new user threw the gui, and I have a question as to why every time I transfer a file is it executable?
Last edited by Minty_64 on Tue Aug 04, 2015 9:58 am, edited 1 time in total.
We cannot solve our problems with the same thinking we used in creating them - Albert Einstein
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: samba share setup?

Post by altair4 »

Minty_64 wrote:if I'm going to use users with passwords I get this message when adding a samba user with the smbpasswd command.

Code: Select all

Failed to add entry for user username.
Because that username doesn't exist.

*** You have to create a local user on the Linux box that represents the remote user.
*** Then you need to add that user to the samba database with the smbpasswd command.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
Minty_64
Level 3
Level 3
Posts: 101
Joined: Mon Jun 30, 2014 3:18 am

Re: samba share setup?

Post by Minty_64 »

one last question, is their anything I can do about the character limit when transferring files over the network?

[edit:] found out has to do with being case sensitive = yes/no/auto
We cannot solve our problems with the same thinking we used in creating them - Albert Einstein
Locked

Return to “Networking”