1

I've been using this line in /etc/fstab for mounting a storage device to my host:

//url.to-my-storage.com/mystorage /mnt/backup cifs iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 0 0

I was mounting it to another host, and I ran this to protect the files from change through the new host:

chmod -R 444 /mnt/backup

(I tried to protect the storage from writing from this host, which turned out to change the mode of all the storage files)

I assume the missing executable permissions what causing me this:

$ sudo mount -a

mount error(13): Permission denied

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I tried unmounting and mounting again, that didn't help, got the same permission error when using the mount command.

ls the dir shows this:

$ ls -la /mnt/backup

?????????? ? ? ? ? ? backup

HELP !

Community
  • 1
  • 1
Gil
  • 854
  • 1
  • 11
  • 23

1 Answers1

0

Dismounting a "Locked Out" Network Drive

To dismount a "locked out" network drive, you can try to force the unmount:

umount -f -t cifs /mnt/backup

If you are having trouble dismounting a drive, make sure that you don't have a console open somewhere where the current working directory (CWD) on the drive which you are trying to dismount, or have a file open in an editor or player somewhere or such.

Properly Mounting a Network Drive

You should add your permissions in your mount options rather than trying to apply them afterwards. You would want to replace these mount options:

rw,file_mode=0660,dir_mode=0770

with

ro

Currently you are mounting your CIFS drive as read-write (rw), giving files read-write permission (file_mode=0660) and directories read-write-execute (dir_mode=0770). Simply mounting the drive as read-only (ro) should suffice. (If you do need to fine tune the file and dir modes, rather use umask.)

I would also advise you to double check whether you are using uid and gid correctly: if the user ID or group ID used gets deleted, that could also lead to problems.

References

phantom-99w
  • 928
  • 1
  • 11
  • 22