SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Tuesday, January 8, 2008

Access Windows share from linux

In order to access a Windows share, you need to mount it using smbmount or plain mount. The following example makes the files from //winbox/share available in your mnt directory:

mount -t smbfs //winbox/share /mnt -o rw,username=joe,password=bloggs

Make sure you have a directory called /mnt before you try the mount.

Also, note the uid, gid, fmask, and dmask options when mounting as a user other than the one who needs to access the files...

To be able to access the samba share read-write as non-root users, you must add uid and gid entries to the smbmount command in the /etc/fstab entry:

//winbox/share /mnt/share smbfs username=joe,password=bloggs,uid=500,gid=500 0 0

where the uid and gid are of the user or group you want to have rw access.

For a normal user, if your smbmount and smbumount are setuid, you can instead do:

smbmount //winbox/share /mnt/share -o username=joe,password=bloggs

(this way, usually the default permissions are suitable for the user running smbmount)

and to unmount it:

smbumount /mnt/share