Sunday, February 27, 2011

Simple samba file server setup

As it's nice and simple to do pc to pc file activities through a samba file server, let's set this up.

If at any time after installing Ubuntu you want to change 'server roles', you can just run
which will give you a menu with a lot of options. From these options select 'Samba file server' with arrow keys and space, and enter to confirm.
After this tasksel will setup samba for you and when it's done return you to the command line.

Now edit /etc/samba/smb.conf with
  pico /etc/samba/smb.conf

From this point onward it depends a bit on how you'd like to setup samba, which has a lot of options.
In my case i want to make sure only users who have an account on my system can logon through samba, so i uncomment:
security = user

Further, I only want to share my root partition, so I add
comment = root directory
path = /
guest ok = no
valid users = root
writeable = yes

Note: sharing your root directory will widely be regarded as a stupid move because of security implications, it's just that as I'm the only real user of my system, it would be a bit annoying having to jump through hoops whenever i want to get root access. For normal everyday use you could just uncomment the part on [homes] which goes on for a couple of lines explaining each line) instead of sharing your entire root directory.

All the other stuff should be ok, but this really depends on how safe your server is (who could have network access to it). You might want to comment out the parts on printers, but it should be fine as is.

We'll also need to make a samba user which we can access the samba server with. So as root run the following:
  smbpasswd -a root
and give it a password, use this username and password to access your samba share.
You could of course also create samba accounts for other users

Now always before rerunning samba, run the samba configuration test command

This will probably give you a warning alike:

rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
This can be ignored, as it's just a reminder Ubuntu has fixed an issue (just doesnt report that too clearly). This will probably be fixed in a samba to come.

To effectuate the new configuraton:
  reload smdb
or for older Ubuntu's
    /etc/init.d/samba reload 

Now on another machine, browse to the IP address (or DNS name if you've got that correctly setup) and you should see your root or homes share. In my case this was a windows 7 machine which promptly came with the question with which name & password I'd like to login.

Note: This actual access did go wrong once, as it made my name into clientpc\username instead of serverpc\username, so you might want to write your username as servername\username.

No comments:

Post a Comment