Skip to content

Recent Articles

10
Feb

My Ubuntu 16.04 Networking is configured but I cannot find config files

If your Ubuntu machine has networking configured but there’s nothing in: /etc/network/interfaces (maybe only loopback interface is configured there) and there’s no file in /etc/network/interfaces.d then maybe the network was configured via Ubuntu’s GUI (Network Manager).

In that case the config file is located in /etc/NetworkManager directory.

10
Feb

Configure Networking in Ubuntu 16.04 Server

One way on some Ubuntu versions was to edit /etc/network/interfaces and add the the configuration of network interface. On Ubuntu 16.04 I’ve don the following setup:

# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

And then we create a file in /etc/network/interfaces.d called enp0s3:

# cat enp0s3
auto enp0s3
iface enp0s3 inet static
  address 10.0.0.211
  broadcast 10.0.0.255
  netmask 255.255.255.0
  post-up route add default gw 10.0.0.1
  pre-down route del default gw 10.0.0.1
 
dns-nameservers 10.0.0.1
10
Feb

Configure Networking in OpenSUSE Linux with manual IPv4

Here is a Quick Guide to configure networking in OpenSUSE Linux using manual IPv4.

First let’s see where config files are located.

# ls /etc/sysconfig/network/ifcfg-*
/etc/sysconfig/network/ifcfg-eth0  /etc/sysconfig/network/ifcfg-lo
linux-t003:/home/ovi #

Edit /etc/sysconfig/network/ifcfg-eth0 file and add:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.1.31/24'
MTU=''
NAME='82540EM Gigabit Ethernet Controller'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'

Edit /etc/sysconfig/network/routes file and add:

default 10.0.1.1 -	-

Edit /etc/resolv.conf and add:

nameserver 10.0.1.1

Then we need to restart network service:

service network restart
24
Oct

Rename Multiple Files in Linux

To rename multiple files in Linux run from the command line:

for f in *.cc; do mv -- "$f" "${f%.cc}.cpp"; done

Previous command will rename all .cc files into .cpp files.

Note: It will not work recursively. To rename recursively use the following command:

find ./ -type f -exec rename 's/.mm/.cpp/' '{}' \;
25
Apr

Add an user to Ubuntu Linux from command line

If you want to add an user to your Ubuntu Linux machine here is what you need to do. Login as root (or use sudo) and then run (as root):

useradd -d /home/john -m john
passwd john
usermod -aG sudo john

If you are not root run:

sudo useradd -d /home/john -m john
sudo passwd john
sudo usermod -aG sudo john

In our example john is the user we want to add. Last command (usermod) will allow our user to run root commands via sudo.

25
Apr

Becoming root on Ubuntu Linux

If you are using Ubuntu Linux you’ve logged in as an user. If you want to become root so you won’t have to input sudo on every command you run, here’s what you need to do:

sudo su

or

sudo su -

which is probably what you really want. su – will invoke a login shell after switching the user. Just running su with no parameters will just switch the user (keeping the old shell and environment variables).

You can also run:

sudo -i

Then you get the root prompt and you will be able to run any command as root.

25
Apr

Dealing with “Bad: new password is too simple” issue on Ubuntu Linux

Let’s say you’ve booted with Live Ubuntu CD/DVD and you want to change the password of your user which is called ubuntu on Live Ubuntu CD/DVD. If you run:

passwd

you might get an error like:

You must choose a longer password

or:

Bad: new password is too simple.

You can bypass those checks by running passwd as a root with sudo:

sudo passwd

That way you will be allowed to enter short or too simple passwords which sometimes you need for testing purposes. Of course you will not use such passwords on machines connected to the internet but maybe only on test machines, maybe in virtualized environments.

24
Apr

Installing VirtualBox Guest Additions on Ubuntu Linux Guest

If you want to install VirtualBox Guest Additions on Ubuntu Linux Guest here what you need to do.

First go to VirtualBox -> Devices and click on Insert Guest Additions CD Image.

From the terminal look where the image is mounted. Usually it is under:

/mnt/username/VBOXADDITIONS_5.0.18_10667

where username is your username used to login to your machine.

Then we need to install some packages:

sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)

Then we run the script from the CD image:

cd /mnt/username/VBOXADDITIONS_5.0.18_10667
sudo ./VBoxLinuxAdditions.run

You need to run this script after every kernel update.

24
Apr

Fixing: apt-get install mc is not available error on Ubuntu

So you’ve just installed Ubuntu 16.04, you’ve configured networking and it works properly but when you want to install Midnight Commander (or other package) you get an error:

apt-get install mc is not available

To fix the problem run first apt-get update command:

sudo apt-get update

Then try to install mc:

sudo apt-get install mc

Of course there could be other reasons (like your /etc/apt/sources.list file missing or containing wrong links to package repos) but on a default Ubuntu installation this could fix the problem).

24
Apr

Install VirtualBox Guest Aditions on CentOS 7 Linux Guest

If you want to be able to move your mouse cursor outside the VirtualBox CentOS Guest window without pressing a key and also automatically scale CentOS Guest window you need to install VirtualBox Guest Aditions on your CentOS Guest.

In order to do that run:

yum install dkms
yum install kernel-devel

Then add the cd from VirtualBox (Devices -> Insert Guest Aditions CD image). If you are using a window manager (like for example Mate) the iso will be mounted in /run/media where we can find the install script:

cd /run/media/root/VBOXADDITIONS_5.0.18_106667/
./VBoxLinuxAdditions.run