≡ Menu

critical files

Ubuntu Linux Restore admin / root level permissions

I was writing and testing few python scripts (yes I'm moving lot of stuff from shell / perl to python these days) and accidentally I renamed my own user account from vivek to test. However, I did not noticed change until I rebooted my box. Now I cannot run sudo (or become a root user) and cannot access special devices such as sound or video.

By default your first account has all power via sudo under Ubuntu Linux. There is a special group called adm and admin which grants unlimited power via sudo.

The only solution was to boot computer in emergency mode (reboot computer and at grub menu select recovery mode kernel), open /etc/group file and add user vivek to admin and adm group:
# vi /etc/group
Add user vivek to admin and adm group:
admin:x:117:vivek
adm:x:4:vivek

Save and close the file.

Now I'm able to run sudo and do other stuff. Luckily, my scripts always backup critical files before modification. So I was able to restore permission instantly. Here is my group membership with all power and glory ;)
$ id
$ groups

Output:

vivek adm dialout cdrom floppy audio dip video plugdev scanner netdev lpadmin powerdev admin

Force vmware to configure a network interface

This is funny but true. System developer updated the system including libc and other critical files. After upgrading system, they just rebooted the system and everything worked fine except VMWARE networking. Since they skipped the Linux kernel upgrade, VMWARE workstation was coming up but vmnet1 was not starting for some weird reason.

First, I restarted vmware service:

# /etc/init.d/vmware restart


Output:

Stopping VMware services:
Virtual machine monitor                                             done
Bridged networking on /dev/vmnet0                                   done
DHCP server on /dev/vmnet1                                          done
Host-only networking on /dev/vmnet1                                 done
Virtual ethernet                                                    done
Starting VMware services:
Virtual machine monitor                                             done
Virtual ethernet                                                    done
Bridged networking on /dev/vmnet0                                   done
   Host-only networking on /dev/vmnet1 (background)                    done

I thought vmnet1 is up and running (at least above output indicates this) but when I run ifconfig command:
# /sbin/ifconfig -a
There was no vmnet1 interface at all. This is one of production system and now things are complicated. Oh, boy I hate stupid developer(s) they will do anything to setup and run their development environment.

Anyways one of our senior UNIX admin pointed out me to use vmnet-netifup command :D. It is use to configure a virtual networking i.e. VMWARE network interfaces. The syntax is easy:
# vmnet-netifup -d /var/run/vmnet1.pid /dev/vmnet1 vmnet1
Where,

  • -d /var/run/vmnet1.pid : PID file for daemon mode
  • /dev/vmnet1 : Device file
  • vmnet1: Interface name (it can be eth1)

Assign an IP address:

# ifconfig vmnet xxx.xxx.xxx.xxx up

It worked like a charm. It saved me from restoring Debian updates as well as reinstalling VMWARE.