   
 


         .  ,     ,   Linux   ,   Windows Server  Active Directory, DNS  DHCP, ,     .       , , ,   .

     ,   ,     .      ,      .





 

   





  :  



   ,   ,    ?  , , , firewall  ?      ,     .      .




,    


   .           .     .

  ,  .       : , , , .    .

      ,  .    , , ,   .   .

     .           ,    .




 ,  


1.   8   ( 16)     .

2.     .

3.   (  )  ,     .       .

4.      .

5.         ,   .




-   


    ,    .

  ,     -  (, , )

 /   ,    ,    

Linux     

Windows Server    Windows (,  )

 ()  ,     (-, )

IP-      

   :     

DNS   :     IP-

DHCP  ,     

Firewall  ,    

       

  ()        

Active Directory         Windows-

SSH / RDP      (Linux / Windows)

     ,    

         ( ).




    


    .



   ,    .

, , ,       .     ,   .




   ,   


1.  .        ,   .  .

2.    .         .  .

3.   .    -: , , , , .     .

4. .       .   ,    .

5.    .     (snapshots):     .




      


    . ,    .    .

    . .       .  ,  .

    .      .    .

 Windows  Linux   ?. :        .    ,    .




     


1.   12      /.

2.  VirtualBox      Ubuntu Server ( 7),  .

3.       4   .




 ,  


   ( )    (Linux, PowerShell, ).

  ( )   .

    (  )        .        ,     .

? ,   1. :    ,   ,  ,      .




   



   ,     ,    .      ,    ,  ,      .  ,    .

   .   ( 816  ,    )    .




   



  ()   ,   ,  , ,         .  DevOps-     ,     :    ,  , , ,  ,  ,     .

 :        .  ,    ( ),  (),  (),          (   ),     ()        ().




    



     (Linux  Windows).

  : IP-, , firewall, VPN.

    : , ,  ,  , DNS, DHCP.

     (    Active Directory).

     .

       .

  : , ,   .

   .




    


    junior- ( ?  )   49  .      ,  ,   ,  DevOps    .        IT-.     ;     .




 ,   



  :    ,   .   :    ,  ,  ,   .     ,     ,  - .     ,     .




Linux  Windows



     ,  .     :

 Linux   , ,  .  .

 Windows Server   , Active Directory,  ,  Exchange.

  ,   ,   .




  



 I ( 13)  :  ,     .  II ( 47)  Linux: , ,  , ,  .  III ( 812)    : DNS, DHCP, , ,  .  IV ( 1315)  Windows Server  Active Directory.  V ( 1622)  : ,  ( +    Zabbix  Prometheus/Grafana), , , .  VI ( 2324)     .   , , .

  :    ,    ,    ,  (!)    .

:::note   : ,  ,   ,     .   ,   ,  ,   .       . :::




 1.   





     


    ,    .  ,    ,  ,   ,  ,  ,   - ,       .




 


 / helpdesk   :  , ,  

   , , ,  

     : , , firewall, VPN

   (DBA)   : , , 

    VMware, Proxmox, Hyper-V, 

DevOps / SRE  , CI/CD,  (.  )

 ,    ,     .




  


1.  ,  .   ,  ,   ,   .

2.    .       ,  .

3.    .     , ,  .

4. . , ,  .    .

5.  .       .

6.  .    root/Administrator  .

7.   .      .

:::warn      :        .         firewall  SSH     ,     .         ,  . :::




 


  (Linux)  PowerShell (Windows)    .

 SSH / RDP     .

   (Zabbix, Prometheus)   .

   .

   -.

  (VirtualBox, Proxmox, VMware)     .




 :    


     :   ,  . ,     .

   : , , ,  .   ,   .

        .   ;   ,    .




   1


1.   (57 ) ,            .

2.  7          .

3.  23    junior   .      .

4.    (  ),      .




  


       ,  .

      .

       .

      .

        .




 2.      



  ,   .    :      ,        .




   



  (CPU)  .     ,    .

   (RAM)   .    .    .

  (HDD/SSD)     . SSD  HDD  .

   ()  ,    .




   


: CPU () |   :   |  :     /

: RAM |   :    |  :  RAM =   ,  

:  SSD/NVMe |   :     |  :      SSD

: RAID |   :   |  :       ()

:  |   :   |  :  /- 

:  ,  |   :   |  :   




RAID:     



RAID      / :

: RAID 0 | :     | :  (     ) | :  ,   

: RAID 1 | :  (   ) | :  (1   ) | :  

: RAID 5 | :  +   3+  | :  (1 ) | :    

: RAID 6 | :  5,   2  | :  (2 ) | :  

: RAID 10 | :  +  | :  | :  ,  

:::warn RAID      . RAID     ,     , -,     .   RAID     .   RAID (),   ().  16   . :::




   



      . :

     ;

  ;

      ;

     ;

  .

  : root  Linux, Administrator/SYSTEM  Windows.     .




, , 



    .

  (, )   ,   (-, ).

 Swap ()   , ,   RAM.   ,   ;   swap  ,    .




 



  ,     :

: ext4 | : Linux ( ) | : , 

: XFS | : Linux (,  ) | :    

: ZFS / Btrfs | : Linux/BSD () | : ,  

: NTFS | : Windows | :  Windows

: FAT32 / exFAT | : ,  | : ,    




 



      :

 ? BIOS/UEFI ( ) ?  (GRUB) ?



  ?   (systemd) ?  

   ,     : ? ? ? ?




:    



        (VM)    (VMware, Proxmox, Hyper-V, KVM). :   , , ,  .     .     20.




   2



1.    : CPU (), RAM,  .  Linux: lscpu, free -h, lsblk.  Windows:   .

2.      RAM      RAM .

3.    RAID    ,    ,     .

4. ,  RAID   .  3 ,  RAID  .

5.     ,       .




  



  RAID   .

   RAM ( swap = ).

       HDD  SSD.

          .




 3. :   



     .   ,        ,      .     .




    



 IP-    (192.168.1.10).

     (  80/443, SSH  22, RDP  3389).

 MAC-     ,     .

  (gateway)   ,       .

 DNS   :  ? IP.

    ,      .




IP-  



 IPv4    0255 (192.168.1.10).    :

IP:    192.168.1.10



: 255.255.255.0   ( /24)



:  192.168.1.0      : 192.168.1.1 ... 192.168.1.254



:  192.168.1.1       

 /24 (CIDR) =  255.255.255.0 = 254  .   (   ):

 10.0.0.0/8

 172.16.0.0/12

 192.168.0.0/16

 127.0.0.1  localhost.

CIDR: /24 | : 255.255.255.0 | : 256 (254 )

CIDR: /25 | : 255.255.255.128 | : 128

CIDR: /16 | : 255.255.0.0 | : 65 536




 OSI   



  .   :

: L2  |   :     MAC | : Ethernet, Wi-Fi,  |  : , , VLAN

: L3  |   :    IP | : IP,  |  : , 

: L4  |   :     | : TCP, UDP |  :  , firewall

: L7  |   :   | : HTTP, DNS, SMTP |  :  

           .




TCP  UDP



 TCP       (, , SSH, ).

 UDP   ,  (DNS, , VoIP, ).




   



    ,  .    (     ).

  (DHCP)   .     .




   Linux



 Ubuntu  netplan:

# /etc/netplan/01-net.yaml



network:



version: 2



ethernets:



eth0:



addresses: [192.168.1.10/24]



routes:



- to: default



via: 192.168.1.1



nameservers:



addresses: [8.8.8.8, 1.1.1.1]

sudo netplan apply



ip a                    



ip route               




     



ip a                    



ip route                



ping -c 4 8.8.8.8       



ping -c 4 ya.ru        +  DNS



traceroute ya.ru          



dig ya.ru +short        



nslookup ya.ru           



ss -tulpn                 



nc -zv host 443          



curl -I http://site     -



mtr ya.ru              ping + traceroute   




   


1.   ? ip a   IP?

2.     ? ping 

3.    ? ping 8.8.8.8 ( IP,  DNS)

4.   DNS? ping ya.ru / dig ya.ru

5.    ? nc -zv host port

6.   ? curl,  

:::note  :  ping 8.8.8.8 ,  ping ya.ru  ,    ,    DNS.   IP  /      .     . :::




Firewall



Firewall    .  Linux  ufw ()  nftables/iptables:

sudo ufw default deny incoming        



sudo ufw default allow outgoing      



sudo ufw allow 22/tcp               SSH



sudo ufw allow 80,443/tcp           



sudo ufw enable



sudo ufw status numbered

:  ,   .




, , VLAN



  (switch)       (L2).

  (router)     (L3),  .

 VLAN         (, ,   ).   .




NAT   



NAT            .   (port forwarding)       .




   3



1.    : IP, , , DNS. ,   .

2.  :     /24  /25,    192.168.5.10/24.

3.   IP  VM  netplan   ip a / ip route.

4.   :  DNS ( nameservers)  ,  ping 8.8.8.8 ,  ping ya.ru  .  DNS.

5.  ufw:   ,  SSH  .




  



     (DHCP)  .

   DNS    ( ping  IP).

  firewall,   SSH,   .

        VLAN.

          ,   .




 4. Linux:    



    Linux  ,   .       .  ,     .




 


          ,    (SSH).  :        .   .




 


  -  



ls       -la     /var/log




 :    /


/  

/etc     

/var/log  

/var/www  

/home/    

/root    root

/tmp   

/usr/bin, /bin  

/opt, /srv      

/dev   (  . .)

/mnt, /media   

/proc, /sys     




  


pwd                     



ls -la                 ,   (  )



cd /etc/ssh  / cd ..  / cd ~



cat file                



less file               (q  )



head -n 20 / tail -n 20



tail -f /var/log/syslog       



cp / mv / rm / mkdir -p / touch



nano file               




 nano (    vim)


  nano  : Ctrl+O , Ctrl+X , Ctrl+W .      vim: i   , Esc    , :wq    , :q!    .     vim    .




   


find /etc -name "*.conf"              



find / -size +100M 2>/dev/null      



grep -r "error" /var/log/              



grep -i "fail" auth.log               



cat access.log | grep 500 | wc -l      500



awk '{print $1}' file               



sed 's/old/new/g' file              

 | ()         .




   (,    5)


whoami                  



sudo              root



chmod 640 file          



chown user:group file  

  rwxr-x---:  (rwx),  (r-x),  (---). : r=4, w=2, x=1.




  


lsblk                     



df -h                      



du -sh /var/*           



mount /dev/sdb1 /mnt    



umount /mnt            

    /etc/fstab.

:::warn          .   df -h.     100%,   ,   ,  .     ( 17)  / . :::







ps aux                  



ps aux | grep nginx     



top  /  htop             



kill PID                ()



kill -9 PID            



systemctl ...            ( 6)




   


tar -czf arch.tar.gz /path      gzip



tar -xzf arch.tar.gz           



scp file user@host:/path         SSH



rsync -av src/ user@host:/dst/  




 


# Debian/Ubuntu



sudo apt update && sudo apt install 



# RHEL/Rocky/Fedora



sudo dnf install 




   


 Tab   ( ).

   / Ctrl+R    /   .

 Ctrl+C  . Ctrl+L   .

 history   .




 


echo $PATH                



export VAR=     



env                     




   4


1.  Ubuntu Server  VM ( 7).    ,  .

2.    vim (:q!)     .

3.         error   .

4.  df -h  du -sh /var/*  ,   .

5.     tar      .

6.   find  .conf   /etc.




  


  .

 rm -rf     Linux  .

       (df -h).

   vim,  ,  .

    root  sudo  .




 5. ,    



       .    ,  ,         ,   .        ,   ,    .




  Linux


   ,  UID,    .    /etc/passwd:

root:x:0:0:root:/root:/bin/bash



www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin



ivan:x:1000:1000:Ivan:/home/ivan:/bin/bash

: ,  (x =   ), UID, GID, ,  , . UID 0 = root ( ).   (www-data)    /usr/sbin/nologin     ,   .

 (  )   /etc/shadow,   root.




 


sudo adduser ivan                  ()



sudo passwd ivan                 / 



sudo usermod -aG sudo ivan          sudo



sudo usermod -aG docker ivan        docker



sudo deluser ivan                



sudo deluser --remove-home ivan     



id ivan                          UID, GID,  



su - ivan                          

:::note  -a  usermod -aG :    .  -a (usermod -G)            .   , -     .  -aG. :::







     .       .

sudo groupadd developers          



sudo usermod -aG developers ivan  



groups ivan                         



getent group developers            




  


$ ls -l



-rw-r--r-- 1 ivan devs 1024 Oct 23 notes.txt



drwxr-x--- 2 ivan devs 4096 Oct 23 private

 -rw-r--r--:

 1- :  (- , d , l ).

  :  (rw-),  (r--),  (r--).

 r=(4), w=(2), x=(1).

 :

: rw-r--r-- | : 644 | : :  ,  

: rwxr-xr-x | : 755 | : /:  /

: rw------- | : 600 | : :   (, )

: rwxrwxrwx | : 777 | :   (,    )




   


chmod 644 file                



chmod u+x script.sh            



chmod -R 755 /var/www          



chown ivan file               



chown ivan:devs file           



chown -R www-data:www-data /var/www   

:::warn    chmod 777  .           .  -   - , ,    ,      /. 777     ,   ,   . :::




sudo:   root


sudo       root.    /etc/sudoers (   visudo!):

sudo visudo



#  :



ivan ALL=(ALL) ALL                      ivan    sudo



deploy ALL=(ALL) NOPASSWD: /bin/systemctl restart myapp    ,   



%developers ALL=(ALL) /usr/bin/apt        developers  apt

  :   sudo  ,   ,   .




  ()


 SUID (s  x  )       .     (passwd),   SUID   .

 Sticky bit (t)     /tmp:      ,    .




  Windows (,    13)


 Windows  : ACL (  )    (, , ,  )    .      icacls   .   :      .




   5


1.  ,  ,     sudo ( -aG!).

2.   devs,   ,    - devs   770.

3. :        ,   .

4.  visudo         .

5.   5   /etc        .




  


 usermod -G  -a      .

 chmod 777    .

  /etc/sudoers ,    visudo (   sudo).

     sudo   .

   root     sudo.




 6. ,   systemd



     : -, , , DNS.      .   Linux    systemd.




  


 (, )  ,    ,     . : nginx, ssh, postgresql, cron. systemd  , ,       .




systemctl   


systemctl status nginx         (?  ?)



systemctl start nginx        



systemctl stop nginx         



systemctl restart nginx      



systemctl reload nginx           ( )



systemctl enable nginx         



systemctl disable nginx        



systemctl enable --now nginx     



systemctl is-active nginx     



systemctl list-units --type=service    

:::note  start  enable. start   ,      . enable   ,    .  :  , start,     ,    ,    enable.   enable --now. :::




   journalctl


systemd       :

journalctl -u nginx                nginx



journalctl -u nginx -f              



journalctl -u nginx --since "1 hour ago"



journalctl -u nginx -n 50         50 



journalctl -p err                 



journalctl -b                       



journalctl --disk-usage             

   ? systemctl status (    ) ? journalctl -u  ().    .




 unit-


   unit-.    /lib/systemd/system/,    /etc/systemd/system/.     :

# /etc/systemd/system/myapp.service



[Unit]



Description= 



After=network.target



Requires=postgresql.service





[Service]



Type=simple



User=appuser



WorkingDirectory=/opt/myapp



ExecStart=/opt/myapp/start.sh



Restart=always



RestartSec=5



EnvironmentFile=/opt/myapp/.env





[Install]



WantedBy=multi-user.target

:

 [Unit]     (After    ; Requires   ).

 [Service]   :   ,   (ExecStart),    (Restart=always).

 [Install]     .

:

sudo systemctl daemon-reload        unit-  



sudo systemctl enable --now myapp



systemctl status myapp

Restart=always   :   , systemd   . :    ,   .




 systemd ( cron)


systemd       :

# myapp-backup.timer



[Timer]



OnCalendar=*-*-* 03:00:00



Persistent=true





[Install]



WantedBy=timers.target

    .service.   cron     journalctl  .




 (targets)   


systemctl get-default                



systemctl set-default multi-user.target     ()



systemctl isolate rescue.target     

multi-user.target      ; graphical.target    .




  systemd


ps aux | grep             



top / htop                      



kill PID / kill -9 PID        / 



nohup  &              ,    

      systemd,        systemd ,     .




   6


1.   nginx: status, stop, start, reload.    systemctl status.

2.   start/enable:  ,  VM, ,   enable   .

3.    ( -)  Restart=always.    ,  systemd  .

4.      journalctl -u.

5.   systemd,  -  .




  


 start  enable      .

  daemon-reload   unit-.

        systemd.

   journalctl    .

  Restart=always ,   -  ,      ( !).




 7.  :  



         .      .       : , ,    .




  


  (VM)     :  , , ,   .  ( )      VM.    :  VM     ,    .




 


: VirtualBox () | :     |  : virtualbox.org

: Ubuntu Server,   LTS- | :   Linux- |  : ubuntu.com

: Rocky Linux / AlmaLinux | : RHEL- (dnf,  ) |  : rockylinux.org

: Windows Server (Evaluation) | :    AD ( 1314) |  : microsoft.com Evaluation Center

   VirtualBox +  Ubuntu Server.




 VM  Ubuntu Server


1.  ISO- Ubuntu Server.

2.  VirtualBox:  ? ,  Linux/Ubuntu 64-bit.

3. : 2048  (    ).

4. : 2025  .

5.  ISO, ,  Ubuntu.

6.    Install OpenSSH server     SSH.

7.    : sudo apt update && sudo apt upgrade -y.

8.   (snapshot)  .

:::note  (snapshots)   .      . -      ,  .   ,     ,      . :::




  


VirtualBox    :

: NAT |  : VM  ,      | :    

:   (Bridged) |  : VM       | :   VM   

:   |  : VM     | :  

: Host-only |  : VM      | :  +   

 -    : Host-only (    ) +   NAT (   VM).




-  


  VM     :

srv-web     - (nginx, )



srv-db        (PostgreSQL/MySQL)



srv-dns     DNS/DHCP ( 8)



win-dc      Windows Server,   ( 13-14)

     12 VM  .  VirtualBox    .




  SSH


    VM (ip a)     :

ssh ivan@192.168.56.10

    (  ):

ssh-keygen -t ed25519



ssh-copy-id ivan@192.168.56.10



ssh ivan@192.168.56.10            




  


 WSL2 (Windows)   Linux  VirtualBox,   .     .

 Proxmox VE     ;     ,  Proxmox      (homelab).      .

  VM        .




Homelab     


  (homelab)        .    -  Proxmox,  VM,              .  homelab      .




   7


1.  VirtualBox   VM  Ubuntu Server,   OpenSSH.

2.    .

3.   ,    VM     SSH.

4.    SSH-.

5.  VM,   ,  ,      (ping).

6.   -       .




  


         .

  VM    ( ).

       ,  VM    .

      .

   OpenSSH       .




 8. DNS  DHCP:   



 ,      . DHCP   , DNS    .          ,  ,   ,    .




DHCP:   



,        , ,   DNS.     . DHCP   :  ,  ,     (lease).




  DHCP ( DORA)


 ? DISCOVER  "  DHCP-?"



    ? OFFER      "   192.168.1.50"



 ? REQUEST   " "



    ? ACK        "    N "




  DHCP


 IP-  ;

   ;

  DNS-;

 : NTP (), ,    .




  MAC


  (, )     MAC-   DHCP   .

:::note      ( DHCP-),    .       ,      , DNS-  .  DHCP    , , . :::




  (isc-dhcp-server)


subnet 192.168.1.0 netmask 255.255.255.0 {



range 192.168.1.100 192.168.1.200;        



option routers 192.168.1.1;              



option domain-name-servers 192.168.1.2;  DNS



default-lease-time 3600;



}





host printer {



hardware ethernet 00:11:22:33:44:55;



fixed-address 192.168.1.50;              



}




DNS:   



DNS   (server.company.local)  IP-.  DNS      .




   


  : " IP  ya.ru?"



?   



?  :   ?  .ru ?  



?  IP,      TTL




 


: A | :  ? IPv4 | : server ? 192.168.1.10

: AAAA | :  ? IPv6 | : server ? ::1

: CNAME | :  | : www ? server.company.local

: MX | :   | : ? mail.company.local

: PTR | : IP ?  ( ) | : 192.168.1.10 ? server

: NS | : DNS-  | :

: TXT | :  (SPF, DKIM, ) | :

: SRV | :   (  AD) | :




   


  :  ? IP ( ).

  : IP ?  (PTR-).   , , .




 DNS-


    DNS (BIND  Linux, DNS-  Windows Server),          ,    .

#   BIND



$TTL 3600



@   IN  SOA ns1.company.local. admin.company.local. (



2026102301  ; serial (   !)



3600 1800 1209600 3600 )



@       IN  NS   ns1.company.local.



ns1     IN  A    192.168.1.2



web     IN  A    192.168.1.10



db      IN  A    192.168.1.20



www     IN  CNAME web

:::warn Serial-  (2026102301)     ,   DNS-   .    TTL:        TTL.      DNS,      TTL    . :::




 DNS


dig ya.ru +short              IP



dig @192.168.1.2 web.company.local     



dig -x 192.168.1.10            (PTR)



nslookup web.company.local   



systemd-resolve --status      DNS  

 : ping 8.8.8.8 , ping ya.ru   ?   DNS,    .




DNS  DHCP 



DHCP    DNS-. DNS      .          (     Windows-,  1314).




   8



1.  DHCP-  ,      MAC. ,    .

2.  DNS- (BIND  dnsmasq),      A-.

3.     dig @-.

4.  CNAME ()  ,   .

5.   DNS:   DNS    (ping  IP ,    ).




  



   serial     .

   TTL   .

     DHCP.

     (   ).

    DNS       .




 9. -   



    ,   : - (   )    ( ).       .




-: nginx  Apache



-  HTTP-   .  :

 nginx  , ,       .  .

 Apache  , ,  .

 nginx  .




  


sudo apt install nginx



sudo systemctl enable --now nginx



curl localhost              

: /etc/nginx/nginx.conf (), /etc/nginx/sites-available/ (), /etc/nginx/sites-enabled/ ().




  


server {



listen 80;



server_name site.company.local;



root /var/www/site;



index index.html;



location / {



try_files $uri $uri/ =404;



}



}

sudo ln -s /etc/nginx/sites-available/site /etc/nginx/sites-enabled/



sudo nginx -t                  



sudo systemctl reload nginx




   


 (  8080)   nginx:

server {



listen 80;



server_name app.company.local;



location / {



proxy_pass http://127.0.0.1:8080;



proxy_set_header Host $host;



proxy_set_header X-Real-IP $remote_addr;



}



}

:::note sudo nginx -t   reload   .       . reload    , restart    .  + restart =  . :::




HTTPS  Let's Encrypt


sudo apt install certbot python3-certbot-nginx



sudo certbot --nginx -d site.company.ru

Certbot      . : sudo certbot renew --dry-run.




  


tail -f /var/log/nginx/access.log      



tail -f /var/log/nginx/error.log      (  502/504)

502/504   =   nginx  .    (curl 127.0.0.1:8080).




 



    .  :

  (SQL): PostgreSQL, MySQL/MariaDB. ,  ,  SQL.

 NoSQL: MongoDB (), Redis (-, ).  .




 PostgreSQL


sudo apt install postgresql



sudo systemctl enable --now postgresql



sudo -u postgres psql             

 :

CREATE DATABASE appdb;



CREATE USER appuser WITH PASSWORD 'secret';



GRANT ALL PRIVILEGES ON DATABASE appdb TO appuser;



\l           



\du          



\q          




MySQL / MariaDB


sudo apt install mariadb-server



sudo mysql_secure_installation      ( root,  )



sudo mysql

CREATE DATABASE appdb;



CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'secret';



GRANT ALL ON appdb.* TO 'appuser'@'localhost';



FLUSH PRIVILEGES;




   


   (!  16):

pg_dump appdb > appdb.sql                 PostgreSQL



mysqldump appdb > appdb.sql               MySQL

 :    localhost   ,  ,   .

 : ,   .

      .

:::warn          (0.0.0.0).             .      : listen_addresses  localhost   , firewall    (5432  PostgreSQL, 3306  MySQL). :::




 ()


     :   () +  ().       .    ,     .




  + 



 : nginx (, HTTPS) ?  () ?   ().     : , , , , .




   9



1.  nginx,   ,       .

2.  HTTPS (  )     .

3.  PostgreSQL,  , ,  .

4.     pg_dump      .

5. ,     localhost,  firewall    .

6.    nginx     nginx -t.




  



 reload/restart nginx  nginx -t.

      .

 /  .

     (   ).

  502/504 ( )   nginx.




 10.     



          :    ,   Windows  Linux,  .       .




  


: SMB/CIFS | : Windows ( Linux  Samba) |  :  , ;   Windows-

: NFS | : Unix/Linux |  :    Linux-

: FTP/SFTP | :  |  :   (SFTP  ,  SSH)

: WebDAV | :  HTTP |  :     




Samba:    Windows  Linux


Samba  Linux-  ,  Windows    .

sudo apt install samba

 /etc/samba/smb.conf:

[shared]



path = /srv/shared



browseable = yes



read only = no



valid users = @smbgroup

sudo smbpasswd -a ivan           Samba- 



sudo systemctl restart smbd

 Windows: \\192.168.1.10\shared.  Linux:

sudo mount -t cifs //192.168.1.10/shared /mnt -o username=ivan




NFS:    Linux


#  



sudo apt install nfs-kernel-server



echo "/srv/data 192.168.1.0/24(rw,sync,no_subtree_check)" | sudo tee -a /etc/exports



sudo exportfs -ra



sudo systemctl restart nfs-kernel-server





#  



sudo mount 192.168.1.10:/srv/data /mnt

      /etc/fstab.




   


     . ,      ,    ,      .

  Linux/Samba   ,    ( 5).

  Windows   NTFS-    (ACL).

 :   ,    .     .

:::note        :     (NTFS/Linux)     (Share/Samba).        .   :   ,          .   . :::




SFTP:   


SFTP   SSH      ,   SSH-.

sftp ivan@192.168.1.10



> put localfile.txt            



> get remotefile.txt           



> ls / cd / pwd                

    chroot      . FTP   (ftp,  21)        .




   RAID


   :

 NAS (Network Attached Storage)    .

   RAID ( 2)       .

      /,      .

# : ,  



du -sh /srv/shared/*



df -h                           




   


      :    .    2: RAID ? .     RAID.     ( 16).




   10


1.  Samba-  Linux-      Windows (  Linux).

2.   ,      .

3.  NFS-   Linux-VM,  .

4.    SFTP.

5.   :    ,      ,   .

6.     /etc/fstab.




  


        (    ).

   FTP  SFTP.

      .

  RAID    .

         .




 11. ,    VPN



  :    (    ),            VPN.




 :   email



  ,       :

SMTP        ( 25, 587)

IMAP        ( 993)

POP3      ( 995, )

 :

 ? SMTP   ? (DNS: MX- ) ?



SMTP   ?   ? IMAP/POP3 ?  




  


 MTA (Mail Transfer Agent)   : Postfix, Exim.

 MDA (Mail Delivery Agent)    : Dovecot.

 :  (SpamAssassin, Rspamd), .




      


:::warn       ,       (    )    .    DNS: MX ( ), SPF (    ), DKIM (  ), DMARC ( ),    IP-      PTR-.      .       ,    .      ,    ,   . :::




 DNS  


MX     company.ru ? mail.company.ru         



SPF    TXT "v=spf1 mx -all"                   



DKIM   TXT (  )         



DMARC  TXT "v=DMARC1; p=quarantine"           



PTR    (  IP ? )           




 : SSH (Linux)  RDP (Windows)





SSH     Linux-


ssh ivan@server



ssh -i ~/.ssh/key ivan@server -p 2222



scp file ivan@server:/path           

  SSH- (/etc/ssh/sshd_config):

PermitRootLogin no                root



PasswordAuthentication no         



Port 22                         ( ,       )



AllowUsers ivan deploy           

sudo systemctl restart ssh

   ( ):

ssh-keygen -t ed25519



ssh-copy-id ivan@server




RDP     Windows


Windows Server   RDP ( 3389).  :

 RDP          VPN.

  ,  ,   .

    RDP   1  -.

:::note    RDP ( 3389)          .      Windows-     VPN   (RD Gateway),  .    SSH:     VPN    . :::




VPN:   



VPN     :      ,     .




 VPN


          .

 Site-to-site       .




 


WireGuard  , ,      

OpenVPN  , , 

IPsec     site-to-site




 WireGuard ()


#  /etc/wireguard/wg0.conf



[Interface]



Address = 10.8.0.1/24



PrivateKey = < >



ListenPort = 51820





[Peer]                          



PublicKey = <  >



AllowedIPs = 10.8.0.2/32

sudo wg-quick up wg0



sudo systemctl enable wg-quick@wg0

    10.8.0.0/24      .




   11



1.       ,     DNS (MX).

2.   ,   SPF, DKIM, DMARC        .

3.   SSH:   ,  root,  .

4.  WireGuard   VM  ,       .

5. ,  RDP     .




  



     SPF/DKIM/DMARC/PTR   -.

  RDP  SSH     .

   root  SSH    .

    SSH  (   ,  ).

    (SMTP)   (IMAP/POP3) .




 12. ,    



    .    ,   ,    ,         .        Linux.




   Linux



lsblk                   



sda                   



??sda1                1 (, /boot)



??sda2                2



sdb                   

   /dev/sda, /dev/sdb;   /dev/sda1  . . NVMe-: /dev/nvme0n1.




   



  :   ?    ? .

sudo fdisk /dev/sdb                ()



sudo mkfs.ext4 /dev/sdb1            ext4



sudo mkdir /mnt/data



sudo mount /dev/sdb1 /mnt/data   



df -h                            




 : /etc/fstab


    ,    /etc/fstab:

#  UUID (,  /dev/sdb1)



UUID=xxxx-xxxx  /mnt/data  ext4  defaults  0  2

UUID   blkid.

:::warn   /etc/fstab     (   ).     sudo mount -a      fstab     .  UUID  /dev/sdX,      . :::




LVM:   



LVM (Logical Volume Manager)   ,        .       .

  (PV) ?   (VG) ?   (LV)



/dev/sdb, /dev/sdc  ?      vg_data      ?   lv_files, lv_db

sudo pvcreate /dev/sdb /dev/sdc          LVM



sudo vgcreate vg_data /dev/sdb /dev/sdc    



sudo lvcreate -L 50G -n lv_files vg_data    50 



sudo mkfs.ext4 /dev/vg_data/lv_files

     :

sudo lvextend -L +20G /dev/vg_data/lv_files    



sudo resize2fs /dev/vg_data/lv_files           

         ,   .     .




    



df -h                         



df -i                       inode (   !)



du -sh /var/*                



du -sh /* 2>/dev/null | sort -rh | head     



ncdu /                       ()

:::note     :   (df -h  100%)   inode      (df -i).      ,     :   ,    .  . :::




 



    . logrotate     :

# /etc/logrotate.d/myapp



/var/log/myapp/*.log {



daily



rotate 14            14 



compress             



missingok



notifempty



}

        .




SMART:  



 ,   . SMART   :

sudo apt install smartmontools



sudo smartctl -a /dev/sda            



sudo smartctl -H /dev/sda          (PASSED/FAILED)

  SMART           .




   



  LVM/ZFS       .

       ( 16).

: RAID       ( 2).




   12



1.   VM  ,  , , ,   fstab  UUID.

2.  fstab  mount -a  .

3.  LVM:     ,  ,   .

4. ,   ,  du  ncdu.

5.  logrotate  - .

6.     smartctl.




  



   /etc/fstab   mount -a    .

  /dev/sdX  fstab  UUID.

    (df -h)  inode (df -i).

       .

  SMART-   .




 13. Windows Server: 



     Linux    Windows Server:    Active Directory,  ,  Exchange,  .       .      Windows Server.




 Windows Server    Windows


  :   ,   (Active Directory, DNS, DHCP,  ),       .  :

 Desktop Experience     .

 Server Core   ,     PowerShell ( ,       ).




  


Windows Server      :

Active Directory Domain Services (AD DS)   ,  

DNS Server    (  AD)

DHCP Server   

File Server   ,  

Hyper-V  

Web Server (IIS)  - Microsoft

Remote Desktop Services   

   Server Manager ()  PowerShell.




: GUI, Server Manager  PowerShell


 Server Manager       .

 PowerShell    ,   Linux.   .

 Windows Admin Center   - .

 RDP      .




PowerShell:  Windows


PowerShell     cmd,    .   -:

Get-Service                       



Get-Service | Where-Object {$_.Status -eq "Running"}



Restart-Service -Name Spooler     



Get-Process                      



Get-EventLog -LogName System -Newest 20    



Get-WindowsFeature                



Install-WindowsFeature AD-Domain-Services    



Get-NetIPConfiguration            



Test-Connection 8.8.8.8           ping

:::note PowerShell   ,     (   bash). Get-Service | Where-Object {$_.Status -eq "Stopped"}  -  .    ,    .   Windows PowerShell   ,  bash  Linux. :::




  ()


Get-LocalUser                                    



New-LocalUser -Name "ivan" -Password (Read-Host -AsSecureString)



Add-LocalGroupMember -Group "Administrators" -Member "ivan"

       Active Directory ( 14),      .




  Windows Server


Get-NetIPAddress                 



New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.10 -PrefixLength 24 -DefaultGateway 192.168.1.1



Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 192.168.1.2

        Linux.




   


 :  services.msc  Get-Service/Set-Service  PowerShell.

 :   (Event Viewer)  System, Application, Security.  journalctl,     . Get-EventLog / Get-WinEvent  PowerShell.







Windows Update     (  WSUS    ),         .      ,        .    .




  


Windows Server   .   Microsoft   Evaluation- (180 )      .




   13


1.  Windows Server (Evaluation)  VM,   IP  PowerShell.

2.   PowerShell: Get-Service, Get-Process,   Where-Object.

3.   (, DNS  File Server)  Server Manager   Install-WindowsFeature.

4.         PowerShell.

5.  Event Viewer:      System  Application.




  


  PowerShell       .

    .

   Windows Update  .

     AD   .

  RDP   ( 11).




 14. Active Directory:  



Active Directory (AD)    Windows-.  ,    , ,   ,         .      AD   .




  Active Directory



   500   AD:    500     ,  , .     500 .  . AD  :

   (SSO):        .

  : , ,     .

 :    .

 :     .




 



 (domain)        

  (DC)     AD,  

 (forest)   :    

 (tree)      (child.company.local)

OU ()      ( )

 (group)      

GPO ( )    ,  

LDAP     

Kerberos     




:  ?  ? OU ? 



: company.local



: company.local



OU: 



OU: 



, 



OU: IT



OU: 

OU (Organizational Units)    ,      .  OU          .




  



# PowerShell  Windows Server



Install-WindowsFeature AD-Domain-Services -IncludeManagementTools



Install-ADDSForest -DomainName "company.local"

     .     DNS (AD  DNS      ).

:::note Active Directory    DNS.       DNS- (SRV).  DNS    AD   :  ,   ,   . :        DNS ( ),    (8.8.8.8).   90%   AD  . :::




  .


   .

   ,     (https://www.litres.ru/book/ivan-grom-34127812/sistemnoe-administrirovanie-s-nulia-74799923/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


