Nerd Notes

/dev/brain: no space left on device

Archive for the ‘smbfs’ Category

Windows shares in /etc/fstab

leave a comment »

Ok, this is pretty much an easy one, but I keep forgetting what the heck you need to specify in your /etc/fstab in order to mount an smb share (at least on a Linux system). Here is an handy example:

//host.lan/sharename /mnt/host/sharename smbfs defaults,rw,noauto,username=scott,password=tiger,uid=myuid,gid=mygid 0 0

All of the above needs to be on one line. Of course you need to replace a few things:

host.lan
hostname or ip address of the host you’re connecting to
sharename
the windows share name (pretty easy, uh?)
/mnt/host/sharename
a local directory where the share is to be mounted (this must exist before mounting so “mkdir -p” it)
username
the windows share username
password
the windows share password
uid
the user id the filesystem needs to be mounted as; this can be either numeric or symbolic and is usually your day-to-day user account
gid
the group id the filesystem needs to be mounted as; this can be either numeric or symbolic and is usually your day-to-day user account’s primary group

Once you’ve added that line into /etc/fstab, you can simply:

# mount /mnt/host/sharename

Advertisements

Written by Mirko Caserta

March 2, 2007 at 5:19 pm