In this guide you'll learn how to mount a CIFS/SMB share on Ubuntu. Make sure you have your FTP server and credentials ready.
I wrote this guide when creating a shared folder for the GamePanel server so that it can place backups of the game servers on there.
I advise you run the following as the root user. Especially step 4!
sudo apt install cifs-utils |
This is the folder where you will mount the share to.
sudo mkdir /mnt/backups |
Open your fstab file (/etc/fstab)
. And add something like this to the bottom of the file.
//SERVER_IP_ADDRESS/SHARE_NAME /mnt/backups cifs username=msusername,password=mspassword,iocharset=utf8 0 0 |
You will note that you have enter the password and username here. This is not advisable since the fstab
file is readable by all users. Will fix this in the next step.
fstab
fileRUN THIS AS ROOT! Make this file in the home folder of root (by default /root
). Why? Because only root can access this folder or privileged users. This makes sure that other people cannot access the credentials file.
So create and open the file /root/.smbcredentials
using vim or nano. (Eg sudo vi /root/.smbcredentials
)
username=msusername password=mspassword |
Save and close and then set the permissions that only root can read it.
sudo chmod 600 /root/.smbcredentials |
You can verify it by writing:
sudo ls -al /root/.smbcredentials |
If everything is correct you should see this: