How to pass registry user/pass via command line to bootBuildImage? - spring

For the BootBuildImage task, how can we set the docker.publishRegistry username and password via the command line.
./gradlew --imageName=myregistry/myrepo:mytag --????=username --????=password

Related

Run a program from command prompt as a different user and password

How do I run a program from command prompt as a different user and password
This command not good :
runas /user:test cmd
Enter the password for test:
I need a single line order, whit password included
Thank you

sc.exe is not returning output

I have created a PowerShell script for changing password for Windows services.
Using sc.exe in code for the same.
When I execute the script it changed password in few servers but failed for others.
Next, I executed the command directly on the servers to check. The command is not returning anything.
On servers where it was successful, it will return a success message or some error if the password in not changed or if command not proper.
Also, same command is used with same values in all servers. Following is the command:
sc.exe config "$Service" obj= "$UserName" password= "$Password"

Shell script with password in Jenkins

I have created a Jenkins job which executes a shell script. "Unsafe" people can open it and start the job. The job executes a db tool in shell which requires the db password.
The Jenkins instance is run on a computer which can be accessed by "unsafe" people. The job is delegated to a slave which is accessed by "safe" people.
This is a parameterized build, has one parameter: password as Password Parameter.
For the sake of brevity the relevant part of the script is as follows:
#!/bin/bash +x
dban -u username -p ${password}
It runs fine and fails fine if the password is not correct. Echoing the command invoked is disabled by +x as the first line says.
Is this that simple? What else should I consider for safety reasons?
Do you want people to run the build and not have to pass in the parameter of the password? If so you should checkout setting up a credential for it.
https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs
https://github.com/jenkinsci/credentials-plugin/blob/master/docs/user.adoc

Using psexec on a bat file that contains psservice

I have a bat file that tries to stop a service on a remote machine, the file contains the following
psservice \\remoteServerName -u domainName\userName -p password stop serviceName
where userName is a name of a user with Admin privileges on the remote machine.
If I run the last line using cmd then the requested service does stop.
I, however, run the bat file using psexec, since it contains more operation than just stopping the service. This is where my problem occurs:
If I run
psexec -u domainName\userName -p passsword batFilePath
the cmd window seems to get stuck.
But if I run
psexec batFilePath
then the psservice executes correctly.
My problem is that I need the user "domainName\userName" to be able to run the other commands in the bat file.
What can I do ? Why does the cmd got stuck when I gave psexec the parameters of the userName and password ?

run command as other user in unix shell script csh

Assume I am user A(not root user) and I want to run a c-shell script which will execute command in User B(password for B is known to me) and will use the result of that command here.
How can I run a command in User-B.
sudo -u username command1
Above command may prompt for password but I want this to be done in script only.
Thanks for all your suggestions.
you could use a ssh key to allow your user A to log in as user B using user A's private key (and with user A's public key in ~B/.ssh/authorised_keys)
then you simply execute the script as B with:
ssh B#localhost "/path/to/script and maybe some arguments here"
you have following options,
run your command with root so that su - username wont prompt for password
create passordless login for user like passwordless ssh,remove password for user etc. and then run your command
for getting output here to work,
write it in a file and access it in code
store it in a variable and access it in code

Resources