Jump to content
We're Hiring! Full Stack Developer ×

Folder Owner & Permissions


simpic

Recommended Posts

Hi,

 

If I have a cache drive setup on /mnt/cache and I want apps running on a ubuntu server as user 'sp' to be able to write and create folders with in /mnt/... how do I set it up?

 

Currently /mnt/<whatever> is set up as nobody:users.

 

I have added a user call 'sp' to the group 'users' but this still does not work.

 

When trying to create a file from the ubuntu server I get permission denied.

 

Any suggestions?

 

Regards,

 

simpic

Link to comment

A bit more info...

 

My SMB Config is as below: -

 

Samba Configuration
[global]
server string = Media server
map to guest = Bad User
null passwords = Yes
passdb backend = smbpasswd
syslog = 0
syslog only = Yes
unix extensions = No
load printers = No
printcap name = /dev/null
disable spoolss = Yes
show add printer wizard = No
idmap config * : backend = tdb
create mask = 0770
directory mask = 0770
use sendfile = Yes
map archive = No
wide links = Yes

[sAB]
path = /mnt/disk/sde2

[CACHE]
comment = Disk share
path = /mnt/cache
valid users = root, admin, sp
write list = root, sp
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes

[flash]
comment = Flash share
path = /boot
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes

[disk1]
comment = Disk share
path = /mnt/disk1
read only = No
guest ok = Yes

[disk2]
comment = Disk share
path = /mnt/disk2
read only = No
guest ok = Yes

[disk3]
comment = Disk share
path = /mnt/disk3
read only = No
guest ok = Yes

[disk4]
comment = Disk share
path = /mnt/disk4
read only = No
guest ok = Yes

[backup]
path = /mnt/user/Backup
read only = No
guest ok = Yes

[movies]
comment = Movie Repository
path = /mnt/user/movies
read only = No
guest ok = Yes

[music]
comment = Music Repository
path = /mnt/user/music
read only = No
guest ok = Yes

[mysql]
path = /mnt/user/mysql
read only = No
guest ok = Yes

[photos]
comment = Photo Repository
path = /mnt/user/photos
read only = No
guest ok = Yes

[test]
path = /mnt/user/test
read only = No
guest ok = Yes

[tv]
comment = TV Shows Repository
path = /mnt/user/tv
read only = No
guest ok = Yes

 

If guest ok = Yes is set, should that not mean anyone can write to the share?

Link to comment

ubuntu server:

#id sp

uid=1000(sp) gid=1000(sp) groups=1000(sp),4(adm),20(dialout),24(cdrom),46(plugdev),100(users),110(lpadmin),111(sambashare),112(admin)

# egrep -i "users" /etc/group
users:x:100:sp

 

unRAID server

# id sp

uid=1003(sp) gid=100(users) groups=100(users)

# egrep -i "users" /etc/group
users:x:100:

 

Infering from your comments that the UID need to be the same.... the're not!

 

So I need to change them to be the same UID? I'll investigate.

 

Link to comment

A bit more info...

 

My SMB Config is as below: -

 

Samba Configuration
[global]
server string = Media server
map to guest = Bad User
null passwords = Yes
passdb backend = smbpasswd
syslog = 0
syslog only = Yes
unix extensions = No
load printers = No
printcap name = /dev/null
disable spoolss = Yes
show add printer wizard = No
idmap config * : backend = tdb
create mask = 0770
directory mask = 0770
use sendfile = Yes
map archive = No
wide links = Yes

[sAB]
path = /mnt/disk/sde2

[CACHE]
comment = Disk share
path = /mnt/cache
valid users = root, admin, sp
write list = root, sp
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes

[flash]
comment = Flash share
path = /boot
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes

[disk1]
comment = Disk share
path = /mnt/disk1
read only = No
guest ok = Yes

[disk2]
comment = Disk share
path = /mnt/disk2
read only = No
guest ok = Yes

[disk3]
comment = Disk share
path = /mnt/disk3
read only = No
guest ok = Yes

[disk4]
comment = Disk share
path = /mnt/disk4
read only = No
guest ok = Yes

[backup]
path = /mnt/user/Backup
read only = No
guest ok = Yes

[movies]
comment = Movie Repository
path = /mnt/user/movies
read only = No
guest ok = Yes

[music]
comment = Music Repository
path = /mnt/user/music
read only = No
guest ok = Yes

[mysql]
path = /mnt/user/mysql
read only = No
guest ok = Yes

[photos]
comment = Photo Repository
path = /mnt/user/photos
read only = No
guest ok = Yes

[test]
path = /mnt/user/test
read only = No
guest ok = Yes

[tv]
comment = TV Shows Repository
path = /mnt/user/tv
read only = No
guest ok = Yes

 

If guest ok = Yes is set, should that not mean anyone can write to the share?

Sorry, I hadn't seen this post when viewing on my iPhone within Tapatalk. So you're aware how SMB config settings work? Basically since I don't see a line that says "security" I believe smb defaults to "user" type security which means a user has to be authenticated against the share before it becomes available to even see it I THINK. So, from your ubuntu server when you issue the following commands what are the results?

smbclient -L servername

 

Mine would be

smbclient -L dell

 

it will ask for your password, I am assuming you're attempting to run smbtree using this user you're calling sp, that's what I want you to do. Now when it asks for your password enter the password of the sp user on the remote unRAID machine (are passwords the same, makes it so much easier!). It should return a list like this.

 

smbclient -L dell

Enter daniel's password:

Domain=[LINUX] OS=[unix] Server=[samba 3.4.7]

 

Sharename      Type      Comment

---------      ----      -------

recordings2    Disk      MythTV secondary folder on dell

500gb          Disk      500gb storage on dell

500gb1          Disk      500gb1 storage on dell

fat32_movies    Disk      Movies on dell

fat32          Disk      Movies on dell

music2          Disk      Music2 folder on dell

mythtv          Disk      Mythtv folder on dell

recordings      Disk      TV Recordings on dell

videos          Disk      Mythtv videos on dell

music          Disk      Mythtv music on dell

pictures        Disk      Pictures folder on dell

IPC$            IPC      IPC Service (dell)

Domain=[LINUX] OS=[unix] Server=[samba 3.4.7]

 

Server              Comment

---------            -------

CORE2DUO            core2duo

DELL                dell

WINXP                dans windows computer

 

Workgroup            Master

---------            -------

LINUX                DELL

 

whats that showing me is available shares to the user daniel, again I THINK...... (little disclaimer: I don't claim to be an expert in SMB file sharing but can only help based on my experience)

 

now you know the exact share name and servername so issue the following

 

smbclient \\\\servernameorip\\sharename youpasswordhere

obviously fill in YOUR info so my example would be like this

smbclient \\\\dell\\mythtv 'xxxxxxxxxxxx'

NOTE: my password has to be within quotes because it contains special characters. meaning I hit shift and a number to get an @ symbol for example into my password

 

you should be shown this:

Domain=[LINUX] OS=[unix] Server=[samba 3.4.7]

smb: \>

 

now lets try to create a directory using the following command

 

mkdir testing

 

IF it worked then ssh into the server and issue an ls -la command to see who the owner and permissions on the dir you created.

 

GOOD LUCK

 

 

 

Link to comment

Hi,

 

Thank you for your reply.

 

Unfortunately still no joy!

 

sp@linux-server:~$ smbclient \\\\tower\\tv mypassword
Domain=[WORKGROUP] OS=[unix] Server=[samba 3.6.1]
smb: \> mkdir test
NT_STATUS_ACCESS_DENIED making remote directory \test

 

I get the same result for the cache dir aswell.

 

Link to comment

I have played around a little more and now have partial success:-

 

sp@linux-server:/etc/samba$ smbclient \\\\tower\\CACHE mypassword
Domain=[WORKGROUP] OS=[unix] Server=[samba 3.6.1]
smb: \> mkdir fdfd
smb: \>

 

It works !

 

root@Tower:/mnt/cache# ls -la
total 0
drwxrwx---  5 nobody users 128 Nov 29 11:47 ./
drwxr-xr-x 12 root   root    0 Nov 28 19:06 ../
drwxrwxrwx  2 sp     users  48 Nov 29 11:47 fdfd/
-rw-rw-rw-  1 root   root    0 Nov 29 08:17 test

 

The share CACHE is set up in smb.conf as follows: -

 

root@Tower:/mnt/user/tv# testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "null passwords" option is deprecated
Processing section "[sAB]"
Processing section "[CACHE]"
Processing section "[flash]"
Processing section "[disk1]"
Processing section "[disk2]"
Processing section "[disk3]"
Processing section "[disk4]"
Processing section "[cache]"
Processing section "[backup]"
Processing section "[movies]"
Processing section "[music]"
Processing section "[mysql]"
Processing section "[photos]"
Processing section "[test]"
Processing section "[tv]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        server string = Media server
        map to guest = Bad User
        null passwords = Yes
        passdb backend = smbpasswd
        syslog = 0
        syslog only = Yes
        unix extensions = No
        load printers = No
        printcap name = /dev/null
        disable spoolss = Yes
        show add printer wizard = No
        idmap config * : backend = tdb
        create mask = 0770
        directory mask = 0770
        use sendfile = Yes
        map archive = No
        wide links = Yes

[sAB]
        path = /mnt/disk/sde2
        guest ok = Yes

[CACHE]
        comment = Disk share
        path = /mnt/cache
        valid users = root, admin, sp
        write list = root, sp
        read only = No
        create mask = 0777
        directory mask = 0777
        guest ok = Yes

[flash]
        comment = Flash share
        path = /boot
        read only = No
        create mask = 0777
        directory mask = 0777
        guest ok = Yes

[disk1]
        comment = Disk share
        path = /mnt/disk1
        read only = No
        guest ok = Yes

[disk2]
        comment = Disk share
        path = /mnt/disk2
        read only = No
        guest ok = Yes

[disk3]
        comment = Disk share
        path = /mnt/disk3
        read only = No
        guest ok = Yes

[disk4]
        comment = Disk share
        path = /mnt/disk4
        read only = No
        guest ok = Yes

[backup]
        path = /mnt/user/Backup
        read only = No
        guest ok = Yes

[movies]
        comment = Movie Repository
        path = /mnt/user/movies
        read only = No
        guest ok = Yes

[music]
        comment = Music Repository
        path = /mnt/user/music
        read only = No
        guest ok = Yes

[mysql]
        path = /mnt/user/mysql
        read only = No
        guest ok = Yes

[photos]
        comment = Photo Repository
        path = /mnt/user/photos
        read only = No
        guest ok = Yes

[test]
        path = /mnt/user/test
        read only = No
        guest ok = Yes

[tv]
        comment = TV Shows Repository
        path = /mnt/user/tv
        read only = No
        guest ok = Yes

 

Only partial success though...

 

If I mount the CACHE share on /mnt/cache using the following: -

 

sudo mount -t cifs -o user=sp //192.168.1.10/CACHE /mnt/cache
Password:

 

And then attempt to write to it from the sp user on the ubuntu server...

 

sp@linux-server:/mnt/cache$ mkdir jkjk
mkdir: cannot create directory `jkjk': Permission denied

 

No dice :-(

 

Interestingly if I ls -la on ubuntu it shows everything as root:root but on the unRAID server it shows: -

 

root@Tower:/mnt/cache# ls -la
total 0
drwxrwx---  5 nobody users 128 Nov 29 11:47 ./
drwxr-xr-x 12 root   root    0 Nov 28 19:06 ../
drwxrwxrwx  2 sp     users  48 Nov 29 11:47 fdfd/
-rw-rw-rw-  1 root   root    0 Nov 29 08:17 test

 

Any more suggestions?

Link to comment

I have played around a little more and now have partial success:-

 

sp@linux-server:/etc/samba$ smbclient \\\\tower\\CACHE mypassword
Domain=[WORKGROUP] OS=[unix] Server=[samba 3.6.1]
smb: \> mkdir fdfd
smb: \>

 

It works !

 

root@Tower:/mnt/cache# ls -la
total 0
drwxrwx---  5 nobody users 128 Nov 29 11:47 ./
drwxr-xr-x 12 root   root    0 Nov 28 19:06 ../
drwxrwxrwx  2 sp     users  48 Nov 29 11:47 fdfd/
-rw-rw-rw-  1 root   root    0 Nov 29 08:17 test

 

The share CACHE is set up in smb.conf as follows: -

 

root@Tower:/mnt/user/tv# testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "null passwords" option is deprecated
Processing section "[sAB]"
Processing section "[CACHE]"
Processing section "[flash]"
Processing section "[disk1]"
Processing section "[disk2]"
Processing section "[disk3]"
Processing section "[disk4]"
Processing section "[cache]"
Processing section "[backup]"
Processing section "[movies]"
Processing section "[music]"
Processing section "[mysql]"
Processing section "[photos]"
Processing section "[test]"
Processing section "[tv]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        server string = Media server
        map to guest = Bad User
        null passwords = Yes
        passdb backend = smbpasswd
        syslog = 0
        syslog only = Yes
        unix extensions = No
        load printers = No
        printcap name = /dev/null
        disable spoolss = Yes
        show add printer wizard = No
        idmap config * : backend = tdb
        create mask = 0770
        directory mask = 0770
        use sendfile = Yes
        map archive = No
        wide links = Yes

[sAB]
        path = /mnt/disk/sde2
        guest ok = Yes

[CACHE]
        comment = Disk share
        path = /mnt/cache
        valid users = root, admin, sp
        write list = root, sp
        read only = No
        create mask = 0777
        directory mask = 0777
        guest ok = Yes

[flash]
        comment = Flash share
        path = /boot
        read only = No
        create mask = 0777
        directory mask = 0777
        guest ok = Yes

[disk1]
        comment = Disk share
        path = /mnt/disk1
        read only = No
        guest ok = Yes

[disk2]
        comment = Disk share
        path = /mnt/disk2
        read only = No
        guest ok = Yes

[disk3]
        comment = Disk share
        path = /mnt/disk3
        read only = No
        guest ok = Yes

[disk4]
        comment = Disk share
        path = /mnt/disk4
        read only = No
        guest ok = Yes

[backup]
        path = /mnt/user/Backup
        read only = No
        guest ok = Yes

[movies]
        comment = Movie Repository
        path = /mnt/user/movies
        read only = No
        guest ok = Yes

[music]
        comment = Music Repository
        path = /mnt/user/music
        read only = No
        guest ok = Yes

[mysql]
        path = /mnt/user/mysql
        read only = No
        guest ok = Yes

[photos]
        comment = Photo Repository
        path = /mnt/user/photos
        read only = No
        guest ok = Yes

[test]
        path = /mnt/user/test
        read only = No
        guest ok = Yes

[tv]
        comment = TV Shows Repository
        path = /mnt/user/tv
        read only = No
        guest ok = Yes

 

Only partial success though...

 

If I mount the CACHE share on /mnt/cache using the following: -

 

sudo mount -t cifs -o user=sp //192.168.1.10/CACHE /mnt/cache
Password:

 

And then attempt to write to it from the sp user on the ubuntu server...

 

sp@linux-server:/mnt/cache$ mkdir jkjk
mkdir: cannot create directory `jkjk': Permission denied

 

No dice :-(

 

Interestingly if I ls -la on ubuntu it shows everything as root:root but on the unRAID server it shows: -

 

root@Tower:/mnt/cache# ls -la
total 0
drwxrwx---  5 nobody users 128 Nov 29 11:47 ./
drwxr-xr-x 12 root   root    0 Nov 28 19:06 ../
drwxrwxrwx  2 sp     users  48 Nov 29 11:47 fdfd/
-rw-rw-rw-  1 root   root    0 Nov 29 08:17 test

 

Any more suggestions?

Ok, so you did say that your UID and GID for user sp do NOT match on ubuntu as they are in unRAID correct? Well, mine just all works because my user on my workstation is the same user on my server, same meaning not only name but UID and GID as well which is 1000. I have never messed with the uid and or gid but I believe you can tell you fstab on your ubuntu machine to mount is using certain uid and gid such that when it writes to it it's acting like it is the sp user from the unRAID server.
Link to comment

Looks like I have got it working by changing the UID & GID to be the same, then chmod & chgrp on all the shares SAB or Sickbeard need to access.

 

Just need to sort the fstab now...

 

Can someone help convert the following mount command into something that will work in fstab...

 

sudo mount -t cifs -o user=sp,password=*********,UID=10000,GID=100,rw //192.168.1.10/tv /mnt/tv

 

Thanks :-)

Link to comment

Looks like I have got it working by changing the UID & GID to be the same, then chmod & chgrp on all the shares SAB or Sickbeard need to access.

 

Just need to sort the fstab now...

 

Can someone help convert the following mount command into something that will work in fstab...

 

sudo mount -t cifs -o user=sp,password=*********,UID=10000,GID=100,rw //192.168.1.10/tv /mnt/tv

 

Thanks :-)

Ubuntu has one of the great online free community support ever IMO. I am a member over on ubuntuforums.org and now that I know unRAID is really just custom webgui accessing bascially the linux kernel, much support can be found over there or even just google. Here ya go

https://wiki.ubuntu.com/MountWindowsSharesPermanently

Link to comment

Hi,

 

Thanks for all your help. I have managed to figure it out! Not entirely sure it's all done in the correct fashion but at the moment it works.

 

The unRAID shares have to be set up like so in the /etc/samba/smb-shares.conf...

 

[tv]
path = /mnt/user/tv
comment = TV Shows Repository
browseable = yes
read only = No
create mask = 0777
directory mask = 0777
        guest ok = Yes
# Public
public = yes
writeable = yes

 

With the appropriate name for the share.

 

Then the ubuntu server user has to be created on the unRAID server with the same UID and added to the users group.

 

The fstab entries are as follows: -

 

//192.168.1.10/tv /mnt/tv cifs user=sp,password=**********,gid=100,uid=10000 0 0

 

I guess I could put the creds in a file if I really wanted to, but right now I would just like to watch some stuff rather than playing with the damn boxes!

Link to comment

Hi,

 

Thanks for all your help. I have managed to figure it out! Not entirely sure it's all done in the correct fashion but at the moment it works.

 

The unRAID shares have to be set up like so in the /etc/samba/smb-shares.conf...

 

[tv]
path = /mnt/user/tv
comment = TV Shows Repository
browseable = yes
read only = No
create mask = 0777
directory mask = 0777
        guest ok = Yes
# Public
public = yes
writeable = yes

 

With the appropriate name for the share.

 

Then the ubuntu server user has to be created on the unRAID server with the same UID and added to the users group.

 

The fstab entries are as follows: -

 

//192.168.1.10/tv /mnt/tv cifs user=sp,password=**********,gid=100,uid=10000 0 0

 

I guess I could put the creds in a file if I really wanted to, but right now I would just like to watch some stuff rather than playing with the damn boxes!

Glad you are all sorted out! SMB is a tricky beast with many settings/tuning that can mess things up especially when using "user" level security BUT that's the most secure. The smb.conf man page being over 7250 lines it's overwhelming to set up SMB correctly. Yes, you should have your credentials in a file BUT really doesn't matter if you're only streaming internally IMO.
Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...