Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I set up a few shares a while ago. I use these under both windows and linux. The problem I have relates to usage on a linux box. The smb.conf for the share in question reads:
Quote:
[shared]
path = /home/doco
writeable = yes
browseable = yes
read only = no
guest ok = yes
valid users = doco
public = yes
create mask = 0666
directory mask = 0777
I saw a post on here recently about samba privileges but I can't find it. Basically, do I need to add some hooks either in the smb.conf file or at mount time to give me access to new files created?
guest ok (S)
If this parameter is yes for a service, then no password is required to connect to the service. Privileges will be those of the guest account.
valid users (S)
This is a list of users that should be allowed to login to this service
create mask (S)
When a file is created, the necessary permissions are calculated according to the mapping from DOS modes to UNIX permissions, and the resulting UNIX mode is then bit-wise 'AND'ed with this parameter. This parameter may be thought of as a bit-wise MASK for the UNIX modes of a file. Any bit not set here will be removed from the modes set on a file when it is created....New in Samba 4.0.0. This mask is applied whenever permissions are changed on a file. To allow clients full control over permission changes it should be set to 0777.
According to this settings you will be mapped to guest and execute permission is removed, and not allowed to restore.
thanks pan64. Your explanation on the mapping of permissions (execute permission is removed, and not allowed to restore) explains my predicament and also why I can read/write office docs with no fuss. The solution in this instance is to create a new share for coding where I can build executables.
[tim@petunia ~]$ ls -lh /mnt/coding/aaa
-rw-r--r--. 1 506 506 0 May 14 11:33 /mnt/coding/aaa
I copy a file from my home area into the share and the privileges change:
Quote:
[tim@petunia ~]$ ls -lh Documents/coding/sizes.c
-rwxrw-r--. 1 tim tim 1.1K May 9 11:24 Documents/coding/sizes.c
[tim@petunia ~]$ cp Documents/coding/sizes.c /mnt/coding/
[tim@petunia ~]$ ls -lh /mnt/coding/
total 1.0M
-rwxr--r--. 1 506 506 1.1K May 14 2013 sizes.c
I think I am confused about privileges between the samba server and my PC...I specified a mask of 777 so everyone should be able to read, write, execute. Is that right? However, I am losing group privileges when I copy to the share. Basically, when I create a file in the share, on my Fedora box I want it to be writeable and executable from the Fedora box. Are there any other setting I need to add to smb.conf?
I think the problem is related to user ids, somehow they are not properly configured. You can see used ids instead of user names.
touch aaa created the file but it was immediately owned by someone else and you will have no write access any more. So can you please tell us some details about the users (tim, coding, doco, 503, 506) on both hosts.
doco (503) is the owner of the doco share (/home/doco). I don't have any records on how this was set up.
So when the client mounts the coding share it uses the coding login to verify with the server. However, tim is logged in to the client and there is no coding login on the client.
my umask is 002. I recreated the aaa file and tried chmod. From my user this did not work, from root it worked.
Quote:
[tim@petunia coding]$ touch /mnt/coding/aaa
touch: cannot touch ‘/mnt/coding/aaa’: Permission denied
[tim@petunia coding]$ ls -lh /mnt/coding/aaa
-rw-r--r--. 1 506 506 0 May 16 2013 /mnt/coding/aaa
[tim@petunia coding]$ chmod 777 /mnt/coding/aaa
chmod: changing permissions of ‘/mnt/coding/aaa’: Operation not permitted
[tim@petunia coding]$ ls -lh /mnt/coding/aaa
-rw-r--r--. 1 506 506 0 May 16 2013 /mnt/coding/aaa
[tim@petunia coding]$ sudo chmod 777 /mnt/coding/aaa
[sudo] password for tim:
[tim@petunia coding]$ ls -lh /mnt/coding/aaa
-rwxrwxrwx. 1 506 506 0 May 16 09:50 /mnt/coding/aaa
So the file is created under the user coding (506) while I am logged on as tim. Do I need to include something in smb.conf to open up access to the tim user/group?
Hi pan64, I tried that as well but no joy. I have set up a VirtualBox PC to play around with this problem. The first share I created had exactly the same problem.
From the posts you have made so far I can see that this is a problem relating to ownership conflicts between the share and the host computer. I guess I need to dig deeper to find a solution to this. If/when I come up with a solution I will post it here.
okay, looks like I am in business now. First of all I will have to go back on my last post as I added "force create mode = 777" & "force directory mode = 777" and I can read, write & x. The other thing I came across which will not have been evident from any of my posts is that I was using the share name [shared] for all my shares! Changing this to [coding] could also have helped to solve this:
Quote:
[coding]
path = /home/coding
valid users = coding
read only = No
create mask = 0777
force create mode = 0777
directory mask = 0777
force directory mode = 0777
anyway, thanks for all the help. I will mark this one as solved in a day or 2 unless something else goes wrong
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.