# mount: can't open /etc/mtab for writing: Permission denied

## Lucky_JL

Hi

After i reboot my server yesterday ( uptime = 95days ), i start to get problems with /etc/mtab

```

mount: can't open /etc/mtab for writing: Permission denied

```

```

/etc/fstab

# <fs>             <mountpoint>       <type>     <opts>            <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/hda1      /boot         ext2      noatime,noauto      1 2

/dev/hda2      none         swap      sw         0 0

/dev/hda3      /         reiserfs   noatime         0 1

# NOTE: The next line is critical for boot!

none         /proc         proc      defaults      0 0

none         /dev/shm      tmpfs      nodev,nosuid,noexec   0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink). 

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

# Adding the following line to /etc/fstab should take care of this:

#/dev/fd0      /mnt/floppy      auto      noauto         0 0

#/dev/cdroms/cdrom0   /mnt/cdrom      auto      noauto,user      0 0

/dev/hdb1      /mnt/hd0      reiserfs   noatime         0 1

/dev/hdc1      /mnt/hd1      reiserfs   noatime       0 1

```

I can only mouny fs if i use "mount -v -n" forcing gentoo to not write in /etc/mtab ...

Any ideas to solve this problem ? ( reinstall is not a options lol )

Thanks in advance

Lucky_JL

----------

## ricce_n

Whats your permissions of /etc/mtab?

```
ls -l /etc/mtab
```

----------

## Lucky_JL

```

root@tok ~ $ ls -l /etc/mtab 

ls: cannot access /etc/mtab: Permission denied

```

 :Sad: 

Lucky_JL

----------

## ricce_n

Wait root@ and $ in the phront... you sure your passwd file isn't messed up?

What is the output of

```
cat /etc/passwd | grep root
```

(Note: if your setup is really broken plaintext or encrypted passwords can be stored in this file....)

Also what is in your PS1 envvar:

```
echo $PS1
```

----------

## Lucky_JL

```

root@tok ~ $ cat /etc/passwd | grep root

root:x:0:0:tok:/root:/bin/bash

operator:x:11:0:operator:/root:/bin/bash

```

```

root@tok ~ $ echo $PS1

\u@\h \W $

```

Lucky_JL

----------

## ricce_n

Ok, no that's not whats wrong.... so check your access rights to /etc

```
ls -ld /etc
```

You are most likely missing the executable rights add them:

```
chmod a+x /etc
```

Then check all content in /etc:

```
ls -l /etc
```

----------

## Lucky_JL

Problem continues  :Sad: 

I can list/edit/execute the other files, only mtab gives me "Permission denied"

Lucky_JL

----------

## Lucky_JL

One question  :Smile: 

If i start with the server with gentoo live cd, how can i test test/verify all the filesystems ( ext2 + reiserfs ) ?

And how can i delete /etc/mtab ? ( maybe mouting reiserfs partition with umask=0 ? )

Lucky_JL

----------

