11

I have mounted a windows share, But only root have write permissions..

I need to change that to my user so my programs can download and save stuff to my windows share.

commands I've have used to mount:

sudo mkdir /mnt/ussenterprise
sudo gedit /etc/fstab
//servername/sharename  /mnt/ussenterprise  cifs  username=msusername,password=mspassword,iocharset=utf8,sec=ntlm  0  0
sudo mount -a

yes I have read access to everything in the mounted share, but only root gave write..

I've tried: sudo chown user:user /mnt/ussenterprise, and sudo chown user /mnt/ussenterprise

I get; permissions denied

what to do?

1
  • Maybe this saves some time to people...I made the changes mentioned above, and also added the uid and gid params in the answer below, but it wasn't working...until I unmounted and mounted again the share
    – Haplo
    Dec 28, 2017 at 18:09

5 Answers 5

13

I changed my /etc/fstab to:

//server/share  /media/share  cifs  username=msusername,password=mspassword,uid=1000,gid=1000  0  0
2

Your entry in fstab is creating the mount point in /mnt. Using the /mnt directory should only work if the drive is a local volume rather than a network share or removable device.

Edit your fstab entry to:

//servername/sharename  /media/ussenterprise  cifs  username=msusername,password=mspassword,umask=002,uid=1000,gid=1000,iocharset=utf8,sec=ntlm  0  0

This assumes that your uid and gid are 1000 which is the first default user and group IDs. Then use:

sudo umount /media/ussenterprise
sudo mkdir /media/ussenterprise
sudo chown user:user /media/ussenterprise
sudo chmod 755 /media/ussenterprise
mount -a

This should mount the share with your user ID and permissions set to read/write.

24
  • sorry the entry in fstab was only a copy/paste of a guid, i have used "mnt/ussenterprise" ..
    – starR
    Dec 20, 2013 at 17:26
  • Change your fstab to make the mount in /media and run the commands I listed. I have a network cifs share mounted exactly like this.
    – douggro
    Dec 20, 2013 at 17:33
  • Still only have read :(
    – starR
    Dec 20, 2013 at 17:40
  • when i run the mount command, i lose all permissions to root
    – starR
    Dec 20, 2013 at 17:43
  • What is the output of ls -l /media ?
    – douggro
    Dec 20, 2013 at 17:44
1

Try these options:

username=msusername,password=mspassword,iocharset=utf8,sec=ntlm,nosetuids,noperm

(definitions of noperm and nosetuids are found in the mount.cifs manpage)

Also, think about using a credentials file instead of having your name/pw in the clear:

credentials=/home/<user>/.smbcredentials

since fstab can be read by all.

1
  • 2
    did not change anything, stil only read
    – starR
    Dec 20, 2013 at 17:42
1

I hope you found out your answer by the way I think this issue is not related to samba option, I think this is for ntfs permission level. In windows 10 you can right click on folder which you want to share between windows and linux base system and follow this path:

  1. Go to properties
  2. Click on sharing tab
  3. Go to advanced sharing
  4. Go to permission and then give full control to everyone user
1
  • I found the answer as writen above "//server/share /media/share cifs username=msusername,password=mspassword,uid=1000,gid=1000 0 0"
    – starR
    Feb 13, 2016 at 0:09
1

This is what worked for me:

https://wiki.ubuntu.com/MountWindowsSharesPermanently

The section: 'Mount password protected network folders' got me READ access. Then, adding: The Section: 'Special permissions' got me WRITE and DELETE access.

My system info: - Laptop: Kubuntu 16.04 (client) - File server: Windows Vista (hosting shares) - Domain controller: Windows Server 2003 (Active Directory, DNS, etc)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .