How do I remove an admin user from a CouchDB database? - couchdb

I know I can use the command:
curl -X PUT
http://admin:password#127.0.0.1:5984/_config/admins/admin
-d '"password"'
to add a new admin to the server. How do I go about removing an admin user?

You should be able to DELETE the user admin that you setup with:
curl -X DELETE http://admin:password#127.0.0.1:5984/_config/admins/admin
Note this is a bad example as you're deleting the user that you're authenticating as. The last part of the URL admin is the name of the user.

Related

Password for default system user created in JupyterHub

I am running Jupyter-Hub with default authenticator and default spawner. Logged in to Jupyter-Hub with system username (admin). I added a new user called user1 in JupyterHub web console. The user got created in both the machine and Jupyter-Hub server as I added c.Authenticator.create_system_users = True in the config file. When I checked the machine users, user1 is added because of the above property added in the config file. Can anyone tell me what is the password for user1 as there is no password option to be given in Jupyter-Hub? I tried with empty, user1, 12345 and 123456.
I was trying to switch user by using su command. i.e su user1. It asks for the password.
when i cat /etc/shadow this is what i got,
user1:*:121212:0:99999:7:::
As stated in the docs (https://github.com/jupyterhub/jupyterhub/blob/master/docs/source/getting-started/authenticators-users-basics.md#use-localauthenticator-to-create-system-users), this option essentially acts like the adduser command. Even on command line this just creates the user, you cannot login to this user before you set a password via the passwd command.
Also, like the docs said, it is not recommended when JupyterHub users are directly mapped onto UNIX users, probably in part because of this password limitation...

How to change user within PostgreSQL?

I was following the tutorial linked below to install PostgreSQL with python3 on Ubuntu:
https://www.fullstackpython.com/blog/postgresql-python-3-psycopg2-ubuntu-1604.html
Right after this step:
$ createuser matt -P --interactive
Where we create a user account within the "postgres" base user provided by PostgreSQL.
I then close the terminal to come back to the tutorial afterward.
I couldn't find how to switch back to the user previously created and finally went around it with:
ALTER DATABASE name_db OWNER TO name_new_user.
But how am I supposed to switch from 'postgres' default user to another user created previously in PostgreSQL?
If you're already logged in to PostgreSQL, you can change users with the set role command, for example, to switch to "matt":
set role matt;
If you're not already logged in to PostgreSQL, and are using psql, there are a few ways:
$ psql -U matt
of if you want to usually log in as matt:
$ echo 'PGUSER=matt' >> ~/.profile
$ source ~/.profile
$ psql
where .profile is where you store OS environment variables

Cannot Create Admin Login on CouchDB

I have a fresh install of CouchDB on a new server. I set it up on a dev server and upon starting the service and accessing the web interface I was able to click the fix it button and create an admin login. On the new server using the exact same steps and software when clicking fix it and entering the new username and password it just spins and keeps thinking and does nothing else. If I refresh the screen it just starts over with no visible change. Anyone know where to look to see what the issue is or know why this is happening. I am fairly new to CouchDB.
Note: I am using the Fix link in the lower right side menu to create the login, it worked before on another server
I followed this article, see section on creating admin using Fix It
https://www.digitalocean.com/community/tutorials/how-to-install-couchdb-and-futon-on-ubuntu-14-04
You can try to add the admin with curl. If curl isn't installed on your machine, install it with this simple command:
apt-get update && apt-get install curl
then execute the following curl command:
$1: Username
$2: Userpassword
curl -X PUT $HOST/_config/admins/$1 -d '"'$2'"'
Source for further information about that topic: http://docs.couchdb.org/en/1.6.1/intro/security.html

How to create database and user in influxdb programmatically?

In my use case I am using single ec2 instance [not a cluster]. I want to create a database and an user with all privileges programmatically? Is there a config file which I can edit and copy to the right location after influxdb is installed.
Could someone help me with this?
There isn't any config option that you can use to do that with InfluxDB itself. After starting up an instance you can use the InfluxDB HTTP to create the users. The curl command to do so would be the following:
curl "http://localhost:8086/query" --data-urlencode "q=CREATE USER myuser WITH PASSWORD 'mypass' WITH ALL PRIVILEGES"
Just run this command for each of the users you'd like to create. After that, you'll need to enabled the auth value of the [http] section of the config.
you can use ansible to setup influxb with your own recipe.
here's the ansible module documentation that you can use
http://docs.ansible.com/ansible/influxdb_database_module.html
or, any config/deploy manager that you prefer. i'd do this anyday instead of some ssh script or who knows what.
https://forge.puppet.com/tags/influxdb
chef.
https://github.com/bdangit/chef-influxdb
and also, you can use any of the above config managers to provision/manipulate your ec2 instance(s).
Use the admin token and this command (InfluxDB 2.3 CLI)
.\influx.exe user create -n yourusername -p yourpassword -o "your org name" --token admintokengoeshere

Updating WordPress with SSH (Cent OS)

I am new to SSH and Linux and I hope someone can help. I am working on a site with a dedicated server (VPS) and I am also working with WordPress. I used SSH to log into the site's files with Cyberduck (I've also used FileZilla successfully) and install WordPress on the server.
The problem I'm having now is that I can't edit or add any plugins or files on WordPress because WordPress doesn't have access to the site's FTP which is standard. It asks for credentials and when I attempt to enter them into the WordPress dashboard, it doesn't work. There is an option for FTP and there is an option for FTPS (SSL). I know these are different than SSH but I tried the SSH credentials anyway and obviously they didn't work.
I then logged into the SSH through Mac Terminal and did the instructions here:
1. Login as root through SSH.
2. Next add the user account you want using the 'useradd' command
useradd <username>
3. Now create a special group for that user.
groupadd <groupname>
4. Now to add the user to the group
gpasswd -a <username> <groupname>
5. Change the group ownership of the special directory to that group.
chgrp -R groupname
/path/to/your/web/directory
6. Enable write permissions
chmod -R g+rw
/path/to/your/web/directory
And it worked. I was able to add a new user (and I could confirm this by looking at the /etc/passwd file). I then logged out and tried to log in with Cyberduck using the new credentials and setting it to FTP (instead of SSH) and it didn't work. It did however work to log in with SSH with the new user credentials. So it seems I can successfully add a new SSH user but not a new FTP user.
I need the user to be FTP so I can hook WordPress up and begin editing. How do I specific the user to be FTP as opposed to SSH? Thanks for any help!
I've found an answer to my question and figured I'd document here for anyone else who runs across this issue. It's surprisingly easy.
Just go to this link and download the plug-in:
http://wordpress.org/plugins/ssh-sftp-updater-support/
You obviously have to upload this straight into your WordPress directory in the SFTP (/wp-content/plugins) in order for it to work correctly since it won't work from within the WordPress dashboard.
Once those files are there, when WordPress prompts you to login to your 'FTP' it will have an option for SSH which you can select and log-in. Voila!

Resources