I have a strange problem with Ubuntu file permissions. I have a fresh ubuntu installed server and I've mounted a shared drive. sudo mount //Hostname:ifs/path/to/directory/file /mnt/my directory. The drive mounted successfully but whenever i try to go into any of the shared folder directory, it says "Permission Denied". If i use sudo su - "root" everything works perfectly. But my requirement is the standard user should be able to access the files same as root because we are running certain applications by the standard user which will eventually writes at the location "The mounted shared drive".

I've tried below things:- chown -v myuser:myuser /mnt/shared-drive chmod -R 755 /mnt/shared-drive chown -v myuser:myser /mnt/shared-drive

chmod gets stuck as the data is very huge at the shared drive which ubuntu will try to give full permissions to. The data is about 5-TB. Now even if i do chmod to the shared directory and and get the write permissions, when i create a directory and try to cd into it, it says "Permission denied"

If i copy one of the folders from the shared-drive to local, it still stays with the same error and i have to do chown -v myuser:myser /copied folder name then ti works and i can't keep doing it manually as this will be basically done by my application.

I've checked with the shared owner and he said, there are full permissions already assigned and should work without issues. I'm stuck here guys. Need your kind help.

Thank You!

  • Can you tell us what system the shared dir comes from? Is it linux, windows, qnap, synology? – Thomas Aichinger May 31 '20 at 19:07
  • Hello Thomas, Thanks for the reply, it's a windows shared in my corporate environment with r/w access granted. – Syed Rahman May 31 '20 at 19:28

I suggest you use sshfs to share directories.

With the same user/pass on two machines, this is how I do it:

sshfs file sharing:

  • 1) Install sshfs: sudo apt_get install sshfs
  • 2) Mount dir: sshfs <remote_host>:<dir> <local_dir>
  • 3) Umount dir: fusermount -u <local_dir>

You can set up sshfs so that you don't even need to enter a password when you use it.

  • Hello Bernt,Thansk alot for the prompt response. I've tried as suggested, but the the below error sudo sshfs /devicename:/ifs/file/to/path/shared_services /mnt/myfolder read:connection reset by peer – Syed Rahman May 31 '20 at 19:26
  • I forgot of course! You need to install ssh server on your remote machine for this to work! I find it easiest to use synaptic package manager to do this, look for openssh-server. Hope this helps a little – Bernt Ribbum May 31 '20 at 19:34
  • if i user below sudo mount /devicename:/ifs/file/to/path/shared_services /mnt/myfolder it's mounted successfully. but when i try to cd into any directory, it says "permission denied" If i change permission of any directory in the shared drive, it works after changing permission to 0755 or 777 but without that it won't. Also FYI, If i use root account, i have no problem but since root cannot be enabled for some reasons i need to use the account which was created at the time of installation example created a user "syed" at installation time and everything is under that user only now. :-) – Syed Rahman May 31 '20 at 19:36
  • But how can i have open-ssh server on a windows machine? It's a windows ifs share but same thing. I had requested the storage admin to give me an nfs share as well but the case is same with both shared servers with no luck. Any permissions for the standard, sudo users to be granted? I have 50 server where i need to mount this but it's not working. FYI, Same shared drive is working perfectly if we mount it to any windows hosts it gives no errors. It's with only the Ubuntu server 18.04 LTS. – Syed Rahman May 31 '20 at 19:39
  • Windows? Sorry, don't use it so I can't help you there. – Bernt Ribbum May 31 '20 at 19:42

I've mounted a shared drive. sudo mount //Hostname:ifs/path/to/directory/file /mnt/my directory.

Unless you have specified any other options that will mount the remote share with owner = root and write permissions only to root. CIFS is a virtual filesystem so chown and chmod will not work.

Take possession of the mounted share in the mount statement:

sudo mount -t cifs //hostname/sharename /mnt/my-directory -o uid=myuser
  • Hello Morbius, Thanks for the response. So when i try that suggest, it says "mount.cifs: bad UNC (devicename):/ifs/server/shared/parth – Syed Rahman Jun 1 '20 at 20:47
  • Your original question did confuse me a bit since you used //Hostname:ifs/path which looks like the syntax for NFS but you tagged the question as "samba". If this is a samba question you are using the wrong syntax. Use the one I suggested above. – Morbius1 Jun 2 '20 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.