Loading...
 

Linux

Home

Linux Mint 13

  • Restart X-Server: CTRL+ATL+BACKSPACE
  • EVGA NVidia Geforce GT 240
    • XWindows freezes using the Live CD because of the video card.
      • When booting up the Live CD, select the 1st menu option and press Tab.
      • User cursor keys to get before "quiet splash".
      • Add text NOMODESET.
      • XWindows will work, but in reduced mode, so the menu button in the bottom left isn't as fully functioning.
      • Need to enable the NVidia private drivers to get the full experience.
        • Menu -> Preferences -> Software Sources
        • Tab: Additional Drivers
  • GRUB 1.99
    • Sector 32 is already in use by FlexNet
      • Backup of the first 63 sectors
        Copy to clipboard
        sudo dd if=/dev/sda of=~/first_63_sectors bs=512 count=63
      • erase Sector 1 through Sector 62
        Copy to clipboard
        sudo dd if=/dev/zero of=/dev/sda bs=512 count=62 seek=1
      • Source: http://ubuntuforums.org/showthread.php?t=1661254
  • Disk Utility
    • Error doing BLKPG ioctl with BLKPG_ADD_PARTITION for partition 1 of size 32256 at offset 233178430464 on /dev/sda: Device or resource busy
    • This seems to be from Disk Utility. I partitioned with GParted and everything ran smoothly.
  • Nautilus
    • Breadcrumbs
      • Changing this setting through gconf-editor does not take effect, but changing through the command line does, though both are the same setting.
      • GUI:
      • Command line:
  • Install a library
    • usually you add "-dev" to the library name and do an apt-get
      • For libusb library do $ sudo apt-get install libusb-dev
  • Notifications
  • Dropbox
    • Get from dropbox's website instead of the Software Manager package
    • After the .deb installs, run Menu -> Internet -> Dropbox to finish downloading package
    • After this, it will start the daemon

SSH Server

  • Install:
    Copy to clipboard
    apt-get install openssh-server
    • Settings file: /etc/ssh/sshd_config
  • Restart
    • older:
      • Copy to clipboard
        /etc/init.d/ssh restart
    • newer:
      • Copy to clipboard
        sudo service ssh restart
  • Check if SSH service is running
    • Copy to clipboard
      sudo systemctl status ssh
  • Securing SSH With Iptables
    • Copy to clipboard
      $ sudo iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource $ sudo iptables -N LOG_AND_DROP $ sudo iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --name DEFAULT --rsource -j LOG_AND_DROP $ sudo iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT $ sudo iptables -A LOG_AND_DROP -j LOG --log-prefix "iptables deny: " --log-level 7 $ sudo iptables -A LOG_AND_DROP -j DROP $ sudo aptitude install iptables-persistent
    • Create file: /etc/rsyslog.d/iptables.conf
      • Copy to clipboard
        :msg,contains,"iptables deny: " /var/log/iptables.log & ~
    • Create file: /etc/logrotate.d/iptables
      • Copy to clipboard
        /var/log/iptables.log { rotate 7 daily missingok notifempty delaycompress compress postrotate invoke-rc.d rsyslog reload > /dev/null endscript }
    • http://blog.bigdinosaur.org/securing-ssh-with-iptables/
    • https://linuxize.com/post/how-to-enable-ssh-on-ubuntu-20-04/


 

Apache

  • Restart:
    Copy to clipboard
    sudo /etc/init.d/apache2 restart

 

Google Chrome

  • Copy to clipboard
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - echo deb http://dl.google.com/linux/chrome/deb/ stable main | sudo tee -a /etc/apt/sources.list.d/google.list sudo apt-get update && sudo apt-get install google-chrome-stable

 

PhpMyAdmin

  • Using the software installation, the configuration might not be done:
    • If /var/www/phpmysqladmin/ does not exist, then it did not run through setup
    • Run setup with:
      Copy to clipboard
      $ sudo dpkg-reconfigure -plow phpmyadmin
  • Directory location:
    • Apache config is /etc/apache2/apache2.conf has "Include conf.d/"
    • conf.d/ has phpmyadmin.conf that gets included
    • phpmyadmin.conf has "Alias /phpmyadmin /xxxx" which is location of website files
  • If PhpMyAdmin gives error: Login without a password is forbidden by configuration (see AllowNoPassword)
    • Best to change root password
    • Can also set phpMyAdmin to allow accounts without a password:
      • edit: /etc/phpmyadmin/config.inc.php
      • Uncoment line: $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

 

find

  • the errors for "Permission denied" are output to the error console, not the regular console, so you get rid of them using error redirection, not grep
    • Copy to clipboard
      $ find / -name passwords.txt 2>/dev/null
  • Gimp

 

Java

  • Remove OpenJDK
    • Copy to clipboard
      sudo apt-get purge openjdk*
  • Install Oracle JDK
    • Copy to clipboard
      sudo add-apt-repository ppa:webupd8team/java sudo apt-get update && sudo apt-get install oracle-java7-installer

 

Screenshots

 

Make Linux use local time instead of UTC

  • edit /etc/default/rcS
  • Set UTC=yes if your hardware clock is set to UTC (GMT), or UTC=no to have the hardware clock set to local time.

 

Show All Running Processes in Linux

 

Clonezilla

  • Restoring partition image to a different partition
    • The original partition device name is saved with the image files:
      • The partition name is stored in the file: [partition folder]/part
      • The partition name is part of the file name for all the image files
    • Just change the name of the partition in the file [partition folder]/part
    • Rename all the image files with the new partition name
    • I saved the partition from /dev/sda6, and needed to restore it to /dev/sda9
      • Old [partition folder]/part:
        • Copy to clipboard
          $ cat part sda6
      • New [partition folder]/part:
        • Copy to clipboard
          $ cat part sda9
      • Old file names:
        • Copy to clipboard
          $ ls sda6* sda6..aa sda6..ab sda6..ac
      • New file names:
        • Copy to clipboard
          $ ls sda9* sda9..aa sda9..ab sda9..ac
      • I used vi to edit [partition folder]/part
      • I used nano to write a bash script:
        • Copy to clipboard
          for $item in sda6* do item2=${$item/sda6/sda9} mv $item $item2 done

 

NginX

  • How to set up a safe and secure Web server
    • http://arstechnica.com/gadgets/2012/11/how-to-set-up-a-safe-and-secure-web-server/

 

Pogoplug Arch Linux for ARM

  • check file system
    • umount the drive and run e2fschk -y -f /dev/sdxn (sdxn will probably be sdb1)
  • Install on POGO-E02 and POGO-E02G (Pink model)
    • http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray
  • The boot loaders are in NAND
  • To recover from power outage:
    • format & extract the latest rootfs tarball, as root (not! sudo, but sudo su if necessary), onto your USB drive
    • Label partition "rootfs"
      Copy to clipboard
      'tune2fs -L "rootfs" /dev/sdX#

 

VirtualBox

  • Extension Pack
    • You have to download the Extension Pack from the VirtualBox website manually
    • There isn't a package for this
  • Guest Additions
    • The .iso file to run inside the virtual machine
    • There is a linux package for this
  • Shared Folders
    • Machine (permanent) shared folders that exist before the machine is started
      • Mounted in /media/sf_NAME
      • Folder name is prepended by sf_
      • Owner is root, Group is vboxsf
    • Transient shared folders, and machine shared folders created while the machine is running
      • Need to mount with: mount -t vboxsf -o uid=XXX SHARE MOUNTPOINT
      • Using gid option didn't work for me
      • You can mount them anywhere
      • Name is as is
      • Without the -o option, owner is root, group is root, and can't be changed with chown or chmod
      • Use linux command id to find out id numbers for users

 

Samba

  • Installing Samba
    • http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-raspberry-pi-file-server/

 

Wake On Lan (WOL)

Sending WOL packet

etherwake

Receiving WOL packet

ethtool

  • Find specific network adapter
    • Copy to clipboard
      ifconfig
  • If ifconfig is not installed, install with:
    • Copy to clipboard
      sudo apt install net-tools
  • Check to see if wake-on-LAN is available on your NIC with ethtool
    • Copy to clipboard
      sudo ethtool eth0
  • Look for this line, and the letter "g" to know your card supports WOL
    • If not there, might just need to turn on in BIOS
    • Copy to clipboard
      Supports Wake-on: pumbg
  • Enable the system for Wake-On-LAN
    • Copy to clipboard
      sudo ethtool -s eth0 wol g
  • Need to enable it at every boot
    • Ubuntu:
      • Create a system service
        • Copy to clipboard
          sudo nano /etc/systemd/system/wakeOnLAN.service
      • File contents:
        • Copy to clipboard
          [Unit] Description=Re-enable WOL [Service] Type=oneshot ExecStart=/sbin/ethtool -s eth0 wol g [Install] WantedBy=basic.target
      • Enable the service
        • Copy to clipboard
          sudo systemctl enable wakeOnLAN.service

 

Network Scan

nmap

  • Install
    • Copy to clipboard
      sudo apt-get install nmap
  • Run
    • Copy to clipboard
      sudo nmap -sP 192.168.0.0/24 | awk '/Nmap scan report for/{printf $5;}/MAC Address:/{print " "$3;}'

Disk Free Space

df (command line)

  •  df = "disk-free," available and used disk space
    •  df -h = human readable format

Disks (GNOME GUI)

  •  gnome-disk-utility

du (command line)

  •  du = disk usage of files, folders
    •  du -h = human readable format
    •  du -s = total disk space of a particular file or directory

Disk Usage (GNOME GUI)

Xubuntu

VNC Gray Screen

Login screen loop

  • Keeps going back to login screen after logging in
    • At login screen, drop to console with CTRL+ALT+F3
    • login
    • check if .Xauthority is properly assigned to you
      • Copy to clipboard
        ls -lah | grep -i Xauthority
    • if assigned to root, that is the problem
      • Copy to clipboard
        sudo chown username:username .Xauthority
    • go back to login gui with CTRL+ALT+F7
    • https://www.maketecheasier.com/fix-ubuntu-login-loop/

VNC

Error "timeout in locking authority file .Xauthority"

Error "exit status 217"

Error "no matching security types"

  • There isn't a standard for encryption. RealVNC has proprietary encryption from the server. Opensource projects don't have that.
  • Either use RealVNC Viewer, or turn off the encryption:
  • Edit file:
    • Copy to clipboard
      /root/.vnc/config.d/vncserver-x11
      • Copy to clipboard
        Authentication=VncAuth Encryption=AlwaysOff Password=e0fd0472492935da
    • Then reset the password:
      • Copy to clipboard
        sudo vncpasswd -service
    • When using the RealVNC client, you will get the warning that the connection is not secure.
  • https://superuser.com/questions/1194583/tigervnc-viewer-no-matching-security-types

Install VNC

SSH to VNC

 

APT

Alternatives

Nala

  • https://gitlab.com/volian/nala
  • https://www.youtube.com/watch?v=oroSkR4Nn_w

 

Ubuntu

Lid Close Behavior