Jump to content

Linux mount SMB share to specific Folder

Go to solution Solved by RONOTHAN##,

Usually if you need to mount a NAS to a specific folder, you'll want it mounted every single time, in which case you should be using the fstab instead. 

 

In order to do the fstab method, run the command:

sudo nano /etc/fstab

This will bring up a window that lists all the drive mounts that happen on boot. Add the following line to the bottom of the file:

//NAS_IP/Backups /Path/To/BackupDel cifs username=correctusername,password=correctpassword 0 0

 

Once done, make sure to test before rebooting. Run the following command, and if it doesn't give any errors you're good to go and will mount the NAS on boot. 

sudo mount -a

 

If you want to do it temporarily though, the command should be 

sudo mount //NASIP/Backups /Path/To/BackupDel -o username=correctusername

 

I am trying to mount a share from my Synology NAS called Backups to a specific Folder on my Ubuntu VM (on Windows Hyper-V). I have found a bunch of tutorials that use CIFS, so I tried the following command:
  sudo mount -t CIFS -o username=corectusername //NasIP/Backups BackupDel 
But I unfortunately get the following error:
  mount error: cifs filesystem not supported by the system
  mount error(19): No such device
  Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
It would be nice if anyone could help me. Thank you in advance.

Link to comment
https://linustechtips.com/topic/1549969-linux-mount-smb-share-to-specific-folder/
Share on other sites

Link to post
Share on other sites

6 minutes ago, TechEnjoyer said:

  sudo mount -t CIFS -o username=corectusername //NasIP/Backups BackupDel 

did you put in the placeholders or did you just copy and paste this as is from somewhere? if it's the latter then you should substitute the placeholders like "NasIP" with the right values.

 

If you just updated the system then you should also try rebooting, maybe the kernel was updated but, without rebooting, the kernel modules for cifs may not be loaded.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to post
Share on other sites

Usually if you need to mount a NAS to a specific folder, you'll want it mounted every single time, in which case you should be using the fstab instead. 

 

In order to do the fstab method, run the command:

sudo nano /etc/fstab

This will bring up a window that lists all the drive mounts that happen on boot. Add the following line to the bottom of the file:

//NAS_IP/Backups /Path/To/BackupDel cifs username=correctusername,password=correctpassword 0 0

 

Once done, make sure to test before rebooting. Run the following command, and if it doesn't give any errors you're good to go and will mount the NAS on boot. 

sudo mount -a

 

If you want to do it temporarily though, the command should be 

sudo mount //NASIP/Backups /Path/To/BackupDel -o username=correctusername

 

Link to post
Share on other sites

@SauronThank you for your quick response. I added the placeholders NasIP and corectusernem in order to not show personal information. I also rebooted the                                 system and still got the same error.

@RONOTHAN##Thank you as well for your quick response. I tried the last command and now get the following error
                                mount error(13): Permission denied
                                Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

 

Link to post
Share on other sites

3 minutes ago, TechEnjoyer said:

Thank you as well for your quick response. I tried the last command and now get the following error
                                mount error(13): Permission denied
                                Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

Double check to see what the username is correct and that the password you entered is correct. If it didn't ask for a password after running the command, change the command to:

sudo mount //NAS_IP/Backups /Path/To/Backup -o username=correctusername,password=correctpassword

 

Link to post
Share on other sites

2 hours ago, RONOTHAN## said:

Double check to see what the username is correct and that the password you entered is correct. If it didn't ask for a password after running the command, change the command to:

sudo mount //NAS_IP/Backups /Path/To/Backup -o username=correctusername,password=correctpassword

 

Thank you for your help. It works now. I only added ~ in front of BackupDel (~/BackupDel) I thought I didn't have to add it because I executed the command in the directory where the folder is located.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×