Monday, January 24, 2011

adding an smb share in linux

Another post of something I do regularly but can't quite remember...

Running df gives the mount point:
> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 72G 4.7G 64G 7% /
tmpfs 253M 0 253M 0% /lib/init/rw
udev 10M 768K 9.3M 8% /dev
tmpfs 253M 0 253M 0% /dev/shm
/dev/sda1 917G 13G 859G 2% /mnt/raidk
/dev/sdb1 230G 11G 207G 5% /mnt/alfred

In this case it's /mnt/alfred I'd like to share.

Now to add the entry to /etc/samba/smb.conf:
> sudo gedit /etc/samba/smb.conf

I tend to copy an existing section of the config file and change the relevant parts. In this case, the new entry looks like:
[alfred]
path = /mnt/alfred
available = yes
browsable = yes
writable = yes
valid users = joeblo
admin users = joeblo

Once the changes are made, samba needs to be restarted:
> sudo /etc/init.d/samba restart
Stopping Samba daemons: nmbd smbd.
Starting Samba daemons: nmbd smbd.

Now that samba is restarted the new share is available on the network.

No comments:

Post a Comment