in reply to Mounting windows shares from Linux

A very good effort, but do you need Perl to do this? =)

You might consider using smbmount with credentials in fstab instead of username and password, which solves the local echoing of the password. Essentially, what you do is create a file with two lines:

username=Username password=Password

somewhere in /etc. You then make sure owner and group are root, set permissions to 400, and add the credentials=/etc/yourfile to your options column.

//windowsbox/windowshare /mnt/win smbfs noauto,credentials=/etc/yourfi +le 0 0
You should also consider setting UID/GID in the options as well, to make sure that the unprivileged user mounting the share can also write to it.

Cheers,

--
Allolex

(update) PS: You need to chomp() your variables to get this script to work.

Replies are listed 'Best First'.
Re: Re: Mounting windows shares from Linux
by digitalx (Novice) on May 05, 2003 at 08:21 UTC
    Thanks for your help, it works perfetly now. Oh and I see that you were wondering why I was doing this. Well the reason I did not put it in my fstab is that this script is for my laptop so when I bring it to a friends or to school I need to mount on the fly. Again, many thanks!

      Glad to be able to help. BTW, you can still put mount points in fstab using the noauto option (like I did) and still mount your shares on the fly with mount /mnt/win or whatever. I guess that was the point I was trying to make with my main, alternative, suggestion.

      --
      Allolex

      The noauto option keeps the system from mounting the drive at system startup. The user option allows normal users to mount/dismount the drive. Put both in your fstab for this share and it should solve your problems.

      90% of every Perl application is already written.
      dragonchild

        Doh! Forgot to mention user. =[

        --
        Allolex