Samba Installation

Check if Samba is installed

apt-cache policy samba

You should see something like this if it is installed:

 Samba:
 Installed: 2:3.4.7~dfsg-1ubuntu3.7
 Candidate: 2:3.4.7~dfsg-1ubuntu3.10

otherwise “Installed” on the top has a blank value. To install type in:

sudo apt-get install samba

After successfully installing Samba you can now connect to a shared folder on the network.

Connecting

Suppose you want to connect to “192.168.0.114” shared folder named “Public” . You just need to type:

smbclient //192.168.0.114/Public -user [Your_User_Name]

“-user [Your_User_Name]” argument is optional. If no “-user” indicated you will be defaulted to the default user. After pressing enter with the above command, the terminal is going to ask for your password. After that the terminal should look like this:

smb: \>

You are now successfully log-in in the server computer and ready to write to or copy from it.

Writing Files

To write a file in the server using Samba client use the command:

puts [local name]
  • [local name] is the filename of the file you want to transfer on the current directory before you connect in samba client. This can also be a filepath relative to the current directory or an absolute path.
  • is optional. If no is specified the filename of [local name] will be used.

Suppose we have a file named “test.txt”. We can transfer it by:

smb: \>puts test.txt

If we want it to be named “test2.txt” on the server. Type in:

smb: \>puts test.txt test2.txt

Make sure you have write access to the folder or else youll get an error like this “NT_STATUS_ACCESS_DENIED opening remote file ”

Copying Files

You can copy files from the server with Samba client using the command:

get  [local name]

and [local name] are the same as the the “put” command above.

To exit the Samba client just type “exit”.