Difference between revisions of "Ubuntu"

From Athenaeum
Jump to: navigation, search
(Random Info)
(Random Info)
Line 11: Line 11:
  
 
----
 
----
 
+
*Increase SSH timeout to 24 hours
 +
<pre>ClientAliveInterval 120
 +
ClientAliveCountMax 720</pre>
 
*Remove host keys
 
*Remove host keys
:<pre>rm /etc/ssh/ssh_host_*</pre>
+
<pre>rm /etc/ssh/ssh_host_*</pre>
 
*Generate new ones
 
*Generate new ones
:<pre>dpkg-reconfigure openssh-server</pre>
+
<pre>dpkg-reconfigure openssh-server</pre>
  
 
----
 
----

Revision as of 13:51, 11 February 2019


Random Info

List of Releases 100% Ram Usage


  • Reconfig an interface
service network-interface restart INTERFACE=eth1

  • Increase SSH timeout to 24 hours
ClientAliveInterval 120
ClientAliveCountMax 720
  • Remove host keys
rm /etc/ssh/ssh_host_*
  • Generate new ones
dpkg-reconfigure openssh-server

Cool font: Bitstream Charter


  • Fix Ubuntu's misconfigured network wait. Edit and change 5min to 15sec:
/etc/systemd/system/network-online.targets.wants/networking.service

Minimal Install

Note: It may be better to simply run aptitude -R install ubuntu-desktop.

  1. Install via Expert Mode and when you reach the task selector, choose only openssh and then continue.
  2. The packages you will need in order to have a basic Unity desktop are:
  • unity
  • unity-greeter
  • ubuntu-artwork
  • gnome-session
  • xorg
  • graphic's drivers
  • notify-osd
  • gdebi

RAM Saving Tips

PKG Management

  • GPG key for extras.ubuntu.com
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3E5C1192
  • Search for held packages
aptitude search ~ahold

12.04 Sources.list

  • This is every repo you'll need for a normal ubuntu installation.
###### Ubuntu Main Repos
deb http://demandgig.nexus.lan/repos/ubuntu/ precise main restricted universe multiverse 

###### Ubuntu Update Repos
deb http://demandgig.nexus.lan/repos/ubuntu/ precise-security main restricted universe multiverse 
deb http://demandgig.nexus.lan/repos/ubuntu/ precise-updates main restricted universe multiverse 
deb http://demandgig.nexus.lan/repos/ubuntu/ precise-backports main restricted universe multiverse 

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main

Networking

  • The file /lib/udev/rules.d/75-persistent-net-generator.rules explains why Ubuntu handles network adapters so well.
  • Best way to restart networking in 14.04 until the bug "feature" is fixed.
(ifdown eth0 ; ifup eth0) & or ifdown eth0 & sleep 5 & ifup eth0
  • Example network config
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com sales.example.com
dns-nameservers 192.168.3.45 192.168.8.10

Kernels

Kernel Install

Via Apt

  • There are two main packages needed to install or upgrade a kernel
  1. The image will install the actual kernel
  2. The headers will allow other packages to build modules against it
  • aptitude install linux-image-{server/generic}-{kernel type and name} linux-headers-{server/generic}-{kernel type and name}

Via DPKG

  1. Download headers, headers-generic and image from the Ubuntu Kernel Devs.
  2. Download the most recent linux-firmware from the Kernel Firmware Repo.
  3. Install via dpkg -i *.deb

Kernel Removal

Don't forget to turn the safety off when you're ready to run these commands.

Ubuntu:

dpkg -l linux-headers-* linux-image-* linux-signed-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep  -e '[0-9]' | xargs aptitude purge

User Management

List Users

  • View password status for all accounts
    • grep "/bin/bash" /etc/passwd | cut -d : -f1 | xargs -l passwd -S
  • View password status for all accounts that have home folders
  1. grep /home /etc/passwd | cut -d : -f1 | xargs -l passwd -S > ./user
  2. grep /bin/bash /etc/passwd | cut -d : -f1 | xargs -l passwd -S >> ./users
  3. sort ./users | uniq -d

Create A New User

1. Create the new user and set their initial password.

adduser {username}
  • The details are optional and can be left blank

2. If the user needs admin rights, add them to the admin group.

  • 10.04
usermod -a -G admin {username}
  • 12.04
usermod -a -G sudo {username}

3. (Optional) Force a password change at next log on.

chage -d 0 {username}

Delete a User

1. (Optional) Search for files owned by the user.

find / -user {username} -iname "*"

2. Delete the user's account and home folder.

userdel -r {username}

Recovery

GRUB

Add the following to /etc/default/grub to increase console resultion.
In ESXi 6.5 with Ubuntu 16.04 I had to disable quiet and splash kernel args in order to avoid a black screen.

GRUB_GFXMODE="1152x864x32"
GRUB_GFXPAYLOAD_LINUX=keep


Let's say, for a moment, that you needed to re-install windows (because that happens sometimes) but don't want to re-install Ubuntu in the process. Good news is you don't have to.

1. Boot into a live CD or live USB environment. Technically, you just need a live linux environment, but it's easiest with the Ubuntu live session.

2. Mount your boot partition in /mnt. If your boot and root partitions are different, mount them both. Not sure this is technically required, but boot is certainly required.

3. Install grub back to the MBR of the BIOS boot drive. It's safe to install to all drives if you don't know which drive your BIOS boots from. Replace the X below with your desired drive letter.

grub-install --boot-directory=/mnt/boot /dev/sdX

4. If you've modified the partitions in any way you'll need to run update-grub (only available in Ubuntu).