Ubuntu: Samba file server won't let me login as root only as active-directory user


I made a 16.04 server installed with samba, winbind and some others using parts of this walk-through. It worked until I played with permissions (for some reason some folders were not accessible), now I find myself locked out of the server.

I can access the share on windows with my active directory username/passwd but I'm stuck outside the server and can only logon with the same active directory user/passwd.

If I try to get to root user it says the access is denied or authentication failed.

> me@ubuntu-fileserver:~$ sudo su    > sudo: unable to resolve host ubuntu-fileserver: Connection timed out    > [sudo] password for me:  me is not in the sudoers file.  This incident will be reported.   > me@ubuntu-fileserver:~$ su root    > Password:   Access is denied    > su: Authentication failure  

Is there a way to get root access back without reinstalling ?

EDIT: From liveCD or Recovery mode I only have a minute or so before this happens:

Everything stops

EDIT2: After making corrections to hosts/hostname (one was different), still cannot login as sudoer :

host localhost

localhost has address  Host localhost not found: 2(SERVFAIL)  Host localhost not found: 2(SERVFAIL)  

host ubuntu-fileserver

ubuntu-fileserver.domain.lo has address  

cat /etc/hostname


cat /etc/hosts localhost   localhost.localdomain ubuntu-fileserver  ubuntu-fileserver.domain.lo ubuntu-fileserver   dc1.domain.lo   dc1   dc2.domain.lo   dc2  # The following lines are desirable for IPv6 capable hosts  ::1     localhost ip6-localhost ip6-loopback  ff02::1 ip6-allnodes  ff02::2 ip6-allrouters  

I can ping all these addresses by ip or hostname no problem.


Resolve the host resolution

You're having problems with your host server resolution. This is configurable in your /etc/hosts.

You can fix this by:

Reboot your computer. At the grub prompt select Advance Options for Ubuntu and press ENTER. Go into Recovery Mode. (You may have to hit esc to disable the ping screen.) Continue with:

  1. Drop to root shell prompt
  2. ENTER for maintenance.
  3. Remount the root system with:
# sudo mount -o remount,rw /

Now edit your /etc/hosts ensure you have the following resolved to the ip    localhost.localdomain localhost    ubuntu-fileserver  

Resolve the sudo permission

While in the recover mode of the first section run this:

$ nano /etc/group  

Look for the sudo group:

Change from:


Change to:


Add your using name to the contents of the file. The userID's needs to be separated by a comma to have more than one userID included.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »