How to input password in ubuntu agent machine while running pipeline - passwords

How to input password in ubuntu agent machine while running pipeline
I am running sudo command for scan in one of our Ubuntu Agent machine. If I run command
sudo <scan-command>
it will ask for a password like [sudo] password for user: so I need to input this password before I trigger my pipeline, because while pipeline running we cannot input password by logging into the server. How to achieve this?

Related

PuTTY SSH reboot command

I am trying to reboot a Unix based machine with SSH on windows.
I am using PuTTY command, it looks like this :
putty.exe -ssh user#my.ip.add.ress -pw password -m reboot.txt -t
And the reboot.txt contains :
reboot
When I am connecting on ssh by myself and use the "reboot" command my machine is rebooting, it is not with the putty command line.
Do you have an idea of a putty command to reboot my machine ?
Thanks a lot !
There are two reasons that I can think of for this to not work.
The putty instance is closing before the reboot times out (60 seconds by default for most systems) which when your connection closes it kills the process. You can resolve this by either sending NOHUP or by forcing reboot immediately with /sbin/shutdown -r now
Your user is not the one processing the script, which the user that is processing the script does not have permissions to shutdown the machine. You can log a whoami from the putty command to see which user is calling shutdown.
Here is a guide on reboot: https://www.cyberciti.biz/faq/howto-reboot-linux/#:~:text=To%20reboot%20Linux%20using%20the%20command%20line%3A,reboot%20%E2%80%9D%20to%20reboot%20the%20box.

Auto-Type sudo password on CentOS 7.9

I have CentOS 7.9 and a SSH Config file which I use to SSH to the hosts in my network. I use a SSH keypair to SSH to the hosts and upon logging in, I run the sudo su command to become root. It then asks me for my password. Is there any way or any tool I can use so I don't have to type my admin password each time? Thank you in advance

gitlab launch shell pipelines with specific user

gitlab_version: 14.1.1-ee
I copied ssh-id to targuet host with the user "user".
When I create a pipeline with "shell" runner I have a problems to comunicate to other hosts by ssh.
I created a simple task with "id" command, this return "root".
How to launch gitlab pipelines with "user" user.
Thank's.
I found how to connect to linux target host with "other user" than "runner user".
Procedure:
Install sshpass on gitlab server host.
On Project_name/settings/"CI/CD"/Variable, create a pass_var with password
string on key value.
On pipeline/editor in script line of .gitlab-ci.yml:
script:
- sshpass -p $pass_var ssh user#host_ip "hostname"

psql: FATAL: Password authentication failed for user “postgres” WINDOWS

I just installed postgresql 9.0 on my pc.
When it ask for password during install, I entered password.
after install I went to command prompt to import a SQL file.
I use the command psql -f filename.sql. This prompts me for a password to which I enter password.
It then complains that authentication failed for user Morne Nel. I dont exist as a user yet.
I then tried psql -h localhost -U postgres to which I enter the password password.
Only to get this message:
FATAL: Password authentication failed for user "postgres"
What Can I do to resolve this madness?
# Could it be that Jasper Reports server might have something to do with it, is also installs prostgres does iet not?
So is seems that Jasper Reports Server was the culprit here.
Jasper was running on port 5432 and Postgres 9.3 was running on port 5433
I knew that it was on port 5433 from install, but I just assumed that if you try and run command prompt commands that it would use the correct port.
So after uninstalling Jasper Reports Server and changing the port number for Posgres 9.3 in the config file to 5432, I restarted my PC and it worked.

Ansible prompts password when using synchronize

I'm using ansible in the following way:
ansible-playbook -f 1 my-play-book.yaml --ask-pass --ask-sudo-pass
After this I'm asked to enter the ssh & sudo passwords (same password for both).
Inside my playbook file I'm using synchronize task:
synchronize: mode=push src=rel/path/myfolder/ dest=/abs/path/myfolder/
For each host, I'm prompted to enter the ssh password of the remote host (the same that I entered in the beginning of the playbook run)
How can I avoid entering the password when executing synchronize task?
If you have setup the ssh keys correctly on the <host>, then the following should work.
ansible all -m synchronize -a "mode=push src=rel/path/myfolder/ dest=/abs/path/myfolder/" -i <host>, -vvv
I was able to get the above working without any password prompt.