I just spent about two hours configuring my Ubuntu server with Samba, and made some pretty elementary mistakes that could have been avoided if I had just read a good set of instructions. Hopefully, the following post will help some of you out if you ever run into issues when installing Samba on your Ubuntu Server. Alright, so, first things first, you need to update your repositories:
sudo apt-get update
After those are updated, issue the simple command:
sudo apt-get install samba
Once it has installed itself and gotten all of it's dependencies installed, you're going to need to create a Samba username and password to use when accessing your shares on a Windows machine. This is done by issuing the following command:
sudo smbpasswd -a username
Replace the "username" in the above command with the username you'd like to use in your Samba share. I used my regular Ubuntu login username as well as my regular Ubuntu login password when it prompted me to type in a password. This may pose a security risk, but who cares. My Ubuntu server isn't ever going to be accessible to the outside world, so security is the least thing I'm worried about.
Once you've gotten your Samba username setup, issue the following command:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_bkup
That's going to create a backup of your Samba configuration file in the "/etc/samba" folder just in case you screw anything up, you have a file to revert back to. Now, go ahead and edit the main smb.conf file (I use nano because it's super easy to operate).
sudo nano /etc/samba/smb.conf
The majority of the Samba configuration file is complex and not needed for a basic home share. If all you need to do is install Samba so that you have a link to your Ubuntu machine within your Windows machine, then there isn't any reason to edit anything in the file, other than what I'm about to tell you.
Navigate to the very bottom of the file (hold CTRL+V to navigate to the very bottom of the file quickly if you're using nano). Add the following lines of information to the end of the file
path = /home/username
available = yes
valid users = username
read only = no
browsable = yes
public = yes
writable = yes
There are two "username" sections above to replace, so be sure you replace those before saving the configuration file. Replace the "username" in the path section to the Ubuntu username you want access to and replace the second "username" in the valid users section to the Samba username you setup at the beginning of the guide. If you kept everything simple and just used your Ubuntu username as the new Samba username from the beginning, all you need to do is put your main username in those two sections and you'll be good to go.
Now, hit CTRL+X and save the configuration file when nano prompts you to do so. After you're out of the file and back at your terminal prompt, go ahead and restart Samba by issuing the following command:
sudo restart smbd
Once Samba has restarted, issue the next command:
If you don't get any errors from the above command, you should have a fully functional and working Samba setup on your Ubuntu server now. Go ahead and go to your Windows machine and map the Samba drive like you would any other drive.
No comments have been posted to this article yet.