Jump to content

Samba File Server on Ubuntu Server 12.04\16.04


brent
 Share

Recommended Posts

First we have to install the samba server:

(**Ubuntu 12.04**)

sudo apt-get install samba smbfs

(**Ubuntu 14.06**)

sudo apt-get install samba cifs-utils

 

To mount a smb share to a ubuntu server run click here

 

Here is the steps to mount a drive to your ubuntu desktop click here  or if you want to mount the drives using CIFS click here  

 

 

Now you need to configure samba. Lets open up smb.conf.

sudo nano /etc/samba/smb.conf

 

 

Here is a copy of my Samba conf file.  *****NOTE*****  I don't have home directory sharing enabled by default. I manually add them.

#======================= Share Definitions =======================

    # Un-comment the following (and tweak the other settings below to suit)
    # to enable the default home directory shares. This will share each
    # user's home directory as \\server\username
    #[homes]
    #comment = Home Directories
    #browseable = yes

    # By default, \\server\username shares can be connected to by anyone
    # with access to the samba server. Un-comment the following parameter
    # to make sure that only "username" can connect to \\server\username
    valid users = %S

    # By default, the home directories are exported read-only. Change next
    # parameter to 'yes' if you want to be able to write to them.
    writable = yes


[global]
        server string = %h server (Samba, Ubuntu)
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        valid users = brent, brian, linda
        admin users = brent, linda
        write list = brent, brian, linda

[printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers

[www]
        path = /var/www
               valid users = brent
                     write list = brent

[Brent]
        path = /home/brent
               valid users = brent
                     write list = brent

[Linda]
        path = /home/linda
               valid users = brent, linda
                     write list = brent, linda

[movies]
        path = /home/shares/movies
               valid users = brent, linda
                     write list = brent, linda

[Data]
	path = /home/shares/data
	       valid users = brent
	             write list = brent

[subtitles]
	path = /home/shares/subtitles
	       valid users = brent
	             write list = brent

[music]
        path = /home/shares/music
               valid users = brent, linda
                     write list = brent, linda

[pictures]
	path = /home/shares/pictures
	       valid users = brent
	             write list = brent

[scans]
	path = /home/scans
	       valid users = brent, linda
	             write list = brent, linda

[Work]
	path = /home/shares/work
	       valid users = brent
	             write list = brent

 

Now you should be able to map a drive on windows using the following share format:

 

\\ubuntumachine\username

For example, if the Ubuntu machine is named ubuntuserv, and the username is unixmen, your share path would be \\ubuntuserv\unixmen

 

Here is a copy of what my samba.conf file looks like

 

 

To create the users you will need to run this command

 

 

sudo smbpasswd -a your-user-name

 

If your unix account has been disabled you will want to run the -e command

 

sudo smbpasswd -e your-user-name

 

Then restart the samba server with:
 

sudo restart smbd
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...