Page 1 of 1

Locked out of my server (Ubuntu 12.04.4 x32)

Posted: Tue Jul 15, 2014 10:41 pm
by kerem
Hi,

As a general security convention, it is common to create a user and add him to sudoers file with root priviledges and disable root login. That is what I did before setting up VestaCP.

The problem is; after I added my user to sudoers file with root privileges and disabled root login from sshd_config, vestacp overwrote the sudoers file without notification and removed my user from the sudoers file. Effectively disabling any sort of root access on my server (as far as I can understand).

Now I can log on to my server, but I cannot use sudo, and can't login as root. I have personal data I need to backup and I couldn't find a way to retrieve it.

I know VestaCP creates some users (I can do everything from the web interface) but I don't know how I can use it to regain root access (if it's possible at all).

Is there any way to solve this problem?
Thanks

Note: I followed a very common tutorial for the initial setup: https://www.digitalocean.com/community/ ... untu-12-04

I have these entries in my sshd_config:
PermitRootLogin no
UseDNS no
AllowUsers <my-username>

Re: Locked out of my server (Ubuntu 12.04.4 x32)

Posted: Tue Jul 15, 2014 11:04 pm
by imperio
Hi,
you can enable ssh access in the settings of your user

1.login to the vestacp
2.click the button "edit" for your user
3.find this setting SSH Access
4.select the sh
5.save settings

after this you can login to ssh on behalf of your user

user - name of your user in the vestacp
password - password of you user of vestacp

and you can restore root password

Code: Select all

su root

Re: Locked out of my server (Ubuntu 12.04.4 x32)

Posted: Wed Jul 16, 2014 2:15 am
by kerem
I applied the steps you mentioned. Since my user was added before installing VestaCP, it is not listed in the control panel. I tried creating it but I got an error saying it already exists. I tried creating a seperate user with shell access but I couldn't login with that either.

Re: Locked out of my server (Ubuntu 12.04.4 x32)

Posted: Wed Jul 16, 2014 8:05 am
by imperio
Give me admin access to vestacp
I want check this problem on your server

send me private message with password

Re: Locked out of my server (Ubuntu 12.04.4 x32)

Posted: Mon Dec 08, 2014 3:11 am
by emardotcom
Yea this is true, There should be a warning during setup at least to prompt you that its going to overwrite visudo. So you don't get locked out. But its always important to back up before you do any changes to your System especially if its a production server.