Thursday, July 10, 2014

How to set static IP and set my DNS in Ubuntu Server 14.04

If you try to edit /etc/resolv.conf as most information on internet suggest, your information will be overriden after reboot. To change DNS modify file:

sudo nano /etc/resolvconf/resolv.conf.d/base

Just add the same lines like in resolv.conf:

nameserver 8.8.8.8 #ip of your DNS server

then update resolv.conf:

sudo resolvconf -u

after that /etc/resolv.conf should contain your DNS ip.

To change ip address to static edit /etc/network/interfaces:

sudo nano /etc/network/interfaces

find and comment default dhcp entry. Next add lines to your config file like below:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0

# DHCP not needed
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.254


then disable/enable network interface

sudo ifdown eth0 && sudo ifup eth0

Wednesday, July 9, 2014

How to grant root privileges in ubuntu for existing user

You need to add user to the "sudo" group. If you already created user "test" add user to the "sudo" group by issuing this command in terminal:

sudo usermod -a -G sudo test

check that ssh daemon is running:

sudo service ssh status

if firewall activated, add rule to allow ssh:

sudo ufw allow ssh