Terminus Logo

Question ? How can I mount a SMB share under linux ?  

 Sometimes, on old systems, we need to mount a samba-share.
Create a file: /etc/cifs.pwd with

~#touch /etc/cifs.pwd
~#chmod 600 /etc/cifs.pwd

And add in that file the login/password file. Content Format is very simple - as follow:

username=smbuser
password=smbpassword

Password/username is in cleartext !

After that - you can mount the share as root with:

~#mount -t smbfs -o credentials=/etc/cifs.pwd  //REMHOSTIP/remotedir /localdir

In this example, /remotedir is the remote Directory/Share and /localdir is the local Directory you mount it in on your local file system. This localdir needs to exist on you local machine.

Example:
Assume the Samba Host is: 192.168.101.56
Remote Share is: /smbtmp
Local mount Directory is: /mnt/smbtmp

We would have:

~#mount -t smbfs -o credentials=/etc/cifs.pwd //192.168.101.56/smbtmp /smb/smbtmp

To make it easy - you add the data to the /etc/fstab file.

//192.168.101.56/smbtmp /mnt/smbtmp smbfs credentials=/etc/cifs.pwd

With this, a simple: "~#mount /mnt/smbtmp" is be enough to mount the samba share.  

Entered by smurphy on Tuesday, 16 November 2010 @ 11:08:52  
Linux General - Common Linux problems, # Hits: 88343

This page was issued from the Terminus Website:
https://www.solsys.org

The URL for this page is:
https://www.solsys.org/mod.php?mod=faq&op=view&faq_id=157


  Close