Installing Samba on a Debian server isn’t all that hard, and you shouldn’t have any trouble accessing your files from a Windows or Linux computer. Just be sure to follow the step by step instructions I have provided in this post. If you you need help building a Debian Server check out my other post Debian Linux Installation.
A couple of things need to be clarified. First, I am assuming your Debian server has a command line interface (CLI) and not a graphical user interface (GUI). A GUI means you have a desktop user environment. If you have a GUI then you will need to open the Terminal program, and switch to the root user, and then do all of the work in the Terminal. To switch to the root user in the Terminal, you just need to type su (su means switch user) followed by your root password. You have officially been warned. If you are using the CLI then you will only need to login as the root user.
The other thing I need to mention is, you will need to use a text editor to change the Samba configuration file (smb.conf) and you need to know a few basic Linux commands. I use Nano as my text editor and I don’t use a ton of commands. The commands for Nano are listed at the bottom of the Nano text editor. A couple of examples are, the control key is used along with a few letters like w and x. It’s pretty easy so stick with me.
As far as the Linux commands, here’s what you need to know:
cd – Change Directory
cp – Copy Command
mkdir – Make Directory
chown – Change Owner
chgrp – Change Group
Optional useful Linux commands:
ls – List Directory
cls – Clear Screen
Ok enough of the gibberish let’s get going. Make sure you are logged in to your Debian server as root and you have access to the internet. You also might need the cd that you installed Debian with.
Step 1. Update Debian. Run the following command:
apt-get update
Anytime you install packages in Debian you should run apt-get update, this prepares the Debian operating system to get new packages by updating it.
Step 2. Install Samba. Run the following command:
apt-get install libcupsys2 samba samba-common
Step 3. When prompted for the workgroup type Workgroup or your workgroup in the box. On the next question, when prompted, answer NO.
Before moving on, I want to give you little infomation about workgroups. Windows workgroups are loaded when you bought your computer. If you are running Windows XP Home it’s typically MSHOME if you are running Windows XP Professional it’s typically WORKGROUP. To locate your workgroup, look in the system information section of your Windows computer. Ok moving on….
Step 4. Make a backup copy of the Samba configuration file. Run the following command:
cp /etc/samba/smb.conf /etc/samba/smb.conf-backup
The Samba configuration file is located in /etc/samba directory and the name of the file is smb.conf
Now that you made a backup copy of your Samba configuration file it is safe to edit it. Your backup file is called smb.conf-backup. If you mess up the original configuration file called smb.conf, all you need to do is copy the smb.conf-backup back by doing the following command.
cp /etc/samba/smb.conf-backup /etc/samba/smb.conf
Step 5. Edit the Samba configuration file smb.conf by using Nano text editor, Run the following command:
nano /etc/samba/smb.conf
Step 6. You will now be in the Samba configuration file and will need to uncomment and edit a few things. This might be a little tricky so stick with me. When you need to uncomment a line all you need to do is remove the # from the beginning of the line, and to edit you just need to change the line to match what I show you. An easy way to find the area you need to uncomment or edit is by using the Where Is (Search) command in Nano. While you have the Nano text editor open you will simply use the ctrl,w command. ctrl is your control key on your keyboard and w is your w key on your keyboard. All you need to do is hold down your control key (ctrl) and then hit the (w) key and Nano will open up the Where Is search command. Now type in what you want to search for and Nano will find it for you. This will save you a ton of time scrolling through the configuration file, and a good thing to remember for future use.
Here’s the lines you need to uncomment by removing the # and what they should look like when you are done:
#security=user
security=user
# SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY
SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY
Notice there is no # in front of the two lines I asked you to uncomment.
Next you need to edit a few things in the Samba configuration file. In the [Homes] section of the same smb.conf file, change the writable line in the from no to yes and change the create mask and directory mask from 0700 to 0775.
writable=yes
create mask = 0775
directory mask = 0775
Step 7. You’re done making changes to the smb.conf file, so it’s time to save and exit Nano. While you are in Nano use the following key strokes on your keyboard:
ctrl, x
y
ctrl, x exits the program Nano and it will prompt you to save modified to buffer. y is for yes, you want to save this file. Your smb.conf file has been configured and you should be back to your the command prompt now and out of Nano.
I need to explain some things about Debian (Linux) user accounts and Samba user accounts. In Linux you need to have both a Linux user name and password and a Samba user name and password. They are not one and the same but you should keep them the same by creating the exact account name for both. This might be a little confusing let me explain. When you built your Debian Server you had to create a user name and password as well as a root password. This new Debian (Linux) user already has a Debian user account and a home directory in /home, but it doesn’t have a Samba user account. If you are using the same user name that you created when you built the Debian server then you will not need to create another Debian (Linux) user account and home directory in the /home. I hope I didn’t lose any of you but it needs to be understood.
Step 8. Add a Samba User. To add a Samba user use the following command:
smbpasswd username -a
your password
your password
Make sure you substitute the new user you want to create for the “username” and substitute the password you want for your new user for “your password”. I have to say these things or some of you obedient types will do exactly what I tell you.
Step 9. Add new Debian (Linux) user.
(Remember this is Not needed if you are using the same Debian user when you built your Debian server)
If you want to create a new Debian and Samba user you will need to make another directory for that user. To make a home directory for your new Debian user use the following steps.
Change directories to the /home directory:
cd /home
Make directory for your new user:
mkdir username
Again, substitute your new user name for “username”.
To add Debian user use the following command:
adduser username
password
password
You will also need to change the owner and group for the newly created user home directory. To do this use the chown and chgrp commands as follows:
chown username username
chgrp username username
Remember: The Debian server will have a user name and password, Samba will have a user name and password and if you use a Windows computer, it should have a user name and password. I would recommend (actually I’m demanding) that all three of the user names and passwords are exactly the same. This means your Debian (Linux), Samba and Windows user name and password are exactly the same.
Step 10. Test your Samba share:
In a Windows computer go to start and then run and type in the following UNC path.
//Server/Samba Share
Example: My Debian server name is Debian and my Samba user name is John so it should look like this:
//Debian/John
If you configured everything right, you will be connected to /home/john on your Debian server.
jw
Need Professional Computer Help?
Doublee Computers Remote Computer Repair – Click Here To Schedule An Appointment.
www.doubleecomputers.com