setup a network drive with samba

Wednesday 25th April 2007 11:10 PM

TAGS: samba, smb, centOS
Just continuing with a few mini how-to's which will hopefully help someone out along the way....
One thing I find absolutely essential is keeping my data organised on a completely seperate testing server. I can then access my data from any machine hooked up to the network (ie laptop, streaming media, etc). Another advantage is that files can be directly accessed without having to sftp/ssh to the server, e.g.



Samba provides us with the ability to setup a folder on a linux machine which can be viewable as a regular network drive in windows. It is included with centOS 5, and just needs to be configured to work (don't forget to unblock it's port in your firewall if not already!).

Samba has a permissions system that allows you to assign different users different levels of access. To start with, we can follow the samba documentation and add a new linux user:

# useradd -d /home/john -s /bin/false -n john
# passwd john

Then, we add this user to the samba database (-a), and set a password, it doesn't have to be the same as entered before.

# smbpasswd -a john

Now we've done that, it's time to setup the smb.conf file.

# nano /etc/samba/smb.conf

We will add in a basic folder that is only available to the user "John" (and requires a password).
Under the [global] entries, start a new share. For example, if you were to create a new "share", available only to john, and pointing to /mnt/webdev/, which was also private, and writable, you would put something like:

[webdev]
public = no
writable = yes
printable = no
valid users = john
path = /mnt/webdev/

Restart samba...

 # /etc/init.d/smb restart

and you should be able to browse to your servers IP address (ie enter \\192.168.1.xx\ into windows explorer), and see the folder available and shared!

As a side note, for vista users - you just might need to adjust a setting to get samba shares working properly, see here for those instructions (it's very simple).

Comments on this article:


I love feedback and comments, be the first!

Add Comment:


Make a Comment

*Nb, all comments are moderated to prevent spam or inappropriate content.








netforge logo
netforge provides high quality and friendly website design services to business. We're Australian based and reliable... (find out more).