cyberlabs.us | home | subscribe | contact | admin
Monday, July 7th  
| comments  
Ubuntu: Basics

Ubuntu: Basics
Informational

-version

lsb_release -a

#--------------

-tftpd

$ sudo apt-get install xinetd tftpd tftp

-Create /etc/xinetd.d/tftp and put this entry

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}

-Create a folder /tftpboot  this should match whatever you gave in server_args. mostly it will be tftpboot

$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot

-Restart the xinetd service.

$ sudo /etc/init.d/xinetd stop
$ sudo /etc/init.d/xinetd start

#--------------

-ufw disable

sudo ufw disable

-To again enable firewall write/paste the following command-

sudo ufw enable

#--------------

Open your /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address 10.0.0.41
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.1
    dns-nameservers 10.0.0.1 8.8.8.8
    dns-domain acme.com
    dns-search acme.com

ifdown eth0; ifup eth0

#--------------

Create an user with empty password

sudo useradd test-user-0

echo test-user-0:U6aMy0wojraho | sudo chpasswd -e

su test-user-0

The password prompt will still show up. If you just hit enter without typing anything, it will login as the user test-user-0.

The -e flags tells chpasswd that the password is already encrypted, and U6aMy0wojraho is the hash of the empty string.

#--------------

Use the usermod command to add the user to the sudo group.

usermod -aG sudo username

#--------------

Run sudo without entering a password
# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD: ALL

#--------------

How to enable ssh root access:

Simply adding a password for root is not enough for Ubuntu 14.04 Server.

You also need to edit /etc/ssh/sshd_config, and comment out the following line:

PermitRootLogin without-password
Just below it, add the following line:

PermitRootLogin yes
Then restart SSH:

service ssh reload

For Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-59-generic x86_64)

PermitRootLogin without-password has been replaced by PermitRootLogin prohibit-password.

#--------------

Display Current Hostname

# hostnamectl

#--------------

Change Hostname

# hostnamectl set-hostname linuxize

Edit the /etc/hosts file, if the cloud-init packages is installed, you will also need to edit the cloud.cfg file. Search for preserve_hostname and change the value from false to true.

#--------------