8

It's a simple question: but I am in much pain over this situation, so here is the question:

How can I "mount" a share so that a) the share is run on boot b) that I can control things like chown/chmod from the client.

# mount -t cifs -o username=root,password=******** //192.168.0.110/backup/ /var/backup/
# chown -R wwwroot:www /var/backup/

this second line will fail as a million "Permission Denied", is there anyway I can place the system settings such that a) this self same command in /etc/fstab/ auto-mounts and b) set things up so I can manage the share as if it were to behave exactly like a local volume

1 Answer 1

11

If you add the share to fstab you should be ok, but remember you need to have a network connection before you actually mount the drive. There "network" option is for that.

Now as to making it look "exactly" like a native partition, you can't. There are certain things that are not supported over a network drive. There are even more things that "may" be support, but depends on the hosts configuration.

You can get pretty close though.

Never mount things as root (across the network)

Change your configuration so that

mount -t cifs -o username=someuser,password=somepass //192.168.0.110/backup /var/backup

Then in /etc/fstab add

//192.168.0.110/backup /var/backup cifs username=someuser,password=somepass,network,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm 

The dir_mode and file_mode force the local files to work like they have those permissions. You can also set other masking options and user options to allow others to access the folders. Keep in mind this removes a layer of security. If your trying to run backups you might want to try backups over SSH or NFS if possible. (NFS is like CIFS but much nicer for Linux to Linux shares, and SSH is supported by almost every backup tool out there).

4
  • Also keep in mind that cifs is supposed to be for user mounts not entire systems. It basically assumes you will be mounting 1 user on this side to 1 user on that side.
    – coteyr
    Nov 3, 2013 at 21:08
  • thanks for your help, in the end I added it as nfs :-) still u answered correctly
    – user50536
    Nov 4, 2013 at 22:37
  • Are file_mode=0777,dir_mode=0777,noperm expected to be listed in the output of mount? Aug 13, 2016 at 14:09
  • @KarlRichter I probably didn't catch your question properly, but those are all options available with the mount.cifs tool. Sep 25, 2017 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.