Share with a Windows machine using Samba and CIFS

Q I have a Linux machine at 192.168.1.1 connected to my wireless router, which contains a backup of my Windows laptop that I FTP up every now and then. Is there a better way to do this and perhaps store all my documents on my Linux machine and connect to them over the network?

A An easy solution is to use Samba and set up a CIFS (Common Internet File System) server on your Linux machine. First install a recent copy of Samba (www.samba.org) and find the Samba configuration file: usually /etc/samba/smb.conf. The configuration file is split in two: global settings and share definitions. The global settings control how the CIFS server works and can be used to control anything - from what interface the server listens on, to Windows Active Directory domain controller settings. Here, the out-of-the-box global settings will be sufficient. Now set up a share for your files. Let's say that the files exist on the filesystem as /export/share. You will need a CIFS share name and description, which we will call myshare' and 'all my files' respectively Now, as we have multiple wireless users on the network, we want to lock down this share so that only Fred and Mary can access the share, giving them read and write access. Add the following to the smb.conf:

[myshare]
comment = all my files
path = /export/share
valid users = mary fred
public = no
writable = yes
printable = no
create mask = 0765

The main step is complete but we still need to add authentication credentials for Fred and Mary. To do this, use smbpasswd as root:

# smbpasswd -a fred New SMB password:
# smbpasswd -a mary New SMB password:

Finally, make sure Samba is running - if it isn't, start it. On your Windows laptop, you will now be able to map your CIFS share at \\192.168.1.1\myshare using the credentials for either Fred or Mary.

Back to the list