How to remove a stored user account in ADB? - adb

I am looking for a solution with which it is possible to remove a stored user account (Settings -> Users & Account) via adb. Has anyone of you already done that?

Case for applications accounts:
You need to have root privileges to do it. The accounts are stored in the database /data/system_ce/0/accounts_ce.db which need root privileges to access it.
In case you have a rooted phone, you can simply delete the concerned entry and it'll be removed.
Case for System users
To delete a system user, you can start by listing the existing ones:
pm list users
Each user entry is as follow : UserInfo{ID:USERNAME:INT}
To delete a user, you can use the command:
pm remove-user ID
Where ID is the ID of the user (result of the previous command)

Related

DB2 row level access control: how to pass a user Id

In our web application we want to use DB2 row level access control to control who can view what. Each table would contain a column named userId which contain the user id. We want log-in users be able to see only row's usereId column with theirs id. I have seen db2 permission examples using DB2 session_id or user, for example taking DB2 given Banking example :
CREATE PERMISSION EXAMPLEBANKING.IN_TELLER_ROW_ACCESS
ON EXAMPLEBANKING.CUSTOMER FOR ROWS WHERE BRANCH in (
SELECT HOME_BRANCH FROM EXAMPLEBANKING.INTERNAL_INFO WHERE EMP_ID = SESSION_USER
)
ENFORCED FOR ALL ACCESS
ENABLE;
Our table gets updated dynamically hence we don't know what row get added or deleted hence we don't know what are all the user Id in the table.
At any given time, different user would log-on to the web to view information retrieve from the tables, the permission declaration above only take SESSION_USER as the input, can I change it to something like Java function parameter where one can pass arbitrary id to the permission? If not then how do I handle different log-in users at arbitrary time? Or do I just keep changing SESSION_USER dynamically as new user login (using "db2 set" ??)? If so then is this the best practice for this kind use case?
Thanks in advance.
Since the user ID in question is application-provided, not originating from the database, using SESSION_USER, which equals to the DB2 authorization ID, would not be appropriate. Instead you might use the CLIENT_USERID variable, as described here.
This might become a little tricky if you use connection pooling in your application, as the variable must be set each time after obtaining a connection from the pool and reset before returning it to the pool.
Check out Trusted Contexts, this is exactly why they exist. The linked article is fairly old (you can use trusted contexts with PHP, ruby, etc. now).

how to add multiple Owner in ADLDS groups

I am new to this ADLDS ,Looking into this group ownership concept in ADLDs,
suppose I have a group, and I want set permission OWNER access to groups,
for multiple user, depend upon requirement.
I had checked ADLDS had groups owner, by default is Administrator, but didn't find any how to set Groups Owner in particular group,
using ADSI, or LDP.exe , how can I assign OWNER for group
what I need to configure,
As far as I know there's no GUI for what you're trying to do in ADSI. I'm not sure about LDP.
To accomplish what you're trying to do is you can use a tool called DSACLS
You can find this tool in this location:
%WINDIR%\ADAM
Viewing container permissions
dsacls.exe \testserver:50000\CN=Users,CN=TestApp,O=Test
Granting general permissions on a container
dsacls.exe \testserver:50000\CN=TestApp,O=Test /I:T /G CN=MembershipProvider,CN=Roles,CN=TestApp,O=Test:GR
There are a couple of things to notice here. "/I:T" sets permissions to the container and its sub objects, while we could've used "/I:S" to include only the sub objects. "/G" means grant ("/D" is deny). The "user or group DN" is the distinguished name of the user, group or role that we grant access to the container. The "permission" part can be GR for read and GW for write (other more specific permissions are also available).
This article explains more in depth...

In a Silverstripe DB where can I find the Users table and Password?

I have a local Silverstripe instance but I cannot login and the owners are battling to find their login details. I have the DB so how can I find the Users table and edit it, or make myself an admin account? Thanks
Despite having solved your problem, you did not answer your own question :-). For Google's sake I will try...
The user table is called "Member". It has got the email address and the password in it. You can not manually change the password here, as it is hashed. What you can do is change the email address and use the "forgot password" functionality (in case the client can't do that himself), change the password for the client through the application backend (cms) and change the email address back to its original value. If you are wondering what the MemberPassword table does: AFAIK it only stores a copy of all used passwords by a user (password history)
When you want to make an account administrator, you should first take a look at the Group table and look for "administrators" in the "Code" Column. Take that ID (normally, this would be 2). After that, take a look in the Member table, and look for the user you want to make an admin. Take the ID here as well.
Next, open the Group_Member table and insert a new row (or change the existing if you want) and specify the group id under GroupID and the member id under MemberID.
Adding Security::setDefaultAdmin('admin','admin'); to the _config.php also works, but don't forget to remove it afterwards, just as any phpmyadmin or equivalent that you installed :-)
Just found this add Security::setDefaultAdmin('username', 'password'); to mysite/_config.php. Worked like a bomb!
Create a file _ss_environment.php in the webroot (or the folder above it) if it doesn't already exist. Add these two lines to the bottom:
define('SS_DEFAULT_ADMIN_USERNAME','admin');
define('SS_DEFAULT_ADMIN_PASSWORD','password');

How to maintain user password in oracle 9i even after database refresh?

Every month we will have a database refresh so I assume user accounts are deleted and when that happens we will recreate again the users and provide another batch of passwords. For convenience sake, is there a way that passwords used by the user will be retained after the refresh so we dont need to set another batch of password each time the refresh happens? This is tiresome task especially if many users are involved. Thanks for helping. Or user accounts retained after refresh?
[EDIT]
My senior said that all user accounts will be deleted during the refresh. We can reset the password but its tiresome because we have to email the users their new password.
It will all depend on what you call "database refresh".
At the very least, you might somehow save the hashed user password before beginning the "refresh" process, and then restore them at the end.
The following query will use dbms_metadata.get_ddl to return a list of SQL statements that you might use to restore the various password (hashed) values:
-- in SQL*plus use the following lines so CLOB are not truncated:
-- SET LONG 3000
-- SET LIN 200
-- COLUMN USERCREATE FORMAT A200
select
dbms_metadata.get_ddl('USER', username) || '/' usercreate
from
dba_users;
On my test system (Oracle 11g Express Edition), this will produce something like that:
CREATE USER "SONIA" IDENTIFIED BY VALUES 'S:A4CA3.....596'
TEMPORARY TABLESPACE "TEMP"/
CREATE USER "SYLVAIN" IDENTIFIED BY VALUES 'S:23FFA.....8B0'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"/
...

Can't reset Drupal admin password

I need to reset my Drupal site's admin password and I can't user the email reset because the admin email doesn't exist.
I followed the directions here: http://www.ostraining.com/blog/drupal/reset-your-drupal-admin-password/
I ran the SQL: UPDATE dr_users SET pass = md5('newpassword') WHERE uid = 1; - no luck
I also tried entering a password into the users table manually in plain text. - no luck
At this point I'm not sure what the problem is.
The only thing I can think of, and I can't see why this would be it, is that I have a browser open with Admin logged in using the old password. This seems to be a hint to my problem as I would expect that on page refresh I would get logged out as the password has now changed.
try to update the admin email via mysql, then have drupal email you the password reset.
To see what you have now, you could look at the output from SQL
SELECT * FROM dr_users WHERE uid = 1;
It is pretty easy!
With the access to the table "users" (i.e. this table can have a prefix that you have already mentioned during the installation part, so yourPrefix_ can be your project's name as mywebsitename_, and in this case you'll have mywebsitename_users) in your database via PhpMyAdmin for example.
You should alter the "pass" column associated with the "uid" column with the value 1 (i.e 1 for the admin user account).
As the encrypted value for the password: Admin_12345 is =>
$S$DifCVXg9tNtHadziyyQJQVLAaZzW5EgS6OjR56D.mk8MpNQs1II2
You can accede to your admin account after replacing the old hashed password value stored in your database that you have totally forgotten.
Don't forget to change the password: Admin_12345 after you accede to your account ;)

Resources