Posts

Linux_Users' accounts (creation, permissions, editing)

# sudo lid -g wheel list of users with sudo-permissions # cat /etc/passwd list of users # sudo adduser username # passwd username # usermod -aG wheel username Creation user and provide him sudo-permissions #sudo username -l newuser olduser Rename user #userdel username #userdel -r username Delete user and his home-directory -------------------------------------------------------- Other way: login to root: #su #visudo (opens file with editing user's sudo) Copy there root user line (in  ## Allow root to run any commands anywhere)  and past it with other username: root    ALL=(ALL)       ALL NewUserName    ALL=(ALL)       ALL :x (to save and exit)

PowerCLI

Get-VMHostNetworkAdapter | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec | Export-Csv C:\VMHostNetworkDetails.csv Get-VM | Export-Csv C:\VMHostNetworkDetails.csv C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -NoExit -Command C:\first.ps1 Get-VM | Export-Csv -path “ c:\reports\vminventory.csv ”  Get-VM | select Name, Description, PowerState, NumCpu, MemoryGB | Export-Csv -path “ c:\reports\vminventory.csv ” Get-VM | Select Name,@{N='IP';E={[string]::Join(',',$_.Guest.IPAddress)}} get-vm | select Name,@{N="IP Address";E={@($_.guest.IPAddress[0])}} | out-file c:\VM_IP_Addresses.csv get -vm | get -view | where {$_.Guest.GuestFullName -like "*Windows*" } | select Name,@{N= "OS" ;E={@($_.Guest.GuestFullName)}},@{N= "IP" ;E={@($_.Guest.IPAddress)}} | exp...

SMB_new

yum install samba samba-client samba-common vim -y mv /etc/samba/smb.conf /etc/samba/smb.conf.bak vim /etc/samba/smb.conf ------------------------------------------ [global]    workgroup = WORKGROUP    server string = Media Server    security = user    map to guest = Bad Password    log file = /var/log/samba/%m.log    max log size = 50    hosts allow = 192.168.1.131 192.168.1.135    dns proxy = no [storage]    path = /media/storage    public = yes    only guest = yes    writable = yes --------------------------------------------- mkdir -p /media/storage systemctl enable smb.service systemctl enable nmb.service systemctl restart smb.service systemctl restart nmb.service firewall-cmd --permanent --zone=public --add-service=samba firewall-cmd --reload # chmod -R 0755 /media/storage/ # chown -R nobody:nobody /media/storage/ # chcon -t samba_s...

WEB_server_centos7

Проверяем утановлен ли пакет и его статус: #systemctl staus httpd Если нет - устанавливаем пакет: #yum -y install httpd Активируем сервис #systemctl enable httpd.service Бэкапим файл и удаляем исходник #cp /usr/share/httpd/noindex/index.html /usr/share/httpd/noindex/index.backup.html #rm -f /usr/share/httpd/noindex/index.html Создаем новый файл и записываем в него  #vim /usr/share/httpd/noindex/index.html <html> <header><title>This is new page</title></header> <body> Welcom to Security </body> </html> Перезапускаем службу # apachectl restart Добавляем исключения в firewall: #firewall-cmd --permanent --add-port=80/tcp #firewall-cmd --permanent --add-port=443/tcp #firewall-cmd --reload Теперь если мы с другого хоста откроем http://192.168.1.30 (ip хоста, который мы только что настраивали) то увидим страничку которую создали PS если win7 explorer попал на firewalld, страницу не открывает, если установит...

WEB_Server_Win10_IIS

Image
1) Включаем сервис IIS в Windows features 2) открываем директорию C:\inetpub\wwwroot 3) создаем на рабочем столе тхт файл с содержанием: < html > < header > < title > This is new page </ title > </ header > < body > Welcom to Security </ body > </ html > 4) сохраняем как iisstart.htm 5) старый файл удаляем (убираем в другую папку) и копируем новый 6) в браузере открываем: http://localhost 7) если мы теперь с другого хоста в браузере откроем ip этого хоста, то увидим страничку приветствия (перед этим проверить пинг и отключить firewall)

SFTP

Start the SSHD service and ensure it starts with the server # systemctl enable sshd.service # systemctl start sshd.service 2 Setup the SSH Deamon - some VI knowledge required # vi /etc/ssh/sshd_config Comment the following line (add a hash before it) Subsystem sftp /usr/local/libexec/sftp-server and add the following just below it, I recommend using tab instead of spaces Subsystem sftp internal-sftp Now scroll to the end of the config file and add the following to create the match rule: Match Group sftponly ChrootDirectory %h ForceCommand internal-sftp X11Forwarding no AllowTcpForwarding no Save the config file and close it. (Press ESC and type 'wq!') 3 Reload the SSH Deamon # systemctl restart sshd.service 4 Let's add the user(s) and group (I used John as an example): # groupadd sftponly # useradd john -g sftponly -s /bin/false # passwd john 5 Add folders (for the user to read and write data from): # mkd...

Создание VM в Vsphere

Image