# - - # # - - # # - - # # - i3 Manjaro - # # - - # # - Update system - # sudo pacman -Yyuuu; sudo pacman -Syyuuu; sudo pacman -Syu samba; sudo testparm /etc/samba/smb.conf sudo systemctl enable --now smb nmb sudo groupadd -r sambashare; sudo useradd -r -s /usr/bin/nologin smbguest; sudo passwd smbguest sudo usermod -aG sambashare smbguest; sudo usermod -aG sambashare is_derayo; sudo gpasswd sambashare -a smbguest; sudo pdbedit -a -u smbguest; sudo pdbedit -a -u is_derayo; sudo systemctl enable --now smb nmb; cd ~/Documents md ToShare-FullAccess md ToShare-JustRead chmod 777 ToShare* # - - # # - Edit samba configuration file - # sudo vim /etc/samba/smb.conf [global] workgroup = L_IS wins support = yes security = user server string = Samba Server server role = standalone server log file = /var/log/samba/log.%m max log size = 50 guest account = nobody map to guest = Bad Password [ToShare-FullAccess] comment = ToShare-FullAccess to everybody in the net path = /home/is_derayo/Documents/ToShare-FullAccess writeable = yes browseable = yes guest ok = no create mask = 0777 valid users = is_derayo, smbguest [ToShare-JustRead] comment = ToShare-JustRead to everybody in the net path = /home/is_derayo/Documents/ToShare-JustRead writeable = no browseable = yes guest ok = no create mask = 0755 valid users = is_derayo, smbguest # - - # # - Check smb file ok - # sudo testparm /etc/samba/smb.conf # - - # # - Other samples - # # - https://wiki.archlinux.org/index.php/Samba - # [global] ;inherit owner = unix only ; Inherit ownership parent directory for new files/directories ;inherit permissions = yes ; Inherit permissions parent directory for new files/directories create mask = 0664 directory mask = 2755 force create mode = 0644 force directory mode = 2755 ... [media] comment = Media share accessible by greg and pcusers path = /path/to/media valid users = greg @pcusers force group = +pcusers public = no writable = yes create mask = 0664 directory mask = 2775 force create mode = 0664 force directory mode = 2775 [public] comment = Public share where archie has write access path = /path/to/public public = yes read only = yes write list = archie printable = no [guests] comment = Allow all users to read/write path = /path/to/guests public = yes only guest = yes writable = yes printable = no [global] workgroup = MANJARO server string = Samba Server log file = /var/log/samba/%m.log max log size = 50 security = user map to guest = Bad User guest account = nobody usershare path = /var/lib/samba/usershare usershare max shares = 100 usershare allow guests = yes usershare owner only = yes group = sambashare force create mode = 0070 force directory mode = 0070 # - - # # - Manjaro Linux - # # - Install Samba - # sudo pacman -S samba; sudo pacman -S samba nautilus-share gvfs-smb; # - Copy the example configuration file - # sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf # - Check Samba configuration file for syntax errors - # testparm # - Create group sambashare - # sudo groupadd -r sambashare; # - Create a Linux user that you want to give access to samba shares - # # - Create user without shell access & without a home directory - # sudo useradd -r -s /usr/bin/nologin smbguest; sudo passwd smbguest; # - Add an user to sambashare group - # sudo usermod -aG sambashare smbguest; sudo usermod -aG sambashare is_derayo; # - Another command for samba user creation - # # - Create samba user in sambashare group - # sudo gpasswd sambashare -a smbguest; # - Set up credentials - # # - Create a Samba account with the same username as the Linux user - # sudo pdbedit -a -u smbguest; sudo pdbedit -a -u is_derayo; # - Change samba password at any time if needed - # sudo smbpasswd smbguest; sudo smbpasswd is_derayo; # - Start samba services - # sudo systemctl start smbd.service nmbd.service # - Restart Samba services - # sudo systemctl restart smbd.service nmbd.service sudo systemctl restart samba # - Run Samba at Startup - Enable samba services - # sudo systemctl enable smbd.service nmbd.service # - Quick Reference - # sudo pacman -S samba sudo pacman -S samba nautilus-share gvfs-smb; sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf testparm sudo groupadd -r sambashare; sudo useradd -r -s /usr/bin/nologin smbguest; sudo passwd smbguest; sudo pdbedit -a -u smbguest; sudo pdbedit -a -u is_derayo; sudo systemctl start smbd.service nmbd.service sudo systemctl restart smbd.service nmbd.service sudo systemctl enable smbd.service nmbd.service # - Configure Home Server Samba Shares - # # - Modify samba configuration file - # # - For full linux instalation terminal - # sudo gedit /etc/samba/smb.conf # - For sever's terminal - # sudo vim /etc/samba/smb.conf workgroup = L_IS wins support = yes # - For full linux installation only - # # - Please don't use this line in a dedicated server - # # - If this line does not appear in /etc/samba/smb.conf file, add it in Misc paragraph - # ############ Misc ############ security = user # - These lines go at the end of the /etc/samba/smb.conf file - # [ToShare-FullAccess] comment = ToShare-FullAccess to everybody in the net path = /home/is_derayo/Documents/ToShare-FullAccess writeable = yes browseable = yes guest ok = no create mask = 0777 valid users = is_derayo, smbguest [ToShare-JustRead] comment = ToShare-JustRead to everybody in the net path = /home/is_derayo/Documents/ToShare-JustRead writeable = no browseable = yes guest ok = no create mask = 0755 valid users = is_derayo, smbguest sudo gedit /etc/samba/smb.conf [global] workgroup = WORKGROUP writable = yes browsable = yes security = user map to guest = Bad User guest account = nobody guest ok = no # - Create Samba Custom Shares - # [Movies] path = /mnt/virtual/movies inherit permissions = yes inherit owner = yes [Series] path = /mnt/virtual/series inherit permissions = yes inherit owner = yes [Music] path = /mnt/virtual/music inherit permissions = yes inherit owner = yes [Videos] path = /mnt/virtual/videos inherit permissions = yes inherit owner = yes [Pictures] path = /mnt/virtual/pictures inherit permissions = yes inherit owner = yes [Games] path = /mnt/virtual/games inherit permissions = yes inherit owner = yes [Software] path = /mnt/virtual/software inherit permissions = yes inherit owner = yes [Downloads] path = /mnt/portable/downloads inherit permissions = yes inherit owner = yes # - Change current directory to the share directory - # cd /mnt/virtual # - Create share directories - # mkdir {movies,series,music,videos,pictures,games,software,downloads} # - Users & Groups - Introduction - # # - Show all listed users on a system - # cut -d: -f1 /etc/passwd # - Adding a User - # useradd Options: -d sets home directory for the user (if other than the default which is: /home/) -m creates the home directory # - Deleting a user - # userdel Options: -r deletes the user as well as the /home/ directory # - Creating or changing Passwords - # passwd If changing a password you will be requested for your old password before being able to enter you new one. # - Group commands - Add a group - # groupadd [options] Note: See the man page for the groupmod command, as is too sophisticated for the limits of this brief how-to. # - Delete a group - # groupdel # - Check group membership from current account - No root user - # groups # - Modify a groups security - # roupmod [options] Note: See the man page for the groupmod command, as is too sophisticated for the limits of this brief how-to. # - Creating usershare path - # Note: This is an optional feature. Skip this section if you do not need it. "Usershare" is a feature that gives non-root users the capability to add, modify, and delete their own share definitions. # - This creates the usershare directory in /var/lib/samba - # mkdir -p /var/lib/samba/usershare # - This makes the group sambashare - # groupadd -r sambashare # - This changes the owner of the directory and group you just created to root - # chown root:sambashare /var/lib/samba/usershare # - This changes the permissions of the usershare directory so that users in the group sambashare can read, write and execute files: - # chmod 1770 /var/lib/samba/usershare # - Set the following variables in smb.conf configuration file - # sudo gedit /etc/samba/smb.conf [global] usershare path = /var/lib/samba/usershare usershare max shares = 100 usershare allow guests = yes usershare owner only = yes # - Add your user to the sambashare group. Replace your_username with the name of your user - # gpasswd sambashare -a your_username # - Adding a user - # useradd samba_user # - Samba users use a password separate from that of the Linux user accounts. Create the Samba user account with the same name as in the previous command: - # pdbedit -a -u samba_user # - Changing Samba user's password - # smbpasswd samba_user # - How do I switch from an bash shell to false? - # chsh -s /bin/false smbguest;