- How to Set the Default User Password in PostgreSQL
- Login and Connect as Default User
- Authentication Error
- Changing the Password
- Пароль пользователя postgres — как задать и изменить пароль
- Изменить пароль пользователя Postgres
- Update Your PostgreSQL Password in Linux
- Before Getting Started
- Step #1: Switch to the PostgreSQL User: postgres
- Step #2: Add/Change the PostgreSQL Password for the User: postgres
- Bonus Information!
- Как изменить пароль пользователя PostgreSQL?
- 11 ответов
- ArcGIS for Server
How to Set the Default User Password in PostgreSQL
Firstly, it is important to understand that for most Unix distributions, the default Postgres user neither requires nor uses a password for authentication. Instead, depending how Postgres was originally installed and what version you are using, the default authentication method will either be ident or peer .
ident authentication uses the operating system’s identification server running at TCP port 113 to verify the user’s credentials.
peer authentication on the other hand, is used for local connections and verifies that the logged in username of the operating system matches the username for the Postgres database.
Login and Connect as Default User
For most systems, the default Postgres user is postgres and a password is not required for authentication. Thus, to add a password, we must first login and connect as the postgres user.
If you successfully connected and are viewing the psql prompt, jump down to the Changing the Password section.
If you received an error stating that the database “postgres” doesn’t exist, try connecting to the template1 database instead and if successful, continue to Changing the Password.
Authentication Error
If you receive an authentication error when attempting to connect to the psql client, you may need to alter the Postgres authentication config file (pg_hfa.conf).
Open the config file, typically located at /etc/postgresql/#.#/main/pg_hba.conf , where #.# is the Postgres version you are using:
The auth config file is a list of authentication rules. Scroll down the file until you locate the first line displaying the postgres user in the third column (if such a line exists). Uncomment the line if necessary (remove the semicolon), or otherwise if the line is missing entirely, add the following line to the top of the file and save your changes:
This authentication rule simply tells Postgres that for local connections established to all databases for the user postgres , authenticate using the peer protocol.
Note: Some older versions of Postgres prefer the default authentication method of ident, but most modern installations will utilize peer as specified above instead. You may need to test both if your results differ.
Now with your configuration file updated, repeat the steps in the Login and Connect as Default User section to try to connect to as the default postgres user. Once successful, proceed with changing the password.
Changing the Password
With a connection now established to Postgres at the psql prompt, issue the ALTER USER command to change the password for the postgres user:
If successful, Postgres will output a confirmation of ALTER ROLE as seen above.
Finally, exit the psql client by using the \q command.
You’re all done. The default postgres user now has a password associated with the account for use in your other applications.
Источник
Пароль пользователя postgres — как задать и изменить пароль
Команды по администрированию базами и пользователями выполняются от имени системного пользователя postgres
root может стать им выполнив su — postgres
Затем можно без пароля попасть в интерфейс БД psql
Или то же самое одной командой
Пользователь может создать базу
Затем добавить пользователя и задать для него пароль
=# create user appadmin with encrypted password ‘jdfh8jhtghnjkfrvhyu’;
После этого пользователю нужно дать права для работы с базой данных
=# grant all privileges on db1 mydb to appadmin;
Изменить пароль пользователя Postgres
Пользователя можно создавать и задавать ему пароль двумя раздельными командами
sudo -u postgres createuser anotheruser
Вторая служит для изменения паролей уже существующих пользователей, выполняется из консоли psql
=# alter user anotheruser with encrypted password ‘NEW_STRONG_PASSWORD’;
Непосредственно для системного пользователя postgres пароль не нужен, им может стать root выполнив su как показано ранее. Если нужна авторизация root может установить для postgres новый пароль
Затем пароль нужно ввести дважды, отображаться он не будет.
Пользователь appadmin — не системный, он существует только в postgresql.
Подключаться к базе из консоли от имени этого пользователя нужно указывая имя базы и ключ -W
psql -h myhost -d db1 -U appadmin -W
Последний ключ не обязателен, но без него в интерактивном режиме в некоторых версиях СУБД не будет запрашиваться пароль, пароль должен запрашиваться.
Про создание дампов баз данных Postgres и их загрузку.
Источник
Update Your PostgreSQL Password in Linux
PostgreSQL supports many client authentication methods, but in this case we’re only going to concern ourselves with two: password and md5.
Before Getting Started
- These instructions are intended specifically for changing a password in PostgreSQL.
- I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.
- PostgreSQL is installed per our tutorial on: How to Install and Connect to PostgreSQL on CentOS 7.
Step #1: Switch to the PostgreSQL User: postgres
If you’re working from a default PostgreSQL installation, then PostgreSQL will be configured with the user postgres.
Since we’re logged in as root, and we’re assuming that root doesn’t have a user for PostgreSQL, switch to the default PostgreSQL user: postgres.
… then attempt a connection to PostgreSQL.
… enter your password at the prompt.
… the correct, valid response will be similar to the following.
psql (9.3.9)
Type «help» for help.
Step #2: Add/Change the PostgreSQL Password for the User: postgres
Use the following command to change the PostgreSQL password for your current user, which is now postgres.
Enter your new password, and then enter it again to confirm it.
Enter new password:
Enter it again:
Now quit the PostgreSQL interface.
Bonus Information!
You can do all of step one in exactly one command.
Источник
Как изменить пароль пользователя PostgreSQL?
Как изменить пароль для пользователя PostgreSQL?
11 ответов
для пароля меньше логина:
чтобы сбросить пароль, если вы забыли:
затем бросить psql :
если это не помогает, настройте проверку подлинности.
редактировать /etc/postgresql/9.1/main/pg_hba.conf (путь будет отличаться) и меняться:
вы можете и должны зашифровать пароль пользователя:
Я считаю, что лучший способ изменить пароль, просто использовать:
в консоли Postgres.
при указании незашифрованного пароля с помощью эта команда. Пароль будет передан на сервер в открытый текст, и он также может быть зарегистрирован в истории команд клиента или журнал сервера. psql содержит команду \password, которую можно использовать изменение пароля роли без выставляя пароль.
изменить пароль с помощью командной строки в Ubuntu, используйте:
перейдите в конфигурацию Postgresql и отредактируйте pg_hba.conf
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
затем измените эту строку :
затем перезапустите службу PostgreSQL с помощью команды SUDO, затем
теперь вы будете введены и увидите терминал Postgresql
и введите новый пароль Пользователь Postgres по умолчанию, после успешной смены пароля снова перейдите в pg_hba.conf и вернуть изменение в «md5»
теперь вы войдете в систему как
С новым паролем.
Дайте мне знать, если вы обнаружите какие-либо проблемы в нем.
Это был первый результат в Google, когда я искал как переименовать пользователя, так:
несколько других команд, полезных для управления пользователями:
переместить пользователя в другую группу
конфигурация, которую я получил на своем сервере, была настроена много, и мне удалось изменить пароль только после того, как я установил доверие аутентификация в :
Не забудьте изменить это обратно на пароль или md5
запросить новый пароль postgres пользователь (не показывая его в команде):
для моего случая на Ubuntu 14.04 установлен с postgres 10.3. Мне нужно выполнить следующие шаги
- su — postgres к postgres
- psql для входа в оболочку postgres
- \password введите пароль
- \q чтобы выйти из сеанса оболочки
затем вы переключаетесь обратно в root, выполнив exit и настроить свой pg_hba.conf (мое-в /etc/postgresql/10/main/pg_hba.conf ), убедившись, что у вас есть следующие линия
local all postgres md5
введите новый пароль для этого пользователя, а затем подтвердите его. Если вы не помните пароль, и вы хотите его изменить, вы можете войти в систему как postgres, а затем использовать это:
Источник
ArcGIS for Server
Three database login roles are provided with the enterprise geodatabase in PostgreSQL on ArcGIS Server on Amazon Web Services instances. Their passwords are hard coded and well known. To make your instance more secure, you must change the login role passwords.
To change passwords, you must be able to log in to the Amazon Web Services instance. If you create your site using the ArcGIS Server Cloud Builder on Amazon Web Services application, you must specify a key pair when you create the site, then open port 22 in your security group to allow you to connect to the instances. You can close port 22 after you change the passwords.
- Connect as ubuntu to the instance where PostgreSQL is installed.
- If you are connecting to your ArcGIS for Server instance from a local Windows computer, make an SSH connection to the instance. See Administer your Amazon EC2 Ubuntu Linux instance with remote access from Windows for an example.
- If connecting to your ArcGIS for Server instance from another Linux box, see Administer your Amazon EC2 Ubuntu Linux instance with remote access from Linux for an example.
- Switch to the root user.
The syntax for the \password command is \password .
For example, to change the sde password, type:
After you change the password of the owner login, you must update the registered databases for your ArcGIS Server on Amazon Web Services instance to use the new password.
The Edit Registered Database dialog box opens.
Источник