# Write permission on CIFS shares

## gscheel

Hello All,

I am accessing a network share using CIFS, I used this thread as a guide. I am able to see everything and edit documents as root but as a regular user I can not save any changes. My network login has write permission and as root I can save my changes. I have tried various permutations of chown and chmod but nothing seems to make the remote documents usable by a regular user account.

Any ideas?

----------

## Rexilion

You need to make sure that the regular useraccount can read/write/execute the directory but also that it can access it (traverse freely throught the entire path).

----------

## gscheel

I can 'cd' into the remote directory and open files in, for example, nano. However, when I try to save my changes it says 'permission denied'.

----------

## Rexilion

 *gscheel wrote:*   

> I can 'cd' into the remote directory and open files in, for example, nano. However, when I try to save my changes it says 'permission denied'.

 

Please provide as the user you are trying to write the output of the following (substitute as necessary):

```
id

ls -la /path/to/directory/you/try/to/share
```

----------

## gscheel

id gives me:

```
uid=1000(glen) gid=1002(glen) groups=10(wheel),18(audio),19(cdrom),27(video),100(users),1002(glen)

```

and

ls -la gives me:

```
total 1

drwxr-xr-x 1 root root  0 Jan  7 13:23 .

drwxr-xr-x 1 root root  0 Mar  8 12:28 ..

-rwxr-xr-x 1 root root 57 Jun 30  2004 mins.gif

-rwxr-xr-x 1 root root 58 Jun 30  2004 plus.gif

```

----------

## Rexilion

Safest would be something like:

First, let's make the directory and the files below it be owned by you:

```
chown -R glen:glen /path/to/directory/you/try/to/share/
```

Now, let's lock it down so only you can access it

```
chmod 500 /path/to/directory/you/try/to/share/
```

And finally allow all access to everything 'below' the directory

```
chmod 700 /path/to/directory/you/try/to/share/*
```

That should fix your problem  :Smile:  .

----------

## gscheel

I tried that and the commands did not give me any errors but ls -la still gives me:

```
total 1 

drwxr-xr-x 1 root root  0 Jan  7 13:23 . 

drwxr-xr-x 1 root root  0 Mar  8 12:28 .. 

-rwxr-xr-x 1 root root 57 Jun 30  2004 mins.gif 

-rwxr-xr-x 1 root root 58 Jun 30  2004 plus.gif 

```

Could it be something with the way I have it being mounted? The line from my fstab is:

```
//veris-intranet/intranet /mnt/intranet cifs user,rw,domain=VERIS,credentials=/home/glen/.smbpassword 0 0
```

----------

## Rexilion

 *gscheel wrote:*   

> I tried that and the commands did not give me any errors but ls -la still gives me:
> 
> ```
> total 1 
> 
> ...

 

You need to execute those commands on the server containing the share.

----------

## gscheel

OK, that is unfortunately not an option. It is a windows machine that I do not have direct access to, only over the network. My network login does have write permission to the folder though. I thought that I would be able to let my normal user have write access by mounting it in fstab with the user and rw switches. I guess not though. Thanks anyway for your help.

----------

## Rexilion

That shouldn't be a problem too man mount.cifs yields:

 *Quote:*   

> uid=arg
> 
>            sets the uid that will own all files on the mounted filesystem. It may be specified as either a
> 
>            username or a numeric uid.

 

So:

```
//veris-intranet/intranet /mnt/intranet cifs user,rw,domain=VERIS,credentials=/home/glen/.smbpassword,uid=glen 0 0
```

Makes everything being owned by you.

But there is even more:

 *Quote:*   

>        file_mode=arg
> 
>            If the server does not support the CIFS Unix extensions this overrides the default file mode.
> 
>        dir_mode=arg
> ...

 

So, the final command is:

```
//veris-intranet/intranet /mnt/intranet cifs user,rw,domain=VERIS,credentials=/home/glen/.smbpassword,uid=glen,file_mode=0600,dir_mode=0700 0 0
```

I haven't tested it but it should fix all your problems in one go  :Smile:  .

----------

## gscheel

That worked perfectly. Thank you very much.

----------

