§2023-08-09
- install samba
$ sudo apt update && sudo apt install -y samba
- Check
Check its service is active and running
$ systemctl status smbd --no-pager -l
● smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; preset: enabled)
Active: active (running) since Wed 2023-08-09 10:37:53 CST; 1min 49s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Process: 10598 ExecCondition=/usr/share/samba/is-configured smb (code=exited, status=0/SUCCESS)
Process: 10600 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
Main PID: 10601 (smbd)
Status: "smbd: ready to serve connections..."
Tasks: 3 (limit: 9599)
Memory: 6.7M
CPU: 332ms
CGroup: /system.slice/smbd.service
├─10601 /usr/sbin/smbd --foreground --no-process-group
├─10604 /usr/sbin/smbd --foreground --no-process-group
└─10605 /usr/sbin/smbd --foreground --no-process-group
Aug 09 10:37:53 hc4Lunar systemd[1]: Starting smbd.service - Samba SMB Daemon...
Aug 09 10:37:53 hc4Lunar systemd[1]: Started smbd.service - Samba SMB Daemon.
- check if you are in sambashare group,
- if not
sudo usermod -aG sambashare $USER
- if yes
sudo smbpasswd -a $USER
- if not
$ grep samba /etc/group
sambashare:x:119:alexlai
$ sudo smbpasswd -a $USER
New SMB password:
Retype new SMB password:
Added user alexlai.
- edit /etc/samba/smb.conf
$ sudo cp -v /etc/samba/smb.conf /etc/samba/smb.conf.ori
'/etc/samba/smb.conf' -> '/etc/samba/smb.conf.ori'
alexlai@hc4Lunar:/etc/samba$ diff /etc/samba/smb.conf.ori /etc/samba/smb.conf
174a175,179
> [alexlaiHc4Lunar]
> path = /home/alexlai
> valid users = alexlai
> read only = no
> create mask = 0777
$ sudo systemctl restart smbd
$ sudo systemctl status smbd