Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have setup a Freenas system that I would like to mount on my Ubuntu Desktop. Freenas is configured with cifs service.

When I open the freenas server in nautilus smb://freenas/homenas/ I can create and delete files without a problem.

Mounting the server also works:

sudo mount -t cifs //192.168.1.108/homenas /media/bigHD username=test,password=123

The owner of all the files in /media/bigHD is tom (my non root account).

However when I create a file under /media/bigHD its is owned by root. I really do not wish to chown every file/folder after I create it.

How can I fix this?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I figured out the problem I had to specify the gid and uid. Would have saved so much time if I just read the man page more carefully...

uid=arg
           sets the uid that will own all files or directories on the

mounted filesystem when the server does not provide ownership information. It may be specified as either a username or a numeric uid. When not specified, the default is uid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the uid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

gid=arg
       sets the gid that will own all files or directories on the

mounted filesystem when the server does not provide ownership information. It may be specified as either a groupname or a numeric gid. When not specified, the default is gid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the gid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

share|improve this answer
add comment

Using Ubuntu 12.4

I also had the problem, now even though mount.cifs -V returns version 5.1.

I still can only get my NAS to mount with specified UID and GID if they are given as numeric form. Otherwise I'd just get the mounts as root permission, due to the sticky on mount.cifs.

Interestingly, if provided in the non-numeric form. The UID and GID were still picked up correctly.

Anyway, I put this here if anyone has the same problem, working fstab line was:

//mynas/scratch /media/scratch cifs noauto,users,_netdev,credentials=/home/meeee/.smbcredentials,iocharset=utf8,uid=1000,gid=1002,file_mode=0774,dir_mode=0775 0 0
share|improve this answer
    
Interesting that version 5.1 doesn't support non-numeric uid form as the man page says "version 1.10 or higher" would support this feature. I guess my man page is out of date or the version being reported is like 0.5.1 or something. –  Tom Dec 5 '13 at 17:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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