Switch from userA to userB - vscode-remote

In my situation, I first need to connect to a UserA then su - UserB in order to have access my files. But when I'm trying to connect with the extension it didn't recognize the server version.
Host some_name
User userA
HostName xxx.xxx.xxx.xxx
RemoteCommand "su - userB"
RequestTTY yes
I got the following error message: unreachable or not Linux x86_64. (Cannot execute command-line and remote command.)

I'm also struggling to solve the same problem. I've tried a bunch of different stuff to try and auth as user b before vscode connects to userAs remote connection server, such as:
adding various additional parameters to my ssh config, authing as userB as above,
adding a similar su userB command to userA's bashrc file on the remote server,
same for bash_profile.
... all to no avail. In all cases, whatever I do, the vscode remote session will be instantiated under the under-privileged user a account, with the remote server launched in user a's user directory. If I auth through a standard terminal app, things work as expected and the su userB command triggers immediately after userA login. If I open a vscode terminal session in the same workspace (i.e. hit the plus sign in the same window as the ssh tunnelling session) and auth as userB, this also works but the session authed as userA persists unchanged.

Related

MongoDB command createUser requires authentication

I just installed Mongo DB on my Linux Server. Now I want to create an main admin user.
I followed the offical docs, but every time I run the command I get:
uncaught exception: Error: couldn't add user: command createUser requires authentication: _getErrorWithCode#src/mongo/shell/utils.js:25:13 DB.prototype.createUser#src/mongo/shell/db.js:1386:11 #(shell):1:1
I really don't know what I should do to fix this error.
Inside the /etc/mongod.conf config file authentication is disabled:
security:
authorization: "disabled"
Thanks for help!
To create the first user, you need to have authentication enabled and use the localhost passthrough: open mongoshell (the mongo command) from the same server in which the database is running.
Note that the passthrough is valid only when you connect via localhost and when no users have yet been created (once you create the first user, you will need to authenticate to perform any tasks). If you already created a user but don't remember the password, you will need to delete the entire dbPath folder, restart mongod and then use the passthrough to create the first user.

The permissions granted to user 'MachineName\Administrator' are insufficient for performing this operation. (rsAccessDenied)

(Revised based on comments below)
I know there's a ton of posts like this online and I've browsed many and found no useful help.
I have setup and configured SSRS many times and have not had this problem. The setup is similar to other servers in the past (all stand alone servers - no AD). I can log into Report Manager from a browser on the local server but when I try to access from my remote dev machine or from deploying a report from VS I get the above message.
This is how I'm trying to login which works on other servers but not this one.
http://Server IP/Reports
-Username: Administrator
-Password: admin password
I get the above error even though this is exactly the same as on other servers.
I should mention that I connect using a VPN to the network so I have access to the private IPs as well.
I also tried using he private IP
I also tried MachineName\Administrator
I also tried creating an SQL user with admin privileges and that did not work either.
This is a screenshot from a server where everything is working as expected. Administrators had default permissions (Content Manager). Users has browse:
This is a screenshot from the server that’s having permission issues. I assigned all roles to both admin accounts
and then I added all roles to both admin accounts:
Now I can deploy from VS using the username "administrator".
and I made a little progress (i think...) trying to access report manager from my pc. From IE (run as admin) on my local pc I try to access report manager from this URL
http://server ip/Reports/browse/
-Username: Administrator
-Password: admin password
And now I gain access to server manager but cannot see any content. When I click on the home button I get this error:
Any recommendations?

Why can't I create a database with my main user account with PostgreSQL?

So I have PostgreSQL installed fine, and am trying to run the createdb 'test' command in the Terminal. I am on my normal user account. When trying to create the database, I am asked for a password twice, then I get the error message createdb: error: could not connect to database template1: FATAL: password authentication failed for user "sethmarks". Does this mean I entered the incorrect password or that I do not have permission to create databases under this user? I am getting confused and frustrated by this and would like to know what is going on. I am entering the password I use for the OS user I am currently logged into.
I am able to create a database when I do sudo su - postgres and then create it when I am doing it under the Postgres user, but that is not going to work with my program. Can anybody help me figure this out?
I included a picture of the terminal to show the process and what happens when attempting to create a new db. Thank you very much.
It depends on the privileges that have been granted to your user account and which privileges have been granted to PUBLIC.
You can query some privileges with psql \du meta command for the current user.
In your case you need at least to run as superuser:
grant connect on database template1 to sethmarks;
I don't exactly why password is requested twice: this is not caused by wrong password: I have the same behaviour but I need to give the database user password not the OS user password.

pgadmin4 allows login as admin user with wrong password

I created an admin user with password in pgadmin4:
CREATE USER admin WITH
LOGIN
SUPERUSER
CREATEDB
CREATEROLE
INHERIT
REPLICATION
CONNECTION LIMIT -1
PASSWORD 'xxxxxx';
But I can login to the respective server with the admin user and any wrong password.
I used psql command line to check if the user has been created, and it is.
# SELECT usename FROM pg_user;
usename
------------
postgres
xxxxxxxxxxx
admin
(3 rows)
I checked if I can login with the admin user and a wrong password through psql command line, and it worked...
Am I doing something wrong?
Pgadmin4 v1.1
Postgresql v9.6
Same problem on Centos 6.8 and macOSX 19.12.1
This is speculation, but it's educated speculation, as I encountered a similar issue.
If your pg_hba.conf file, I am pretty confident you have the admin user set up as "trust." This pretty much means it can log in from anywhere you specified, without a password.
If you change this to "md5," it should resolve the issue.
# TYPE DATABASE USER ADDRESS METHOD
host all admin <whatever> trust
change to
host all admin <whatever> md5
Of course some of these fields may be different, depending on how you have the server set up, but you get the idea.

How to execute commands or functions with increased privileges for sudousers

In my client and server model, only root and sudousers has permissions to talk each other. Firstly, server authenticate client user(users on server), if any user other than root or sudousers then "permission denied message" is given backup to the client. But when client login as sudouser then it fails to execute certain commands which needs root privileges. but in case of root it works fine.
So,
1) How to give sudouser privileges in c/c++ program if logged in user is
in sudousers list?
I tried to find out whether user is in sudousers list or not by command "sudo -v" and then if user is in sudouser I set the "userid" of the root rather than sudousers uid using "setuid()" system call. It worked but Does it is a right way to do the same?

Resources