logo

Samba mounting

Date: 2007-09-23

Mounting samba share as non root user and mounting samba share and startup.
Source: ubuntu.com Mounting a share on the local filesystem allows you to work around programs that do not yet use GnomeVFS to browse remote shares transparently. To mount a Samba share, first install smbfs:

Code:


sudo apt-get update
sudo apt-get install smbfs


To allow non root accounts to mount shares, change the permissions on the smbmnt program thus:

Code:


sudo chmod u+s /usr/bin/smbmnt /usr/bin/smbumount


The following will mount the myshare folder on myserver to ~/mnt (it will be in your home directory):

Code:


mkdir ~/mnt
smbmount //myserver/myshare ~/mnt

To umount,

Code:


smbumount ~/mnt

In order to have a share mounted automatically every time you reboot, you need to do the following:

Open a shell as root

Code:


sudo -s

Create a file containing your Windows/Samba user account details:

Code:


vi /etc/samba/user

...it should contain two lines as follows:

Code:


username = george
password = secret


Change the permissions on the file for security:

Code:


chmod 0600 /etc/samba/user

Now create a directory where you want to mount your share (e.g. /mnt/data):

Code:


mkdir /mnt/data

Now edit the file system table (/etc/fstab) and add a line as follows:

Code:


//server/share /mnt/data smbfs credentials=/etc/samba/user,rw,uid=bob 0 0

...where 'bob' is the non-root user you log into ubuntu with, 'server' is the name or address of the Windows machine and 'share' is the name of the share.

To mount the share now, just use the following command as root. It will mount automatically on subsequent reboots.

Code:


mount /mnt/data


Source: ubuntu.com



ubuntudog.com © 2017 | About | Sitemap | Contact