Take the 2-minute tour ×

I mounted a Windows share to my Ubuntu 11.10 system via adding the following line to the /etc/fstab:

//serveraddr/sharedfolder /mnt/foldername/ smbfs credentials=/home/myname/.smbpasswd 0 0

using the tutorial here.

But there's a problem with the permissions. The owner of the mount folder is root. I can not create any folders or files in the mounted point is I don't become the root. Even I can not change the ownership to my default user via

sudo chown -R myname .

I googled and saw that it might stem from the fact that Windows file formats (fat32/ntfs) can not save ownership. But when I connect to the same location via samba as


by providing my credentials, I have the privileges to write without being the root.

How can I make it to let me write to the mounted folder?

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

Don't use smbfs, the new protocol's name is cifs and its part of the package cifs-tools (install it if you did not already.

Instead use this line in your fstab

//server/share /mnt/mountname cifs username=server_user,password=user_password,iocharset=utf8,file_mode=0777,dir_mode=07‌​77 0 0


server = your server that you are trying to access
share = mapped share on that server
/mnt/mountname = any folder that you created with sudo /mnt/<folder_name>
username = the name of the user on that server that can access the mount
password = the password for that user

After that you can test with sudo mount -a, if you dont get any faults you can safely reboot to find your shares mounted in /mnt/<folder_name>.

To use a credentials file instead of the username and password parameters on the fstab you can create a file with those 2 lines so that your username and password are not explicitly shown in the fstab

sudo nano /etc/cifspwd

Add these lines to the file

username=<username on server>
password=<password for that username>

Press ctrl+x keys and when asked press y to save the file.

Secure it with

sudo chmod 600 /etc/cifspwd

Use this line instead of the previous

//server/share /mnt/mountname cifs credentials=/etc/cifspwd,iocharset=utf8,file_mode=0777,dir_mode=07‌​77 0 0

After this it will be safe to reboot and you mount should be mounted and your details secured.

share|improve this answer
If this does not work please paste the output of cat ~/.smbpasswd. –  Bruno Pereira Oct 26 '11 at 17:58
@bbrunopereira81: It doesn't work. cat .smbpasswd gives user=name.surname pass=******* dom=domainname –  petrichor Oct 26 '11 at 18:30
@İsmailArı why do you have domain? are you part of a domain??? try using all on the same line instead of making a file apart for the credentials, try this on a terminal: sudo mount -t cifs //ip_from_windows_pc/sharename /mnt/share -o username=windows_username,password=windows_password_for_user,iocharset=utf8,file‌​_‌​mode=0777,dir_mode=0777. if you get faults write them down. –  Bruno Pereira Oct 26 '11 at 18:34
Added information for the credentials file, you can also use that method. –  Bruno Pereira Oct 26 '11 at 19:45
I think it's worth noting that in Ubuntu 12.10, "mode" was not a valid parameter. Instead, I had to use "file_mode". Also, I'm not sure I entirely agree with general permissions of 0777. If you're mounting a private share just for yourself, I think something like "file_mode=0660,dir_mode=0770" would be more appropriate. –  Avian00 Mar 13 '13 at 8:11
show 11 more comments

Your Answer


