How to manage User Accounts in MediaWiki via Database? - mediawiki

I installed the MediaWiki, but forgot both username and password, can some one help to to retrieve User Name and Password.

Do you have shell access? You can run the CreateAndPromote maintenance script:
$ php maintenance/createAndPromote.php --bureaucrat --sysop --force YourUsername Y0urN3wPassw0rd

Related

encrypting password in shell script

I'm running a shell script on a Ubuntu server, the shell script inserts data to my database (I use MariaDB) for the connection I have a database user and the database user has a password. The problem is the password is plain text, is there a way I can encrypt this password, store it in an other file, or another way so no one can read the password when reading the script?
thanks in advance,
mysql -u db_user -pplain_password <<EOF
USE db_name
INSERT INTO table ()
VALUES ();
EOF
Check out mysql_config_editor. This will allow you to create a .mylogin.cnf file which will store the password in an encrypted form. .mylogin.cnf will be used by your script, or other client program, to connect to the database.

How to re-setup Database configurations in Icinga2 server?

I am using ubuntu 16.04 and mysql DB ,i configured DB for icinga2 server and i created separate user in database.
somedays back i deleted that user from db now i am not able access icingaweb2 UI,
Getting below error while trying to access to the link.
All configured authentication methods failed. Please check the system log or Icinga Web 2 log for more information.
I followed the below link to install icinga2 server
Please Help.
I resolved the issue by re-creatinging a setup token in in the Icinga Web 2 by using bellow command
sudo icingacli setup token create
i got some error's while creating setup token and it is easily resolved by using [1]: https://monitoring-portal.org/index.php?thread/40111-icingacli-does-not-work/
If you still have access to the MySQL DB you should do a backup first of your icinga2 DB.
mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]
Then purge MySQL or follow the guide on how to reset your root password
After you have access to the DB again if you purged MySQL use this to bring your data back in.
mysqldump -u [username] -p [password] [databasename] < [backupfile.sql]
If you only lost your password to IcingaWeb2 or now have access to MySQL then create a MD5 based BSD password algorithm:
openssl passwd -1 "password"
Note: The switch to openssl passwd is the number one (-1) for using the MD5 based BSD password algorithm.
Insert the user into the database using the generated password hash:
````
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, 'hash from openssl');
Source

auto authenticate password in mysql

I am new to MySql. In postgres, we can use .pgpass and save user password so that the database can automatically authenticate your password whenever you access or execute your sql script. I don't have to enter password.
So is there any way to do the same thing for mysql on linux?
Thanks
Yes, you can store default credentials and other options in your home directory, in a file called $HOME/.my.cnf
$ cat > $HOME/.my.cnf
[client]
user = scott
password = tiger
host = mydbserver
^D
In MySQL 5.6, you can also store an encrypted version of this file in $HOME/.mylogin.cnf, see http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html
$ mysql_config_editor set --user=scott --host=mydbserver --password
Enter password: ********
WARNING : 'client' path already exists and will be overwritten.
Continue? (Press y|Y for Yes, any other key for No) : y
$ mysql_config_editor print --all
[client]
user = scott
password = *****
host = mydbserver
You could use the command-line parameters available to the MySQL executable within a quick Bash script to accomplish this. See http://dev.mysql.com/doc/refman/5.6/en/mysql.html for
the details. Basically, the following line would log you into MySQL
$>mysql --user=root --password=toor my_database
The command above would log you into the mysql database "my_database" as root using the password "toor"
Now but this into a quick Bash script (run_mysql.sh):
#!/bin/bash
/usr/bin/mysql --user=root --password=toor my_database
Make sure the script is executable:
chmod +x ./run_mysql.sh
Of course make sure this script is safely stored somewhere other users cannot access it such as your home folder and set the permissions accordingly.

How to change samba and ubuntu password remotely?

So I have this file server for this school. Basically, every student uses one public login for windows and ubuntu alike. They use a custom app to login to the Samba Ubuntu Server using their own password to get to their personal directory. Once and a while they will need to change their password for this login. I need a way to change someones password that is thorough enough so that a bash script could do it, both for samba smbpasswd and ubuntu's passwd. So to sum this up, I need to know what command could be used to change someones password with no-user intervention using a bash script. Because when you type passwd username, then it asks you to type the password, I want a bash script to do this for me, so that when users want to change their password, I just need to edit that bash script. Im looking for something like "passwd user --current-password=CURRENTPASS --new-password=NEWPASS" and it would return ON THAT LINE. I also need it to work for smbpasswd so samba can change its password too.
EDIT
Found it! Wow this is great, which I knew this earlier. Using the following command works:
echo -e "newpass\nnewpass" | (smbpasswd -s username)
echo -e "newpass\nnewpass" | (passwd --stdin username)
Of course you would need to add the old password too if you were not running root. I love solving my own problems!
The solution, although posting this late, may not be secure, but was this:
echo -e "newpass\nnewpass" | (smbpasswd -s username)
echo -e "newpass\nnewpass" | (passwd --stdin username)

Creating a Symbolic Link to Access MySQL with Automatic Login

I am looking for a simpler way to log in to MySQL through the terminal without having to input my username and password each time.
I am using MAMP and to access my databases, I just simply type mysql and it is accessed. To do that I just created a symbolic link ln -s /Applications/MAMP/Library/bin/mysql /bin but to be able to create databases and such I need to be logged in. I know I can do that by typing mysql -uroot -ppassword but that's a bit of a pain to type each time. Is their a way to use a symbolic link like to add attributes? Say like ln -s /Applications/MAMP/Library/bin/mysql -uroot -ppassword?
Symlinks cannot contain command-line options.
You could instead place your credentials in an option file. If stored in a default location (such as ~/.my.cnf), you won't even need to tell mysql to read it.
[client]
user=root
password=foobar
Beware, especially if doing this for the root user, that anyone with read access to your option file will be able to login as your user.