About This Post
Samba is the go-to tool for running Ubuntu as a file server.
If you reinstall it after some kind of glitch, there are cases where the samba directory and smb.conf under /etc don't get created.
This post covers a reliable way to fully remove it — dependencies included — for cases like that.
Completely Removing Samba
First, stop the Samba that's currently running.
service smbd stop
service nmbd stopUse the purge command to fully remove Samba. If you don't use purge, some config files and directories will stick around, and smb.conf may not get created the next time you install it.
sudo apt remove --purge samba samba-common
sudo apt autoremoveRemove any config files or directories still left at this point.
⚠️ If you want to back up your config files, do that first.
sudo rm -rf /etc/samba /var/lib/sambaReinstalling
Install it again.
sudo apt update
sudo apt install sambaLet's check that it went through properly.
ls /etc/sambaConfirming It Works
Configure smb.conf using Vi.
sudo vi /etc/samba/smb.confAdd the following to the end of smb.conf. With this setup, every user will be able to access it.
[TEST]
path = 共有したいディレクトリのパス
public = yes
security = share
writable = yes
printable = no
guest ok = yesAnd that's the whole process.