Perşembe, Mart 07, 2019

Qnap shared folder add or mount ( nfs cifs ) on linux and windows operating systems

This documentations is prepared for qnap ts453Be model. 

Qnap lets you to access shared folders using nfs and cifs. 

But first you have to enable windows and nfs services from the Network services->Win/MAC/NFS

Check the boxes which OS host access from. 

After the services are enabled, you have to create volumes/lun under storage sections (if you did not create storage pool you have to create it first).

NFS does not require users but for cifs we have to create users. 
Go to users sections from control panel and create users. 





Btw you can change shared folder permissions at the same time.

Shared folder options are made from -> 
Control Panel->Privilege->Shared Folders->Edit shared folder permissions
You can create new folder from here and change users permissions and host Access for nfs share. 


For nfs and host ip Access toggle down the permission type bar and choose NFS host Access.
You can add ip’s which will be Access to shared folder for secure access. 



After you give the permissions for cifs and host Access for nfs, lets mount them to the hosts.

Ubuntu 16.04
First install required packages for ubuntu.

#sudo apt-get updatesudo apt-get install nfs-common


then create mount folder. 

For nfs protocol:
#sudo mkdir /mnt/nfs

For cifs protocol:
#sudo mkdir /mnt/cifs

At the end we will mount the same shared folder but we specify different folders to test. 
You should use one of them. No need to both. 

in order to connect with nfs 
#sudo mount -w -v -t nfs qnap_ip:/shared_folder_name/mnt/nfs/

For cifs connections we have to specify user and password as we creted on qnap users. And read/write permissions must be set.  
#sudo mount -vvv -t cifs -o username=username,password=password //qnap_ip:/shared_folder_name /mnt/cifs
---

If you want to mount shared folder automatically, you must specify them at fstab:
if you dont do that you wont see mounted folder after reboot!

for nfs:

#sudo vi /etc/fstab

Caution: add the following line bottom of fstab file. Dont delete upper lines. If you do so you can not start your OS after reboot. Be careful at this step!
qnap_ip:/shared_folder_name     /mnt/nfs    nfs4    rw,sync    0 0
 save and check with mount -a command is there anything wrong
#mount -a


for cifs: 

#sudo vim .smbcredentials

username=*****
password=*****


#chmod 0600 ~/.smbcredentials

#sudo vi /etc/fstab 

Caution: add the following line bottom of fstab file. Dont delete upper lines. If you do so you can not start your OS after reboot. Be careful at this step!
qnap_ip:/shared_folder_name /mnt/cifs cifs credentials=/home/your_user_name /.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777

 save and check with mount -a command is there anything wrong

#mount -a

 For Windows 7 
First we have to enable cifs server features from the program options under control panel, and add this feature.

Click the radio button of this feature and apply ok.
Control Panel->Programs->Turn Windows features on or off-> SMB 1.0/CIFS file sharing support

Then,
Go to computer folder and click "map a network drive" 
Then enter:
You can remain "reconnect at logon"
Then enter user and password. 
Then "remember my credentials". 

Thats it!