# [Solved]Permission denied when user is browsing

## Sedrik

Hi all

I've got two drives that I want to mount so that my user can access them. I currently have this in my fstab but it does not allow him to read them  :Sad: 

```

/dev/hda1              /mnt/C          ntfs            noauto,noatime,users  0 0

/dev/hdb1              /mnt/D          vfat            noauto,noatime,users  0 0

```

How can this be fixed?

----------

## sugar

try user instead of users (I think?!)

or if you're using Gnome (or KDE as well, I'm not sure), you can automount devices and not bother with fstab.

----------

## Sedrik

Not using KDE or Gnome.

user=sedrik then?

----------

## tylerwylie

No, just simply use "user" instead of "users"

----------

## Sedrik

Nope, still getting permission denied when trying to cd into the vfat disk as my user (haven't tried the other one yet)

----------

## sugar

Is the user part of the plugdev group?

```
gpasswd -a sedrik plugdev
```

----------

## Sedrik

 *sugar wrote:*   

> Is the user part of the plugdev group?
> 
> ```
> gpasswd -a sedrik plugdev
> ```
> ...

 

nope, the group doesn't even exist. Should I try creating it?

```
gpasswd -a sedrik plugdev

unknown group: plugdev

gpasswd: Permission denied.

```

----------

## sugar

yup! apparently you can just create it, and then add your user to it.

```
groupadd plugdev
```

----------

## Sedrik

no difference.. =(

----------

## sugar

so, to recap, you've

changed 'users' to 'user' in your fstab

added the plugdev group

added your user to the plugdev group?

----------

## Sedrik

 *sugar wrote:*   

> so, to recap, you've
> 
> changed 'users' to 'user' in your fstab
> 
> added the plugdev group
> ...

 

Yes, and still I get permission denied when I try to cd into it (root can).

----------

## PsychoticRetina

post output of:

```
ls -la /mnt
```

----------

## Sedrik

```
ls -la /mnt/

total 56

drwxr-xr-x   6 root root  4096 Jul 29 12:05 .

drwxr-xr-x  19 root root  4096 Jul 22 17:47 ..

-rw-r--r--   1 root root     0 Feb 14 01:03 .keep

dr-x------   1 root root  8192 Jul 22 13:04 C

drwxr-xr-x  11 root root 32768 Jan  1  1970 D

drwx------   2 root root  4096 Feb 14 01:03 cdrom

drwx------   2 root root  4096 Feb 14 01:03 floppy

```

That does not look to good ^^

How to edit fstab to mount it as my user and setting permission right?

----------

## PsychoticRetina

add umask=0222 in the comma separated field (behind user). this will give read and execute permissions to owner, group and world.

----------

## Sedrik

ok, umask=0772 for root and my user to be able to write to?

----------

## NeddySeagoon

Sedrik,

umask=0 for everyone to write.

----------

## Sedrik

Well not everyone, only group and owner.

----------

## PsychoticRetina

as in: rwxrwx---  ? umask=0007 i think. writing to an nfts partition isnt the best idea; at least it didt use to be...

EDIT: umask works sort of the opposite way of chmod, the presence of a digit takes away the option, so to speak.

r--r--r--   ->  0333

-w--w--w-   ->  0555

rwxrw-r--   ->   0013

----------

## Sedrik

yeah that is true, the ntfs system can be ro as it is. but I need to write to my vfat system (that's the reason it is vfat ^^)

----------

## Sedrik

What is the syntax of the umask option?

----------

## sugar

for example, the entry for my ipod used to look like this.

```
/dev/ipod              /mnt/ipod       auto    user,noauto,umask=000      0 0
```

----------

## PsychoticRetina

@Sedrik: look at my previous edited post.

----------

## Sedrik

And that allows everyone to read and write?

So I sould do something like, umask=0002 if I want the public to only read and execute?

----------

## Sedrik

Ok now I got

```

/dev/hda1               /mnt/C          ntfs            noauto,noatime,user,umask=0222  0 0

/dev/hdb1               /mnt/D          vfat            noauto,noatime,user,umask=0002  0 0

```

This gives me

```

ls -la /mnt/

total 56

drwxr-xr-x   6 root   root   4096 Jul 29 12:05 .

drwxr-xr-x  19 root   root   4096 Jul 22 17:47 ..

-rw-r--r--   1 root   root      0 Feb 14 01:03 .keep

dr-xr-xr-x   1 root   root   8192 Jul 22 13:04 C

drwxrwxr-x  11 sedrik wheel 32768 Jan  1  1970 D

drwx------   2 root   root   4096 Feb 14 01:03 cdrom

drwx------   2 root   root   4096 Feb 14 01:03 floppy

```

Wounderfull  :Smile:  Thanks all  :Smile: 

----------

## PsychoticRetina

you start out with:

0

7

7

7

then:

r = -4    (as in subtract 4)

w = -2

x = -1

so if you want   rwxr-xrw-  (just an arbitrary example)  you go:

owner: (-4-2-1)=-7

group: (-4-0-1)=-5

world: (-4-2-0)=-6

then:

0

7 - 7 = 0

7 - 5 = 2

7 - 6 = 1

yielding: 0021

probably not the best explanatioin, but should give you a picture of how it works.

----------

## NeddySeagoon

Sedrik,

vfat has no concept of owner and group but you can fake it at mount time with the uid= and gid= options.

You can get finer control to. Read man mount, starting with 

```
Mount options for fat
```

If your fstab entry has noauto, user (or users) the user that runs the mount command will become the owner.

Thats root, if you are not careful.

----------

## Sedrik

 *vesselin wrote:*   

> you start out with:
> 
> 0
> 
> 7
> ...

 

Ok that cleared some things up =) thanks

----------

## Sedrik

 *NeddySeagoon wrote:*   

> Sedrik,
> 
> vfat has no concept of owner and group but you can fake it at mount time with the uid= and gid= options.
> 
> You can get finer control to. Read man mount, starting with 
> ...

 

ok, but that should be fine in my case. =)

Thanks  :Smile: 

----------

