domingo, 27 de septiembre de 2020

LINUX. SAMBA Server - UBUNTU




Purpose

How to Install Samba server to share files. I want create a NAS for share files for Backups or films server ;-)

Use a Raspberri Pi 4 connect some HD docks stations.

Steps

[ ] Check Operating System version

COMMAND: smbd --version

 

[ ] Update Operating System

COMMAND: sudo apt-get update

COMMAND: sudo apt-get upgrade

 [ ] Install Samba System

COMMAND: sudo apt install samba

[ ] Where is install SAMBA system?

COMMAND:  sudo systemctl status smbd


[ ] Check Samba System Status

COMMAND:  sudo systemctl status smbd


If the service it's running you can start with

COMMAND:  sudo systemctl start smbd && sudo systemctl enable smbd

 [ ] Backup current configuration

COMMAND:  sudo cp -rfvp /etc/samba/smb.conf /etc/samba/smb.conf-back



[ ] New GROUP (gonsmbgrp) Only for secure accesss.

COMMAND:  sudo addgroup gonsmbgrp 

[ ] New USER (gonsambausr). Only for secure access.

COMMAND:  sudo useradd gonsambausr -m -G gonsmbgrp

COMMAND:  sudo passwd gonsambausr

COMMAND:  sudo smbpasswd -a gonsambausr


 [ ] Create folder to share ( /media/EXTHD01). No secure access. All access.

COMMAND: 

sudo mkdir /media/EXTHD01

sudo chmod -R 777 /media/EXTHD01

sudo chown -R nobody:nogroup /media/EXTHD01

[ ] Create folder to share ( /media/EXTHD02). Secure. User and Password.

 COMMAND: 

sudo mkdir /media/EXTHD02

sudo chmod -R 777 /media/EXTHD02

sudo chown -R  gonsambausr:gonsmbgrp /media/EXTHD02

sudo chmod -R  777 /media/EXTHD02


 [ ] Configure SAMBA

 COMMAND: sudo nano/etc/samba/smb.conf

* Anonymous Access

[sambagonshareanonimo]

comment = ShareGoN

path = /media/EXTHD01

read only = no

browseable = yes

guest ok = yes

force user = nobody



* Secure Access

[Sambaseguro]

comment = ShareGoNSeguro

path = /media/EXTHD02

browseable = yes

writable = yes

browsable = yes

valid users = gonsambausr @gonsmbgrp

read only = no


[ ] Check Params

 COMMAND: testparm


/********************************************************************/

gon@gon-desktop:/media$ testparm

Load smb config files from /etc/samba/smb.conf

Loaded services file OK.

Server role: ROLE_STANDALONE

 

Press enter to see a dump of your service definitions

 

# Global parameters

[global]

        log file = /var/log/samba/log.%m

        logging = file

        map to guest = Bad User

        max log size = 1000

        obey pam restrictions = Yes

        pam password change = Yes

        panic action = /usr/share/samba/panic-action %d

        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

        passwd program = /usr/bin/passwd %u

        server role = standalone server

        server string = %h server (Samba, Ubuntu)

        unix password sync = Yes

        usershare allow guests = Yes

        idmap config * : backend = tdb

 

 [printers]

        browseable = No

        comment = All Printers

        create mask = 0700

        path = /var/spool/samba

        printable = Yes

 

 [print$]

        comment = Printer Drivers

        path = /var/lib/samba/printers

 

 [sambagonshare]

        comment = ShareGoN

        force user = nobody

        guest ok = Yes

        path = /media/EXTHD01

        read only = No

 

[Sambaseguro]

        comment = ShareGoNSeguro

        path = /media/EXTHD02

        read only = No

        valid users = gonsambausr @gonsmbgrp

gon@gon-desktop:/media$

/********************************************************************/


[ ] Firewall permit rule

 COMMAND: sudo ufw allow samba

 

[ ] Restart Samba services to effect the above changes.

COMMAND:
sudo systemctl restart smbd  

sudo service smbd restart   


 [ ] Check from windows System

COMMAND: \\IP

For Example \\192.16721.33


[ ] Links:


Check at Linux Ubuntu 4.11.6
by GoN | Published: Sept , 2020 | Last Updated:

No hay comentarios: