I am using samba server in home network as mentioned below. If it stopped working you can try reinstalling it but most probably problem is in router settings. If you don't know what you changed in it then you have to reset it.
Install and Remove from the Terminal : (Using Samba Version 4.3.11)
sudo apt-get remove --purge samba
But, if you are having client problems, it would be more like:
sudo apt-get remove --purge smbclient libsmbclient
sudo apt-get purge samba samba-common
sudo rm -rf /etc/samba/ /etc/default/samba
To install it again
sudo apt-get install samba
sudo apt-get install smbclient libsmbclient
How to Reinstall smb.conf in other way
dpkg-reconfigure samba-common
or
sudo cp -a /usr/share/samba/smb.conf /etc/samba/
Restart Ubuntu after fresh installation and add user
root@Dell-Inspiron-3521:~# sudo smbpasswd -a username (username should be without space eg "sudo smbpasswd -a alamjitsingh")
New SMB password:
Retype new SMB password:*********
Added user alamjitsingh.*********
smb.conf required settings
sudo gedit /usr/share/samba/smb.conf
[global]
workgroup = WORKGROUP
passdb backend = tdbsam
security = user
In authentication section turn "map to guest = bad user" off by adding # at starting of code
#map to guest = bad user
Below line is Optional if not working
force user = alamjitsingh
At last add your personal code
[Shared_drive_Name]
path = /media/alamjitsingh/Shared_drive_Name (alamjitsingh is my ubuntu username)
comment = HD Share
read only = yes
available = yes
browseable = yes
writable = no
guest ok = no
public = yes
printable = no
locking = no
strict locking = no
Useful Terminal commands
sudo service samba reload
sudo service samba restar
sudo service samba stop
sudo service samba start
sudo service samba status
sudo service samba force-reload
Or
sudo /etc/init.d/smbd start
sudo /etc/init.d/smbd stop
sudo /etc/init.d/smbd restart
sudo testparm
sudo service nmbd start
sudo service smbd start
Or (via systemctl)
sudo systemctl restart smbd
sudo systemctl start smbd
sudo systemctl restart nmbd
sudo systemctl start nmbd
Check status of required services
sudo service nmbd status
sudo service smbd status
sudo service smbd restart
To know version of samba
samba -V