How can i mount a windows share on my linux box?
this is quite simple
mount -t cifs -o username=yourusername,password=yourpassword
This command lets you mount the network share on the fly,
to unmount use:
To make the mountpoint permanent you have to add the following entry to your /etc/fstab
//path/onwindows/server/ /your/linux/mountpoint/ smbfs defaults,rw,noauto,username=yourusername,password=yourpass 0 0
The /etc/fstab is openly readable, so it is a bad idea to have your Windows password in it.
you can get around this by using a credentials file. This file contains the username and password. The good place to put this file would be in your home directory. Here is an example.
Create a file in your home directory named .smbpass Modifiy the permissions on the file so only you have permission to read and write to it. The commands to create the credentials file:
echo username=youruserame > .smbpass
echo password=yourpass >> .smbpass
chmod 600 .smbpass
Only root would be able to read the contents of this file.
Once that is created, you would edit the line in the /etc/fstab file to look like this:
//path/onwindows/server/ /your/linux/mountpoint/ smbfs credentials=/home/homedirectory/.smbpass 0 0
Allowing Read/Write Access to the Share
A problem with mounting the share as shown above is that only the root user would have read/write access to the share. All other users would have read only access. If you wanted read/write access to it, you need to specify your userid or groupid. Change the line in /etc/fstab to mimic this:
//path/onwindows/server/ /your/linux/mountpoint/ smbfs credentials=/home/myhomedirectory/. smbpass,uid=mylinuxuser,gid=mylinuxgroup 0 0
Whatever user and or group you specified in the line would have read/write access to the mounted share. You can use either the user or group name or the user or group numerical ID.
To Specify several users the etc/fstab should look like this, Note you must add the users you want to access the share as members of a group:
//path/onwindows/server/ /your/linux/mountpoint/ smbfs credentials=/home/myhomedirectory/. smbpass,gid=sambausersgroup 0 0