To access a shared folder on your network from Linux Mint, it must be mounted to the local Linux filesystem. Getting the read/
This guide, as usual, assumes your system is configured per the LAMP server setup guide. Furthermore, I assume your network share is wide open (permitting anonymous access) and you want to allow full read/
Since I want to access this share from PHP and Apache, I will be setting its group to the www-data
usergroup and enabling group read/write permissions.
Create a directory for your mount point
Create a directory, then set owner and permissions:
sudo mkdir /media/my-network-share
sudo chown $USER:www-data -R /media/my-network-share
sudo chmod 02775 /media/my-network-share
Mount a network share from terminal
Mount the folder using the mount
command (all one line, no spaces after commas):
sudo mount
-t cifs
-o username=$USER,
SHARE-IP is the IP address of the system which has the shared folder. (You should also be able to use its name, however on my system the name wouldn't resolve and rather than fixing that issue I just used the IP instead.) SHARE-PATH is the shared folder name or path.
The uid
and gid
parameters mean the mounted directory will be owned by you (the current Linux user) and the www-data
Linux usergroup.
The file_mode
and dir_mode
parameters set the permissions on the mounted directory so that both owner and group can read and write.
This network share will remain mounted until the next reboot. See below for persistent mounts.
Unmount all shares
sudo umount -a -t cifs -l
Auto-mount a network share on every boot
To have the network share automatically mounted on every boot, add it to the fstab
file. This requires slightly different syntax, and you must manually determine your user and group ID numbers in advance.
Find your USERID number:
id -u
Find the GROUPID number for the www-data
usergroup:
id -g www-data
Use nano
to append a line to the fstab
file (all one line, no spaces after commas):
sudo nano -w /etc/fstab
//SHARE-IP/SHARE-PATH /media/my-network-share cifs
username=USERNAME,
Ctrl+O, Enter (to save)
Ctrl+X (to exit nano)
To immediately mount via the fstab
file, run:
sudo mount -a
To ensure everything works as expected, reboot your system, then check the share:
sudo reboot
ls -l /media/my-network-share/