Mikrotik Script remote log

/system logging action
set 3 bsd-syslog=yes remote=10.0.0.10

/system logging
add action=remote topics=info,firewall,critical,ddns,dhcp,dns,error,info,debug,system,warning
add action=remote topics=pppoe,info
add action=remote topics=critical
add action=remote topics=error
add action=remote topics=info
add action=remote topics=warning
add topics=pptp,ppp,info
add action=remote topics=firewall,info

CentOS 7 + winbox.exe

#yum update && yum -y groupinstall 'Development Tools' && yum -y install libX11-devel libxml2-devel libxslt-devel freetype-devel flex bison mesa-dri-drivers.i686 mesa-libGL.i686 libX11-devel freetype-devel zlib-devel libxcb-devel libxml2-devel libxslt-devel libjpeg-devel gnutls-devel flex bison samba-winbind samba-winbind-clients samba-winbind-modules libwbclient-devel mod_auth_ntlm_winbindglibc-devel.i686 dbus-devel.i686 freetype-devel.i686 pulseaudio-libs-devel.i686 libX11-devel.i686 mesa-libGLU-devel.i686 libICE-devel.i686 libXext-devel.i...

CentOS 7 vsftpd FTP Server



# yum install vsftpd

# vim /etc/vsftpd/vsftpd.conf
  anonymous_enable=NO
  allow_writeable_chroot=YES
  chroot_local_user=YES

#systemctl enable vsftpd
#systemctl start vsftpd

Remover comentários de arquivos conf

#egrep -v "^#|^$" arquivo.conf > arquivo_sem_comentarios.conf

Debian 8 Setting Reverse Proxy With Apache2

Load modules

#a2enmod proxy
#a2enmod proxy_http

Reload Apache

#/etc/init.d/apache2 force-reload

Virtualhost Configuration

#cd /etc/apache2/sites-available/
#vi website

<VirtualHost *:80>
        ServerName website.no-ip.org
        ProxyPass       /       http://192.168.x.y/
        ProxyPassReverse        /       http://192.168.x.y/
</VirtualHost>


#vi websitehttps
<VirtualHost *:443>
        ServerName 		website.no-ip.org
        ProxyPass       	/       http://192.168.122.9:8080/guacamole/
        ProxyPass...

GET with wget

wget www.url.com
wget www.url.com /home/usuer/Downloads 
wget -r -erobots=off www.url.com

Debian 8 reset root password MySQL

# /etc/init.d/mysql stop 
# mysqld_safe --skip-grant-tables 
# mysql -u root 
mysql> use mysql;
mysql> update user set password=PASSWORD("new_password") where User='root'; 
mysql> flush privileges;
mysql> quit; 
# /etc/init.d/mysql stop 
# /etc/init.d/mysql start

URL Redirect

PHP

<?php header("location: http://www.dominio.com.br/"); ?>

HTML5

<meta http-equiv="refresh" content="0;url=http://www.dominio.com.br/pagina.htm">

Linux check memory

#dmidecode --type memory

        Memory Device
        Array Handle: 0x0007
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 8192 MB
        Form Factor: DIMM
        Set: None
        Locator: ChannelB-DIMM1
        Bank Locator: BANK 3
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1333 MHz
        Manufacturer: Kingston
        Serial Number: 7A23C804
        Asset Tag: 9876543210
        Part Number: 99U5471-047.A00LF 
        Rank: 2
        C...

Debian - Apache2 Páginas pessoais

#a2enmod userdir

A execução de scripts php está desativada nas páginas pessoais. Para a ativar, é necessário comentar a linha php_admin_value engine Off no ficheiro /etc/apache2/mods-available/php5.conf

service apache2 restart

$ mkdir ~/public_html

Fedora 23 Snapshot LVM Script

#!/bin/bash
# Creates a snapshot of the volume storing the KVM images, and then
# using that snapshot copies the images. The benefit of using a snapshot
# (as opposed to copying the images) is that the VM does not need to be
# shutdown.

# Include appropriate paths (since cron doesn't use your normal environment)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

# The date of the backup
bkpdate=`date +%Y-%m-%d`

# Create a LVM snapshot of the var LV
lvcreate -L 70G -s -n varsnap /dev/fedora_host/var

# Mount ...

Fedora 23 Snapshot LVM

[root@host ~]# lvcreate -L 70G -s -n varsnap /dev/fedora_host/var
Logical volume "varsnap" created.
[root@host ~]# 

[root@host ~]# lvremove -f /dev/fedora_host/varsnap
Logical volume "varsnap" successfully removed
[root@host ~]# 

Centos 7 install Google Chrome 49.0.2623.75 (64-bit)

vi /etc/yum.repos.d/google-chrome.repo

[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

yum install google-chrome-stable

Substituindo palavras no editor VI

%s/TextoAntigo/TextoNovo/g

Linux KVM how to fix a Error starting domain: Requested operation is not valid: network 'default' is not active

Error starting domain: 
Requested operation is not valid: network default is not active

Error starting domain: 
internal error Network 'default' is not active.

# virsh net-start default
# virsh net-autostart default

link

FreeBSD overwritten the MBR

You'll notice bsdinstall has overwritten the MBR without asking any questions during the install, so for a scary few minutes you won't be able to access Windows.

Login to root (or login with a user and su to root), and then bearing in mind you should replace 'ada0' with your HDD's device if different, execute

boot0cfg -B ada0

to install the bootselect code to the MBR.

Grub remove from Windows 7

Windwos 7
repair prompt
bootsect /nt60 ALL /force /mbr

FreeBSD HowTo

root@red:~ # portsnap fetch
root@red:~ # portsnap extract
root@red:~ # portsnap extract


root@red:~ # pkg install openssh-portable
root@red:~ # sysrc sshd=YES
root@red:~ # cp /etc/ssh/sshd_config{,.df}
root@red:~ # vi /etc/ssh/sshd_config
root@red:~ # service sshd restart
root@red:~ # ssh localhost
root@red:~ # passwd root

root@red:~ # pkg install apache24
root@red:~ # sysrc apache24_enable=YES
root@red:~ # vi /usr/local/etc/apache24/httpd.conf

DirectoryIndex index.php index.html

<FilesMatch "\.php$">
    SetHandler application/x-ht...

Listen open ports

OpenBSD

# netstart -nat

FreeBSD

# sockstat -4 -l
# sockstat -c
# sockstat -c -4
# sockstat -c -4 | grep ssh
# sockstat -c -4 | grep 22
# sockstat -4 -l | grep :22
# netstat -a -n | grep LISTEN
# netstat -a | egrep 'LISTEN|Proto|Active'
# netstat -a | egrep 'Proto|LISTEN'
# lsof -i :22

Linux

# netstat -ntulp
# lsof -i

Debian 7 AMD64 install SNMPD

aptitude install snmpd

cp /etc/snmp/snmpd.conf{,.df}

vi /etc/snmp/snmpd.conf

AGENT BEHAVIOUR
agentAddress udp:161,udp6:[::1]:161

ACCESS CONTROL
rocommunity undernetworks 172.20.20.20

service snmpd restart

netstat -ntul |grep 161

udp 0 0 0.0.0.0:161 0.0.0.0:*
udp6 0 0 ::1:161 :::*

Debian 8 64 Bits install wine

# dpkg --add-architecture i386
# apt-get update
# apt-get install wine-bin:i386 

$ winecfg
$ WINEARCH=win32 winecfg 

ipify A Simple IP Address API

https://www.ipify.org/

Ever needed to get your public IP address programmatically? Maybe you're provisioning new cloud servers and need to know your IP -- maybe you're behind a corporate firewall and need to tunnel information -- whatever the reason: sometimes having a public IP address API is useful!

Debian 8 AMD64 install Google Chrome Browser 46 Released

$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
$ sudo apt-get update
$ sudo apt-get install google-chrome-stable

Font:
Techmint

Debian 8 install isc-dhcp-server

#aptitude install isc-dhcp-server
Os NOVOS pacotes a seguir serão instalados:  
  isc-dhcp-server 
0 pacotes atualizados, 1 novos instalados, 0 a serem removidos e 0 não atualizados.
É preciso obter 381 kB de arquivos. Depois do desempacotamento, 863 kB serão usados.
Obter: 1 http://ftp.br.debian.org/debian/ jessie/main isc-dhcp-server amd64 4.3.1-6 [381 kB]
Buscados 381 kB em 0s (749 kB/s)        
Pré-configurando pacotes ...
A seleccionar pacote anteriormente não seleccionado isc-dhcp-server.
(Lendo banco de dados ... 33951 ficheiros ...