Jump to content
Sn3akyP3t3

[Solved] Mount Unraid User Share On Linux Permissions

18 posts in this topic Last Reply

Recommended Posts

I'm getting more experience with umask now and then, but still something about mounting network shares in Linux evades me.  I don't know what the cause of my problem is, but the symptoms are a bit heavy and require workaround to move/copy files.

 

The problem I'm encountering is that my user account on Linux does not have write access to the mounted user share from UnRaid.  I have to run any file operations as root to do anything which really isn't what I'm trying to accomplish.  My goal is to set up the user share mount as write access to only root and my user account.  If I can identify my problem then later I can set up access to a group which will probably be needed in the future.

 

I'm using this command to mount:

mount -t cifs -o username=UnraidUsername,umask=000,rw //192.168.2.12/UnraidShare /mnt/LocalShare/

 

I realize umask 000 is not a good idea, but at the moment I'm not sure why the mounted share doesn't allow me to write to it.

 

Before mounting:

drwxrwxrwx 2 root LocalUsername 4096 2011-06-01 00:04 LocalShare

 

After mounting:

drwxr-xr-x 1 root root 0 2010-06-13 15:16 LocalShare

Also, one directory inside of LocalShare

drwxr-xr-x 0 root root 0 2010-06-13 12:18 InsideLocalShare

 

Initially the LocalShare ownership was root root and I had the same symptoms although I didn't review the permissions flags to see if they were same.  If someone could identify what I'm doing wrong that would help me for sure and hopefully someone else like me that has my same faulted logic.

Share this post


Link to post

Are you able to mount this NFS share on another machine and write to it as your Linux username?

 

Just want to make sure of this before we proceed on unRAID.

 

 

Share this post


Link to post

I had the same problem with unRAID shares on an Ubuntu installation. After several hours of google-fu and many tests I finally found a combination of parameters that gave me write access. Here's a sample that's working for me from my fstab:

 

 

//tower/Downloads /mnt/tower/Downloads cifs username=<username>,uid=<username>,gid=users,dir_mask=0777,file_mask=0755,password=,rw 0 0

 

You may not need all those parameters. I can't remember which one finally made the difference. I was just relieved to finally have it working.

Share this post


Link to post

Are you able to mount this NFS share on another machine and write to it as your Linux username?

 

Just want to make sure of this before we proceed on unRAID.

 

 

I have only one linux machine, but I have written to the user shares from a windows machine.

 

I do believe I may have generated confusion in my initial post.  The username on my linux machine is not the same as the username of the unraid box.  I have modified my previous post to reflect that.

Share this post


Link to post

I'm running Ubuntu 10.04 on the Linux machine.

Unraid is running 4.7 Pro.

The mentioned windows machine is running XP Pro.

 

The user share that I'm trying to mount has these settings:

Share name:  UnraidShare

Allocation method:  High Water

Min. free space:  0

Export (SMB):  Export read/write

Valid users: UnraidUsername

Share this post


Link to post

Are you able to mount this NFS share on another machine and write to it as your Linux username?

 

Just want to make sure of this before we proceed on unRAID.

 

 

I have only one linux machine, but I have written to the user shares from a windows machine.

 

I do believe I may have generated confusion in my initial post.  The username on my linux machine is not the same as the username of the unraid box.  I have modified my previous post to reflect that.

 

It doesn't need to as long as you also provide a password (if required).

 

Maybe try not requiring a password, or allowing a Guest to r/w to the share.

 

I'd imagine you also don't have that username on Windows, correct? So if you can connect from Windows to the Linux user share, you should be able to from unRAID.

Share this post


Link to post

Despite following the saying, "Choose the path of least resistance", I will not allow guest level access since it really isn't necessary or desired.  A fair enough approach at troubleshooting the problem, but not for me.  I want to identify what I'm doing wrong and solve that without creating security risks.

 

I'd imagine you also don't have that username on Windows, correct? So if you can connect from Windows to the Linux user share, you should be able to from unRAID.

Correct and understood, thats pretty much the reason I'm posting about it because it is feasible and I need help identifying my problem.  I know there is something amiss, but I haven't a good idea exactly what it is.  I know it is something with my mounting syntax.  I have a feeling that Dase shotgunned the problem but didn't identify the exact point of failure.  I have a feeling that my syntax failure is because a lack of either uid=<username> or gid=users or even something else of that nature that grants specific local linux user or groups access to the mounted drive/share.

Share this post


Link to post

There sitting in the man page was my solution.  Thanks Dase for giving me some syntax of your mount so I could easily see what I was missing.

 

The problem in my case is how the cifs protocol default mounts for file permissions.

Taken from: http://www.samba.org/samba/docs/man/manpages-3/mount.cifs.8.html

uid=arg

 

    sets the uid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a username or a numeric uid. When not specified, the default is uid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the uid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

or

gid=arg

 

    sets the gid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a groupname or a numeric gid. When not specified, the default is gid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the gid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

and knowing that the behavior is like this helps too:

FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS

 

The core CIFS protocol does not provide unix ownership information or mode for files and directories. Because of this, files and directories will generally appear to be owned by whatever values the uid= or gid= options are set, and will have permissions set to the default file_mode and dir_mode for the mount. Attempting to change these values via chmod/chown will return success but have no effect.....

 

Since my Linux box is a single user environment I will add uid to my syntax to resolve my issue.

Share this post


Link to post

I'm having a similar problem. I can mount the share with uid, gid, username and password options. It works fine from the Linux machine. But the files are not created as `nobody:users` on the unRAID machine, which causes problems for other machines (a Mac) when attempting to delete or write to files created by the Linux machine.

 

I need uid/gid to give my Linux account rw access to the share, but I don't want to store the files on the unRAID server with a different uid.

 

In my case, my Linux username is the same as my unRAID username (the share uses "private" security). I don't understand why setting the uid for the share on the Linux machine flows through to the unRAID server. CIFS is not supposed to know anything about Linux permissions, and the uid/gid options are just to make the files appear to be owned by a local Linux uid/gid?

 

Share this post


Link to post

It doesn't. My user names are not the same on the two boxes and I'm able to read/write. Your files only technically need to be owned by the group users, which all your unfair user accounts are a part of.

 

Does Samba work for you? And are you using AFP on your Mac? Trying setting all protocols to secure and giving the same user read/write on all protocols. Then retry on your Mac with samba or AFP and see if that helps.

Share this post


Link to post

Try NFS on both machines. Disk Utility configures NFS auto-mounts. I've been able to resolve blocked write permissions by restarting my Mac.

Share this post


Link to post

NFS just seems a bit too involved, especially when there's AFP for a Mac...

 

I wasn't able to get r/w exporting of my shares over NFS, since in 5.0 beta you can't configure the exports through the webUI.

 

Any 5.0 users know how to do that? Do I need to manually enter it to the go script? That seems a bit annoying when you can configure user permissions for Samba and AFP...

Share this post


Link to post

I didn't see a final solution in this thread so I thought I'd post one. I did more troubleshooting on my Ubuntu 11.04 fstab and this is the final line I ended up using that allows read/write access and creates files with the correct unRAID permissions. From what I could tell, I pared it down to the minimum parameters required to make things work. It's also much cleaner than the line I posted earlier in this thread.

 

//192.168.0.10/disk1 /mnt/disk1 cifs username=<unRAID user>,password=<unRAID user password>,noperms,uid=nobody,gid=users 0 0

  • Replace 192.168.0.10 with your unRAID IP address
  • Replace "disk1" with the unRAID share name that you're mounting
  • My unRAID shares were read-only until I added "noperms"
  • For unRAID 5, you want to make sure your files are owned by the "users" group (gid=users). That's the group that all unRAID users are a member of, and it makes sure your other users can move/delete files you create through your Linux computer. I set the user to nobody (uid=nobody) though you could replace that with your actual unRAID user.

To quote limetech on permissions:

 

All files will be in the 'users' group (gid=100).  Files created under security modes public or secure will be created with the 'nobody' user (uid=99/gid=100).  Files created under security mode private will be owned by that user (uid=1000+/gid=100).  "Ownership" is actually inconsquential since all users are in the same group (the 'users' group) and the group rw permissions are always set.

 

I won't say how many hours I spent on my Ubuntu server figuring this out...

Share this post


Link to post

I use the following line in fstab, and have no problems with permissions on unRAID 5 using private security. My Ubuntu username is the same as my unRAID username. Files created on the unRAID server are owned by my username. From your quote, it sounds like unRAID is setting this because I am using private security.

 

//192.168.1.12/unRAID  /mnt/unRAID  cifs  user,uid=ubuntu_username,gid=ubuntu_username,username=unraid_username,password=unraid_password  0  0

 

Share this post


Link to post

 

This thread was very helpful trying to connect my Ubuntu machine to Unraid, and worked no problem for months.  Unfortunately, after a fresh re-install of Ubuntu 12.04 I couldn't make it work at first.  Maybe this will help someone else.

 

I had to install the package "cifs-utils" through the Software Centre to make it work.  Apparently 12.04 doesn't come with "mount.cifs" out of the box.

 

The only thing that's different behaviour from before is that in Nautilus I must bookmark the mounted folders in the /mnt/ folder, whereas before it would show up automatically under "Computer".

 

Here's my fstab in case it helps someone else:

//192.168.1.139/Shares /mnt/Shares cifs username=<unraid_user>,password=<unraid_password>,noperms,uid=nobody,gid=users 0 0
//192.168.1.139/Not_Shared /mnt/Not_Shared cifs username=<unraid_user>,password=<unraid_password>,noperms,uid=nobody,gid=users 0 0

 

also, spaces between the parameter sections worked, tabs did not.

 

Cheers

III_D

Share this post


Link to post

https://help.ubuntu.com/community/MountWindowsSharesPermanently

 

Is what I'm going from.

 

I'm on ubuntu server LTS 12.04.4, and unRaid 5.0.5, Plex 2.0.20

 

The ubuntu server is connecting to the unRaid server via cifs. On the ubuntu box, you need to install cifs-utils either through package manager or apt-get at command line on the ubuntu box.

 

make a backup of the /etc/fstab file somewhere, then I made the following modifications:

//dumbo/Movies /media/Movies cifs file_mode=0777,dir_mode=0777,_netdev,user=<username>,password=<password>,uid=1000,gid=1000 0 0
//dumbo/Audio /media/Audio cifs file_mode=0777,dir_mode=0777,_netdev,user=<username>,password=<password>,uid=1000,gid=1000 0 0
//dumbo/Tv /media/Tv cifs file_mode=0777,dir_mode=0777,_netdev,user=<username>,password=<password>,uid=1000,gid=1000 0 0
//dumbo/Othervideo /media/Othervideo cifs file_mode=0777,dir_mode=0777,_netdev,user=<username>,password=<password>,uid=1000,gid=1000 0 0

where dumbo is unRaid box, /media/Movies etc are empty real folders on the ubuntu box. <username> is a unRaid user name, <password> is the corresponding password.

 

Each share is mounted with 777 full read/write/execute for owner/group/ and others permissions. I wanted to get the shares mounted like this because I'm using the ubuntu server as a Plex streaming box. Plex Server runs under the user 'plex' and that user needed to have read/write permissions for the shares, or the metadata it gathers wouldn't work - and other fails.

 

[sOLVED]

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.