Beruflich Dokumente
Kultur Dokumente
Install prerequisites
This guide will use tasksel to install SSH server. If tasksel is not available on your system you can
install it by using the following linux command:
Active: active (running) since Mon 2018-01-15 11:59:54 AEDT; 20min ago
CGroup: /system.slice/ssh.service
└─714 /usr/sbin/sshd -D
Jan 15 12:00:18 ubuntu sshd[797]: Accepted publickey for linuxconfig from 10.1.1.230 port
36076 ssh2: RSA SHA256:NRnW+1Zxjt+TOoWsV//nzqkJo/cbg48/XOr3XDNMqYQ
Jan 15 12:00:18 ubuntu sshd[797]: pam_unix(sshd:session): session opened for user linuxconfig
by (uid=0)
Scenario
The below configuration procedure will assume a following scenario and pre-configured
requirements:
Server and MS Windows client are located on the same network and no firewall is blocking any
communication between the two
Instructions
Let's begin by installation of Samba server. This is rather a trivial task. First, install tasksel
command if it s not available yet on your system. Once ready use tasksel to install Samba server.
Configuration
We will be starting with a fresh clean configuration file, while we also keep the default config file
as a backup for reference purposes. Execute the following linux commands to make a copy of an
existing configuration file and create a new one:
Homes share
In this section we will be adding user home share directories into our new /etc/samba/smb.conf
samba configuration file.
Samba has its own user management system. However, any user existing on the samba user list
must also exist within /etc/passwd file. If your system user does not exist yet, hence cannot be
located within /etc/passwd file, first create a new user using the useradd command before
creating any new Samba user. Once your new system user eg. linuxconfig exits, use the
smbpasswd command to create a new Samba user:
Next, use your favorite text editor to edit our new /etc/samba/smb.conf samba configuration
file:
[homes]
browseable = yes
read only = no
valid users = %S
In this section we will add a new publicly available read-write Samba share accessible by
anonymous/guest users. First, create a directory you wish to share and change its access
permission. Example:
Next, add the following lines into Samba configuration file using your favorite text editor sudo
nano /etc/samba/smb.conf:
[public]
path = /var/samba/
browsable =yes
writable = yes
guest ok = yes
Your current Samba configuration file should look similar to the one below:
[global]
workgroup = WORKGROUP
dns proxy = no
syslog = 0
[printers]
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = no
[homes]
browseable = yes
read only = no
valid users = %S
[public]
browsable =yes
writable = yes
guest ok = yes
Our basic Samba server configuration is done. Remember to always restart your samba server,
after any change has been done to /etc/samba/smb.conf configuration file:
Once you restart your Samba server, confirm that all shares have been configured correctly:
$ smbclient -L localhost
Server Comment
--------- -------
Workgroup Master
--------- -------
WORKGROUP UBUNTU
Optionally create some test files. Once we successfully mount our Samba shares, the below files
should be available to our disposal:
$ touch /var/samba/public-share
$ touch /home/linuxconfig/home-share
Active: active (running) since Wed 2018-01-31 19:50:19 AEDT; 1min 12s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
CGroup: /system.slice/smbd.service
At this stage we are ready to turn our attention to MS Windows. Mounting network drive
directories might be slightly different for each MS Windows version. This guide uses MS
Windows 7 in a role of a Samba client.
To start, open up you Windows Explorer then right-click on Network and click on Map network
drive... tab. Select drive letter and type Samba share location. Make sure you tick Connect using
different credentials if your username and password is different from the one created previously:
imag description
imag description
You should now have a read-write access to your user's home directory:
imag description
Similarly, mount your anonymous/guest Samba share. However this time no username and
password will be required:
imag description
imag description