Linux

Secure erase - using hdparm

HD, SSD should be connected directly to the controller, not USB bridge or hardware RAID controller.

Use live Linux CD or USB with hdparm installed. CentOS 7 does not contain it so you can install hdparm with:

yum install hdparm -y

Boot to Linux and run the following commands as root (can use sudo if needed):

fdisk -l (then determine what disk should be sanitized, sda or sdb, etc.)

Installing Unifi Controller on Linux

The process is nicely described on Unifi website but for common good I am going to minimize it just to a set of commands you can run on Linux distros like Debian or Ubuntu:

  1. echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

  2. sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg or you can also do: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50

  3. sudo apt-get update

Redirecting to https with .htaccess


<ifmodule mod_rewrite.c=""> 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
</ifmodule>

 

Redirecting folder to https version

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} yourfolder
RewriteRule ^(.*)$ https://www.yourdomain.com/yourfolder/$1 [R,L]

Ubuntu 12.04 resetting root access

  • Reboot
  • hold SHIFT
  • select your inage on Grub menu
  • press "e" to edit
  • in the line starting with "linux" add int=/bin/bash to the very end
  • ctrl+x to reboot
  • your system will boot to passwordless root shell
  • mount -o remount,rw / (make your partition writable)
  • some people do: chmod 640 /etc/shadow file other just copy: cp /etc/shadow- /etc/shadow to eliminate it from th game
  • analyze what you have by: less /etc/passwd
  • determine what needs to be changed by: passwd USER

Ubuntu accessible from Windows network by a hostname

Scenario:

  • Ubuntu server installed as a virtual machine and connected via bridged network adapter to a network
  • pinging and services are accessible from Windows machines only by IP address, no name resolving, no DNS server on duty, just NetBIOS names
  • can't ping Windows hosts from Ubuntu by their host names either

Resolution:

  • on Ubuntu server: sudo apt-get install samba (then you can ping and access services on Ubuntu from Windows hosts by a hostname)
  • to be able to ping Widows hosts from Ubuntu you need t

Ubuntu Server - granting permissions to /var/www

Some of you might fall into this annoyance when freshly installed Linux with Apache2 does not allow you to upload files to www directory. Below is a quick fix. sudo groupadd www sudo useradd -g www sudo chown -R :www /var/www sudo chmod -R g+rwX /var/www sudo chmod g+s /var/www You create a new group, you add a user into this group, you assign the ownership to the new group and you finally ensure that files created in this folder will be owned by the group.

Subscribe to Linux