In this lab, you will install and do basic configuration of Samba and FTP services.
Install the samba, smbclient, and vsftpd packages:
sudo apt update
sudo apt install samba smbclient vsftpd
Check the status of the services:
sudo service smbd status
sudo service nmbd status
sudo service vsftpd status
Configure Samba to share user home directories in read-write mode by editing /etc/samba/smb.conf. Test your file:
testparm
Correct any errors. Restart samba:
sudo service smbd restart
Verify you can see your shares:
smbclient -L localhost
Make your Linux account available for Samba use:
pdbedit -a -u yourfirstname
Verify your account is available for use with samba:
pdbedit -L -v
Test that you can access your home directory share.
echo "ls" | smbclient -U yourfirstname //localhost/yourfirstname yourpassword
Create a Linux user named student with a shell of /bin/nologin and a home directory to be used to hold files for a windows-only user:
sudo useradd -m -s /bin/nologin student
Do not set a password on the account, leave it locked. Use pdbedit
to add that user to samba:
pdbedit -a -u student
Set the student user samba password to Password01 so that the server check script can test it. Check that the student user has valid SMB access to their home directory hosted on your Linux server:
echo "ls" | smbclient -U student //localhost/student Password01
ftp localhost
<login to the ftp server using your personal account>
ls
logout
sudo echo "Your text" > ~ftp/index.html
chown ftp ~ftp/index.html
wget
or curl
or with a web browser using the url ftp://your-ip-address/index.html.
curl ftp://your-server-ip/index.html
Add UFW rules to allow smb, nmb, and ftp service through your firewall:
sudo ufw allow 21/tcp
sudo ufw allow 137,138/udp
sudo ufw allow 139,445/tcp
Run the server-check.sh script for all 9 labs to ensure your marks are recorded for the semester assignment final mark;
sudo /root/server-check.sh firstname lastname studentnumber