How can I change to single user mode after delete admin acco

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
User avatar
Narga
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 25 Dec 2013, 06:37

How can I change to single user mode after delete admin acco

Postby Narga » 01 Mar 2014, 16:30

Hi,
I'm using multi user from the first installed because I want to use my own username. After created new account, I deleted admin user from phpMyAdmin :? But I so tired with login form screen then I want to use single user mode. I set

Code: Select all

   define('SINGLE_USER_MODE', true);

and got error message:

Code: Select all

SINGLE_USER_MODE is enabled in config.php but default admin account is not found.

I re-create admin user then try again:

Code: Select all

SINGLE_USER_MODE is enabled in config.php but default admin account is not found.

How can I swich to single user mode with my own username after delete admin user used phpMyAdmin :?:

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How can I change to single user mode after delete admin

Postby fox » 01 Mar 2014, 19:57

>After created new account, I deleted admin user from phpMyAdmin

Well done.

mrc0mmand
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 06 Feb 2014, 21:49

Re: How can I change to single user mode after delete admin

Postby mrc0mmand » 01 Mar 2014, 20:24

Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

User avatar
Narga
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 25 Dec 2013, 06:37

Re: How can I change to single user mode after delete admin

Postby Narga » 02 Mar 2014, 08:14

fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

Is that impossible to fix?
mrc0mmand wrote:Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

It's not work, I got the same error message

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: How can I change to single user mode after delete admin

Postby AngryChris » 02 Mar 2014, 16:17

mrc0mmand wrote:Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

Except those aren't the default values (at least not all of them!). You see, one of the side effects of 'admin' being the first user created is that it's id is set to 1. And if you note here in the code:

Code: Select all

if (SINGLE_USER_MODE) {
        $result = db_query("SELECT id FROM ttrss_users WHERE id = 1");

        if (db_num_rows($result) != 1) {
                array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
        }
}

It's looking for a user id of 1. He may be able to recover by setting the id of admin to 1.

Code: Select all

UPDATE ttrss_users SET id='1' WHERE login='admin';

But I'd not hold my breath. I don't know what all else is setup when a user is created beyond what's in the ttrss_users table. This monumental level of "well done" is a bit beyond my understanding. I think the best advice (if the above doesn't work) is:

Code: Select all

DROP DATABASE ttrssdb;

For whatever he's calling it.

Narga wrote:After created new account, I deleted admin user from phpMyAdmin

Incredible.

mrc0mmand
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 06 Feb 2014, 21:49

Re: How can I change to single user mode after delete admin

Postby mrc0mmand » 02 Mar 2014, 17:02

AngryChris wrote:It's looking for a user id of 1. He may be able to recover by setting the id of admin to 1.


Damn, I totally forgot about that ID, thanks!

User avatar
Narga
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 25 Dec 2013, 06:37

Re: How can I change to single user mode after delete admin

Postby Narga » 02 Mar 2014, 19:18

Thanks AngryChris, I'm still using my current user with more than 300 feeds. I guess if I change the id of my current user I must change it to admin -> the action that make me create a user then delete admin account.
I've tried change ID or edit the code in functions.php, sanity_check.php .... but it's not work. I've gave up and waiting for new feature that allow choose default user after switch to Single User Mode.
Thanks

dbanet
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 28 Jan 2014, 01:37
Location: Moscow, Russia
Contact:

Re: How can I change to single user mode after delete admin

Postby dbanet » 02 Mar 2014, 20:25

fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.

charlie-tca
Bear Rating Trainee
Bear Rating Trainee
Posts: 32
Joined: 03 May 2013, 23:04
Contact:

Re: How can I change to single user mode after delete admin

Postby charlie-tca » 02 Mar 2014, 20:56

I am not so sure that the ability to delete is what is really stupid here. I, for one, appreciate the idea that the application is written thinking users are smarter than normal.

dbanet
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 28 Jan 2014, 01:37
Location: Moscow, Russia
Contact:

Re: How can I change to single user mode after delete admin

Postby dbanet » 02 Mar 2014, 21:54

charlie-tca wrote:I am not so sure that the ability to delete is what is really stupid here. I, for one, appreciate the idea that the application is written thinking users are smarter than normal.

Well if a user wants to shoot himself in his foot, he may make a DELETE request to the database.

Therefor an indeed smart user may shoot himself in his leg anyway, but not-so-smart ones are protected from doing this.

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: How can I change to single user mode after delete admin

Postby sleeper_service » 02 Mar 2014, 23:26

dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.


what's stupid is making a statement like that, the guy said he opened up the raw database in phpmyadmin, and deleted data from it, how exactly would you prevent that, genius?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: How can I change to single user mode after delete admin

Postby fox » 03 Mar 2014, 00:23

dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.


the stupid is coming from inside the thread

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: How can I change to single user mode after delete admin

Postby AngryChris » 03 Mar 2014, 01:58

dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.

It's not deletable, at least not from in the application. If you try to delete the admin user from the User control page, you get this error:

Code: Select all

Remove selected users? Neither default admin nor your account will be removed.

dbanet
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 28 Jan 2014, 01:37
Location: Moscow, Russia
Contact:

Re: How can I change to single user mode after delete admin

Postby dbanet » 03 Mar 2014, 03:01

Wow how many answers!

I deleted admin user from phpMyAdmin

Well I missed that, indeed. :o
So I have to agree deleting arbitrary rows from the table in hope that it will make just what you want is foolishly.

User avatar
Narga
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 25 Dec 2013, 06:37

Re: How can I change to single user mode after delete admin

Postby Narga » 03 Mar 2014, 17:34

WoW, Wow, after delete admin user then want to switch to single mode, but in one or more month I'll running it as multiuser, is that stupid question


Return to “Support”

Who is online

Users browsing this forum: No registered users and 3 guests