Thursday, August 24, 2017

Can not use LAN after upgrad Ubunu 16.04 to 17.04

Edit file /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf


keyfile]
unmanaged-devices=*,except:type:wifi,except:type:wwan

To

[keyfile]
unmanaged-devices=*,except:type:ethernet,except:type:wifi,except:type:wwan


sudo service network-manager restart

Ref:
ethernet-adapter-was-disable-on-ubuntu-17-04

Sunday, August 20, 2017

Places & Files indicator

Install Places on top linux desktop

sudo add-apt-repository ppa:vlijm/placesfiles
sudo apt-get update
sudo apt-get install placesfiles

Ref: places-indicator-menu-ubuntu-system-tray

Thursday, August 10, 2017

Disable selinux on Centos 7 and set firewall-cmd

CentOS7

1.check status selinux enable or disable

#sestatus
#vim /etc/sysconfig/selinux
SELINUX=disabled

and Reboot system

ถ้าปิด Selinux ผิดจะขึ้น Error แบบนี้ : failed to load selinux policy freezing

วิธีแก้ไข
ในหน้าบู๊ด ให้กด e แล้วมองหา linux16 แล้วเพิ่ม selinux=0 เข้าไป แล้ว ctrl+x เพื่อเข้าสู่ระบบ จากนั้นไปแก้ไขค่า
SELINUX=disabled ตามข้อมูลด้านบน

Go to the main command (usually starting with “linux16” or something similar) and add “selinux=0” as one of the parameters:

Ref: selinux policy freezing

Ref: disable-selinux-temporarily-permanently-in-centos-rhel-fedora/

2. Enable / Disable service
- SAMBA

systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service

Restatr/Reload service
systemctl reload smb.service
systemctl restart smb.service

Check service runnig
systemctl list-unit-files
chkconfig --list |grep ชื่อของ service
systemctl
systemctl | more
systemctl | grep httpd
systemctl list-units --type service

systemctl list-units --type service |grep ชื่อของ service
systemctl list-units --type mount

  
example:
systemctl | grep smartd

View service running
systemd-cgtop


- IPTABLES
systemctl stop firewalld
systemctl mask firewalld
yum install iptables-services
systemctl enable iptables
systemctl start iptablesmkdir
service iptables save

- iptables command
-A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

Check filrewall running ?
firewall-cmd --state systemctl status firewalldSet firewalld
List service on zone public
firewall-cmd --zone=public --list-all
List only port
firewall-cmd --list-ports


Add service
# firewall-cmd --zone=public --permanent --add-service=samba
# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --reload
Remove service


#firewall-cmd --zone=public --remove-service=http

Add Port

firewall-cmd --zone=public --permanent --add-port=10000/tcp
firewall-cmd --zone=public --permanent --add-port=2500-2600/tcp


Delete port
firewall-cmd --remove-port=6161/tcp
firewall-cmd --zone=public --permanent --remove-port=10000/tcp
firewall-cmd --zone=public --permanent --remove-port=2500-2600/tcp

Save firewall
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
firewall-cmd --get-services 
 

Ref: https://www.centos.org/forums/viewtopic.php?t=61108
Ref: quick-docs firewalld
Ref: firewall-cmd config

Wednesday, August 2, 2017

List of dangerous shell commands

1. rm -rf /
2. :(){ :|: & };:
3. mkfs /dev/sda1
4. cat /dev/zero > /dev/sda1
5. wget url -O - | sh --
6. curl url | sh
7. dd if=/dev/zero of=/dev/sda2
8. echo 726d202d7266202a | xxd -r -p
9. dd if=/dev/random of=/dev/port
10. echo 1 > /proc/sys/kernel/panic
11. cat /dev/port or cat /dev/mem
12. cat /dev/zero > /dev/mem
13. sudo chmod -r 444 / or sudo chown -r nobody:nobody /
14. last | reboot