Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have Ubuntu 12.04 Desktop Edition. I have successfully installed Likewise Open and authenticated to the Active Directory in Windows Server 2008 R2. I was unable to mount shares for those AD members. I finally found working solution:

sudo mount -t cifs //WINSERVERNAME/WINSHARENAME /media/WINSHARENAME -o username=SUNETID,domain=WIN,iocharset=utf8,file_mode=0777,dir_mode=0777

However, I need it to be run right after log in for "standard" user without sudo password as a startup script.

Now...I have seen many other ways however none that worked for me for some reason...

Anyway- script requires three commands: mkdir to create directory as mount point chmod to make that directory accessible mount to actually mount the share

when I do not see major problems in adding mount and mkdir for any user in visudo adding chmod is a bit troubling. I see two or rather two and half options: 1.I find some piece of software that will mount shares automatically using $USER as part of the path lets say 55555 as user ID after the user is logged into Active Directory 2.I find a way to grant those specific commands no password option with timer for lets say 20-30 sec so the user can log in, script executes the commands and no password fades leaving user with need for sudo for those commands. 2.5 I create some kind of credential file that will contain sudo password chmod it for 700 hide it somewhere in root and call password inside the script that will authenticate those 3 commands and then use sudo -k (this resets the password timer right?).

hmm I have to add that I need solution really fast as I did not expect this as a problem and well.. i have a deadline to finish the project for college.

I would really appreciate any help.

If you know any way of getting those shares automount without sudo password that would be great.

PS. there are about 50 users with private shares and about 10 shares that are public so anyone can see.. so each user needs 1 private for his/her ID and all public shares visible.

share|improve this question

Your Answer


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