The Home of C&P Software on the Web |
|
| Home Blogs About us Why Choose Us? What Are People saying? OneClickAway PC Support Professional Profile Free Software here!!! Contact Us Privacy Notice Useful Links NLP
|
Mount windows sharesMounting an SMB ShareTo mount an smbfs share from a Linux workstation at the command line, you can use either the An example would look like this: smbmount //servername/sharename /mountdirectory -o username=mywindowsusername,password=mywindowspassword The mount -t smbfs //servername/sharename /mountpoint -o username=mywindowsusername,password=mywindowspassword
Whether you need to supply a username and password depends on what type of security you have on the Windows share. If you have a share created with no password on it, you shouldn't need to provide a username and password. If the share happens to be on a Windows NT server that is part of a domain, you would need to provide a domain login name and password. Making the Mount Permanentsmbmount does not make the mount permanent. If the Linux workstation is rebooted, you will have to mount the share again. To make the mount occur each time you start the Linux workstation, you can put an entry in your /etc/fstab file. An example file would look like this: //servername/sharename /mountdirectory smbfs username=windowsuserename,password=windowspassword 0 0 This line in the file is the line that will mount the Windows share. You would add a line similar to that in your /etc/fstab file for each share you want to mount. Once again the username and password are only needed if the Windows share is set up to require them. If a username and password are not required, you may just replace them with the word defaults. An important thing to remember is that there is no space between the comma and the word password. If you put a space there, it won't work. Providing SecurityThe /etc/fstab is readable by everyone so it obviously wouldn't be a good idea to have your Windows password in it. The way to get around this is by using what is known as a credentials file. This is a file that contains just the username and password. The best place to put this file would be in your home directory. Here is how to do it. Create a file in your home directory named .smbpasswd (the period at the start of the filename makes it a hidden file). Modifify the permissions on the file so only you have permission to read and write to it. The only thing in the file is your Windows username and password. Here's the commands you would enter to create the credentials file: cd echo username=mywindowsusername > .smbpasswd echo password=mywindowspassword >> .smbpasswd chmod 600 .smbpasswd Substitute your Windows username and password in the commands. No one else except root would be able to read the contents of this file. Once that is created, you would modify the line in the /etc/fstab file to look like this: //servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/.smbpasswd 0 0 You can also use the credentials option in the smbmount //servername/sharename /mountdirectory -o credentials=/home/myhomedirectory/.smbpasswd Providing Read/Write Access to the Share Another problem with mounting the Windows share as shown in the /etc/fstab file above is that only the root user would have read/write access to the share. All other users would have read only access to it. If you wanted read/write access to it for yourself, you need to specify your userid or groupid. That would change the line in /etc/fstab to look like this: //servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/. smbpasswd,uid=mylinuxusername,gid=mylinuxgroupname 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. Either should work. If you had several users you wanted to have read/write access to it, create a group and add those users to the group. Then specify just that groupid in the /etc/fstab file. You wouldn't need to specify a userid. The line in etc/fstab would look like this: //servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/. smbpasswd,gid=sambausersgroup 0 0 You can see the Troubleshooting If you have trouble mounting your Windows shares from /etc/fstab, here are some things to try. The most important thing is to try to mount the share using the One of the most common problems with ln -s /usr/bin/smbmnt /bin/smbmnt ln -s /usr/bin/smbmount /bin/smbmount Another problem occurs when a non-root user tries to mount a Windows share using chmod u+s /usr/bin/smbmnt This will not work if you setuid the To allow non-root users to unmount the shares, you need to setuid the chmod u+s /usr/bin/smbumount |