I’m putting this here almost for my own reference, but hopefully to help others.
I’ve installed ubuntu on an old net book that was too slow. All I want to do is set it up as a file server on my wireless network. This is proving most challenging, but I’m learning a lot. The biggest problem I’m having is not understanding tutorials due to them often missing steps that they take for granted.
I don’t know ANYTHING. I’m battling through this with no knowledge or experience.
By adding to another tutorial I found, hopefully this will be literally a dummy’s guide for installing Samba on ubuntu. The original tutorial is here: http://www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/
- If you want to share files between your Ubuntu and Windows computers, your best option is to use Samba file sharing.
- To install, first open a terminal window and enter the following command:
[To open a terminal window, press Crtl – Alt – ‘T’ or search for the application “Terminal”. Once you’re running it, there will be a window pop up that’s black with a blinking white cursor. This is where you write the stuff they suggest]
sudo apt-get install samba smbfs
[Now apparently this sudo thing is like some sort of “I’m doing something serious now” command and the apt-get install thing is the action – samba smbfs would be the application itself (I’m guessing). Sometimes it will ask you for a password so it can get on with it’s “something serious”. If that happens you just type in your system password and it happily keeps processing]
- We’ve got samba installed, but now we’ll need to configure it to make it accessible. Run the following command to open the configuration file, substituting your editor of choice:
[For some reason the damn thing isn’t finished or something and needs to be configured manually. By you. When you put in the following command (straight after the last one in the black window with the white cursor) it will open a new window. This new window will just be code for configuration. Lucky, they’ve put in lots of explanations on how the configuration thing works. Unfortunately they’ve written it in Nerd. This whole “substituting your editor of choice” is unknown to me, but when I typed in the following command everything seemed to work.]
sudo gedit /etc/samba/smb.conf
- Find this section in the file:
[Okay, there’s going to be a hell of a lot of code. The key is looking for the “#### Authentication #####” bit. There will be hundreds of sections in the config file (the pop up with code) and each one is like a box with hash tags around it. Find the box with the Authentication heading and the text below. It will be somewhere near the top, so it shouldn’t take too long.]
####### Authentication #######
# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# in the samba-doc package for details.
; security = user
- Uncomment the security line, and add another line to make it look like this:
[Alright, now, because the boxes I was talking about above are not part of the code, they need to have a way to distinguish them from code lines. This is the hash tag. Where ever the hash tag starts a line, it means it’s a comment and therefore can be ignored. In fact, the act of putting a hash tag in front of a comment is called “commenting”. So, where you are asked to “uncomment” it means to remove the hash tag, or in this case a semi-colon. Once the semi-colon is removed and the extra line is added beneath, it will look like this:]
security = user
username map = /etc/samba/smbusers
[When you’ve added these lines, you then have to save the file. I found an icon in the top bar of the pop up window that said Save, so I went with that. After it’s saved, I closed the box (X in the corner) and then it went straight back to the prompt and the white cursor.]
- This will set Samba to use the smbusers file for looking up the user list.
[Samba works out who can use it based on a table that is a user list. In this command, I think what you’re trying to do is tell Samba to use the table you have provided for the users.
Create a Samba User
- There are two steps to creating a user. First we’ll run the smbpasswd utility to create a samba password for the user.
sudo smbpasswd -a <username>
[This is where I came off the rails. So, you’re using the sudo thing again, that’s fine. I think it’s trying to run the “smbpasswd” utility and adding someone called <username>. I found out the hard way that the name in the “<>” should be replaced by your actual username. So here’s what I did.
I went into the search part and typed in “user”. It showed me an app called “User Accounts” and I clicked on it. When the new screen opened, it had my user on it (me). So I used the same user name.
For example, if my username was Jerry, I would type “sudo smbpasswd -a Jerry” and then hit enter.
When I did this, it came up and asked me firstly for my sudo password, which I put in (as discussed above).
Then it asked me for my “New SMB password:” – I used the same password as the system password. I hope this doesn’t cause problems. It seemed to accept it. It then asked me to “Retype new SMB password:” so I typed the same password again. It then gave me a message saying it had “Added user Jerry.” (If I had used Jerry as my username)]
- Next, we’ll add that username to the smbusers file.
sudo gedit /etc/samba/smbusers
[Remembering from before that the smbusers file is that table that has the users in it, I kind of got where this was going. The sudo I’m now familiar with, but I don’t know what gedit is – I think it’s allows you to edit a file because a new window opens that looks like a text box.]
- Add in the following line, substituting the username with the one you want to give access to. The format is <ubuntuusername> = “<samba username>”. You can use a different samba user name to map to an ubuntu account, but that’s not really necessary right now.
<username> = “<username>”
[This blows my mind. Since the file is empty, you’re creating the first line. There’s no need to do anything apart from type the one line, save it and close the pop up window. Then you can head back to the prompt and the white cursor for the next command.
What to write is the hard thing. If you did what I did and used the system username for the samba username, this gets kind of easy. Using my previous example, you would type: Jerry = Jerry
If you used different usernames, then the system username (ubuntuusername) goes first and the proposed Samba username comes on the other side of the equals sign: Jerry = SambaJerry]
- Now you can create samba shares and give access to the users that you listed here.
[And that’s the end of the tutorial! Apparently that’s all you need to do.
Next, though is a link to the next step of the process – sharing files. This original tutorial is here: http://www.howtogeek.com/howto/ubuntu/share-ubuntu-home-directories-using-samba/
Hopefully you’ve left your Terminal window up – you’ll still be using that.]
- To share the home directories, open up smb.conf with the following command:
[The below command will open up the configuration file (pop up window). It’s the same one you opened before with all the code in it.]
sudo gedit /etc/samba/smb.conf
- Find this section of the file, and make it match the following:
[This time, instead of looking for “Authentication”, you’re looking for “Share Definitions”. It’s the very last one, so it’s right at the bottom.]
#======================= 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
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
[The “uncommenting” is done by removing the semi-colon against “[Homes]”, “comment = Home Directories” and “browseable = yes”. You’ll also need to change the no to yes on the browseable one.
On mine, instead of “writable = yes”, I had “read only = yes” so I changed it to “no” and I assume it means the same thing. Maybe it’s a version thing. The read only section still had the same comment in front of it, though. I just removed the semi-colon and changed it to “no”.
A bit further down I found the valid users thing and took out the semi-colon in front of it as well. That was the last change, so I saved the file and closed the pop up window.]
[Once the above is complete, you can shut down the Terminal window. I also restarted my machine just in case. (Don’t know if that helps or not).]
- Now you should be able to map a drive on windows using the following share format:
And that’s how the tutorial goes. However, it didn’t work for me. I still can’t get Samba to run.
I’m actually going to try other things now – I’ll see how it goes.