Changing user password in PgAdmin on mac - r

I am using gAdmin on mac. So far I have not been able to figure out how to run the desktop version, so I am running the web application. I want to change the password for the user postres. The reason being, I am trying to connect R to postres using:
db <- 'dvdrental' #provide the name of your db
host_db <- "localhost"
db_port <- '5432'
db_user <- "postgres"
db_password <- " " # I typed the master password in, as I do not remember setting up this user/password
con<-dbConnect(RPostgres::Postgres(), dbname = db, host=host_db, port=db_port, user=db_user, password=db_password)
but I keep getting below error:
Error: FATAL: password authentication failed for user "postgres".
This is thee reason for the change of password for the user postgres
How can I change a user password in PgAmin4 using webapp on mac?

In PgAdmin4, if you are changing the password for the same user you are logged in as, then you need to select a connected database from the browser tree. Once you do that, the "Object" menu "Change Password..." option.
If you are logged into the server as a super user and want to change the password of a different user/role, then right click (or whatever mac uses for that function) on that user/role from the tree and choose "Properties...". Then under the "definition" tab there is a place to enter the new password. Note that this method is inferior, as the password is received by the server as plain text (once any ssl decryption is done) and so can end up in the log file in the clear.
Why constrain yourself to PgAdmin4? psql has \password, which does this better.

Related

Glassfish Change Admin Password

How can I change the admin password for a Glassfish Domain using a password file? I know the conventional method of manually typing the password upon prompt.
However I want to change the admin password using a script where in I do not have to manually type the password.
This is possible, but you will need 2 password files if you want to script this fully in the easiest way.
Create a temporary file (tmpfile in my example) which will hold the current password (blank by default) and the desired new password:
AS_ADMIN_PASSWORD=
AS_ADMIN_NEWPASSWORD=myNewPassword
Now create a password (pwdfile in my example) file which will contain the changed admin password:
AS_ADMIN_PASSWORD=myNewPassword
You can then use the files to change the password using the commands below, making sure to use tmpfile when changing the password, then pwdfile afterwards
$PAYARA_PATH/bin/asadmin start-domain
$PAYARA_PATH/bin/asadmin --user $ADMIN_USER --passwordfile=/opt/tmpfile change-admin-password
$PAYARA_PATH/bin/asadmin --user $ADMIN_USER --passwordfile=/opt/pwdfile enable-secure-admin
$PAYARA_PATH/bin/asadmin restart-domain
This example was adapted from the way the Payara Server dockerfile works
For anyone still interested in manually setting the admin account password:
I tried to generate the contents of the "admin-keyfile" located in "glassfish/domains/{ACTIVE_DOMAIN_NAME}/config/admin-keyfile" based on the current implementation of the Payara Repo. This file (as the data source for the FileRealm) is used to authenticate the admin user when accessing the admin interface under port 4848.
Each line of this text file represents an account and is structured as
USERNAME;PASSWORD;GROUPS
The field "PASSWORD" is prefixed with a hash algorithm keyword (wrapped in curly braces, e.g. "SSHA" or "SSHA256") followed by a BASE64 encoded hash of the concatenated salted hash and the salt value itself (some random bytes):
{SSHA}BASE64(SHA(password,salt),salt)
Long story short: If you want to generate user accounts manually you could for example use the following Python script:
import hashlib
from base64 import b64encode
from secrets import token_bytes
from getpass import getpass
username = 'admin' # input('Username: ')
plainTextPassword = getpass()
randomSalt = token_bytes(8)
passwordHash = hashlib.sha256()
passwordHash.update(plainTextPassword.encode('utf-8'))
passwordHash.update(randomSalt)
passwordDigest = passwordHash.digest()
# cryptic range reflects the strange implementation... feel free to change it to "range(98)"
# https://github.com/payara/Payara/blob/6488cbdc90fd0f6c42de6a42affcd09f697be715/nucleus/common/common-util/src/main/java/org/glassfish/security/common/SSHA.java#L108
for run in range(2, 101):
passwordHash = hashlib.sha256()
passwordHash.update(passwordDigest)
passwordDigest = passwordHash.digest()
saltedHashAndSalt = b64encode(passwordDigest + randomSalt).decode('utf-8')
result = '{0};{{SSHA256}}{1};asadmin'.format(username, saltedHashAndSalt)
print(result)
Insert the console output into the "admin-keyfile" and (re)start your server.
As far as I know, it is impossible to change it via a file as a parameter for security reasons.
You can consider an alternative solution (pipe) but the confirmation of the password is always necessary. https://docs.oracle.com/cd/E19798-01/821-1758/change-admin-password-1/index.html

Forgot Oracle username and password, how to retrieve?

I have forgotten my Oracle username and password and hence not able to use it. My Oracle version is 11.2.0.1.0(11g). I consulted Internet. They asked me to execute commands like ‘SYSDBA’ but I was unable to do it as once I give ‘SYSDBA’ on Command Prompt screen, it takes the command as the username and next asks for password. I cannot execute any commands suggested by them as whatever I enter is taken as the username, subsequently password is asked and error occurs.
Open your SQL command line and type the following:
SQL> connect / as sysdba
Once connected,you can enter the following query to get details of username and password:
SQL> select username,password from dba_users;
This will list down the usernames,but passwords would not be visible.But you can identify the particular username and then change the password for that user.
For changing the password,use the below query:
SQL> alter user username identified by password;
Here username is the name of user whose password you want to change and password is the new password.
Go to SQL command line:-
type:
sql>connect / as sysdba;
then type:
sql>desc dba_users;
then type:
sql>select username,password from dba_users;
If sysdba doesn't work then try connecting with username:scott and password: Tiger
You will be able to see all users with passwords.
Probably you might find your's.
Hope this helps
Open Command Prompt/Terminal and type:
sqlplus / as SYSDBA
SQL prompt will turn up. Now type:
ALTER USER existing_account_name IDENTIFIED BY new_password ACCOUNT UNLOCK;
Voila! You've unlocked your account.
The usernames are shown in the dba_users's username column, there is a script you can run called:
alter user username identified by password
You can get more information here - https://community.oracle.com/thread/632617?tstart=0
if you are on Windows
Start the Oracle service if it is not started (most probably it starts automatically when Windows starts)
Start CMD.exe
in the cmd (black window) type:
sqlplus / as sysdba
Now you are logged with SYS user and you can do anything you want (query DBA_USERS to find out your username, or change any user password). You can not see the old password, you can only change it.

Access denied for user 'myusername'#'localhost' (using password: YES)

I am on windows using Xampp
I want to upload a file on shiny, but I receive this error; Access denied for user 'myusername'#'localhost' (using password: YES)
This is what I have in R:
mysql = list(
"host" = "127.0.0.1",
"port" = 3306,
"user" = "myuser",
"password" = "mypassword"
“databaseName" = "xxx"),
Could someone tell me how to fix it?
Thanks a lot
You could create a user specially for your shiny application and give this user proper privileges. If you can access a terminal / MySQL workbench where you can type in SQL commands you could try:
Start by creating the user:
CREATE USER 'shinyuser'#'%' IDENTIFIED BY 'password123';
The create the database if necessary:
CREATE DATABASE MyDatabase;
And finally give permission to the new user:
GRANT ALL PRIVILEGES ON shinyuser.* TO 'MyDatabase'#'%' WITH GRANT OPTION;
This problem arises when your username and password is not matching with your database username and password. So please check your database username and password first then try it again.

Get current user name autoit

I try to get the name of the current user logged like that
here my code
local $IniRead = IniRead(#AppDataDir & "\Mozilla\Firefox\profiles.ini", "Profile0", "Path", "default")
MsgBox(0, "", "valeur : " & #AppDataDir & "\Mozilla\Firefox\" & $IniRead)
But i use a #requireadmin so i got the name of the runas and not the name of the logged session in windows...
i can't leave the #requireadmin cause i use it for make a Filecopy...
if someone got a way.
You can use #UserName to get the running user. Milos is right, the #RequireAdmin directive directs AutoIt to request the admin token from the Operating System. If the logged on user is an administrator, it will either prompt them to continue, or continue silently depending on UAC. If the logged on user is not an administrator, they will be prompted for an account with administrative credentials.
If you're looking to copy a file into #AppDataDir, you will not need administrator rights since the logged on user will have full access (by default) to #AppDataDir.

Cannot create new connection or login to added user?

I am using Oracle SQL Developer to connect to Oracle Express 11g and create a new user. I keep on getting the same error when I try to create a new connection (and test it) or when I try to login with a newly created username and password (mad by right-clicking "other users" table in default connection "xe")
The error-
Failure - Test Failed: ORA-01017: invalid username/password; logon denied
How can I fix this issue ?
Seems you're using an user with not enough privilegies, try with "system" user.
That should solve your problem.
Verify the priviligies of the user you created.

Resources