I am trying to give a user other than sudo read/write access to a folder and subs, if I run the command sudo chown user1432 /media/newfolder it throws an error of

chown changing ownership of '/media/newfolder': Permission Denied

Just to confirm I was using the correct username to change to, I ran the command whoami which displayed the username


So I know that element is accurate, if I look at stat /media/newfolder it shows that root is the only user with drwxr perms.

What must I do to change the permission from root to another user? Or even give a different user write permissions?

My fstab reads like this

//192.168.X.XXX/tonythetiger /media/newfolder cifs username=username,password=passwrd 0 0

  • Is /media/newfolder really just a folder, or a mount point of another file system (external storage device)? – bfrguci Mar 2 '16 at 21:38
  • @bfrguci - it is a mounted network share. – user2676140 Mar 2 '16 at 21:39

If the /media/newfolder is a mount point of some other file system, e.g. external drives, network shares, etc. It is possible that the file system does not allow permission management. For example, if it is an FAT USB drive, you will not be able to chown or chmod.

In your case, if it is a network share, you might be able to change its permission or ownership upon mounting it. I am using the noauto,user,idmap=user options for my SSHFS network share, so it is not auto mounted upon booting, and the user who mounts it is regarded as the owner. For Samba shares, you may use uid=<user_name>,gid=<group_name> to set owner and group.

A few lines from my fstab:

<user_name>@<host_name>.local:/home/<user_name> /path/to/mount/point fuse.sshfs noauto,user,idmap=user 0 0
//<host_name>/path/to/samba/share /path/to/mount/point_2 cifs noauto,user,credentials=/path/to/samba/.credentials,uid=<user_name>,gid=root 0 0
  • I am mounting at logon using fstab. Is there a setting I can alter in there to set my logon as the owner? This is a Win 10 share. – user2676140 Mar 2 '16 at 21:44
  • Yes, the options I gave you are from my fstab. Are you using SSHFS or Samba? – bfrguci Mar 2 '16 at 21:45
  • Not sure...how would I check that? – user2676140 Mar 2 '16 at 21:46
  • @user2676140 Hey, you added it to fstab yourself, right? You can see if the "file system" field in your fstab says cifs or sshfs, or whatever else. The third field in the line. – bfrguci Mar 2 '16 at 21:49
  • 1
    @user2676140 I gave you 2 examples from my fstab in my answer. Hope it helps. – bfrguci Mar 2 '16 at 21:51

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.