Unable to create files/folders or drag anything in - Permissions issue with ubuntu and windows mount share

I have Nextcloud up and running on Ubuntu 20.04 LTS.
I have mounted my windows share using this command:
‘sudo mount -t cifs //192.168.XX.XXX/x -o username=server /mnt/winshare’

I was unable to mount the share using fstab with this command:
//192.168.XX.XXX/x /mnt/share/x cifs credentials=/home/trebu/.server_creds,iocharset=utf8,file_mode=0777,dir_mode0777 0 0’

which returns:
mount error(22): Invalid argument

I can view my files in nextcloud fine, but I can’t create any new files or folders or even drag anything in. Yet in linux terminal I can sudo mkdir just fine or create files as well as remove them.

I am pretty sure this is a permissions issue on the mount drive as it needs www-data and whatnot but I have no idea how to set that up and everything I’ve stumbled across has been no help.

Now this share has 25+ TB of data to keep in mind as some suggestions were to grant permissions to every file and folder or move them which is NOT happening. Windows is using these files all day every day for various server/business tasks.

I saw somewhere that in late 2019 that fstab command listed above had undergone changes or something but I have no clue.

I have clients who really need to be able to manipulate their data and get this feature back that I had on my windows instance of nextcloud with WSL.

Thank you!

Hi, it looks to me that your fstab entry is missing the uid and gid option.
Additionally I would add the nounix and noserverino option and I would change the file_mode and dir_mode to 0770.
If your webserver is running as www-data, the following line should work:

//192.168.XX.XXX/x /mnt/share/x cifs credentials=/home/trebu/.server_creds,iocharset=utf8,file_mode=0770,dir_mode=0770,uid=www-data,gid=www-data,nounix,noserverino 0 0

If you are running nextcloud on a VM with Debian or Ubuntu, and don’t use the snap, you could also try to use this script: https://github.com/nextcloud/vm/blob/master/apps/smbmount.sh