Can't access jenkins user on server - jenkins

Can't access the jenkins user on the server. Server currently running ubuntu 14.04, the user is available for a short period after a restart but is not accessible again after a few minutes.
All builds fail with message Build step 'Execute shell' marked build as failure
Restarting the service also fails as it cannot use the jenkins user that is specified on the server.
The jenkins user is setup to use bash and is available in /etc/passwd

Related

Host key verification failed. Lost connection in Jenkins

I have two servers (AWS-Ubuntu), one is for Devops in which I have installed Jenkins. And in another server I have a dev server. I have built code in the Jenkins server and need to transfer my built files to the dev server.
Added (jenkins)id_rsa.pub key to dev server, restarted SSH service:
cd ${WORKSPACE}/Angular
npm install
cd ${WORKSPACE}/node
npm install
cd ${WORKSPACE}/Angular
npm run build
scp -r /var/lib/jenkins/workspace/project123/Angular/dist/* ubuntu#172.31.14.41:/var/
I expect to transfer files from Jenkins instance to dev server but I am getting this error:
scp -r /var/lib/jenkins/workspace/project123/Angular/dist/openwifi ubuntu#172.31.45.66:/var/www/html/jenkinsdev/Angular/
Host key verification failed.
lost connection
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Host key verification failed error occurs when you try to ssh/scp using the wrong username.
username should be same which is used for establishing ssh.
If above does not help then check the ssh keys are not corrupted or changed for that user.

Session loogging in /etc/profile

The session logging we have in {{/etc/profile}} can interfere with services that launch sub-shells as new users - specifically, it always launches an interactive terminal, regardless of the context, which can cause certain key processes (e.g. Jenkins) from being able to perform critical tasks.
We had a Jenkins version upgrade and after hte upgrade, Jenkins seems to not be able to restart. Here’s what’s happening
```ubuntu#hoatname:~$ sudo service jenkins status
Correct java version found
Jenkins Automation Server is not running
ubuntu#hostname:~$ sudo service jenkins start
Correct java version found
Starting Jenkins Automation Server jenkins jenkins#hostname:~$
jenkins#hostname:~$
jenkins#hostname:~$ sudo service jenkins status
[sudo] password for jenkins:
jenkins#hostname:~$ exit
exit
[fail]
ubuntu#hostname:~$
```
Essentially, it seems that “service jenkins start” is somehow causing a session to be created, which dumps it into a script. I suspect this is due to how /etc/profile contains a script-based session logger, and i suspect that Jenkins is attempting to execute this script when it su’s into its own jenkins user
What should I do to alleviate this?

How to deploy a jar on Windows server through Jenkins job?

We have a jenkins job which is getting triggered after every push to gitlab.
It creates a build. Upon successful build we want to copy the jar to some Windows server.
We are able to set SSH credentials for Linux server. How do we do it for Windows server.
Thanks
Install the slave on windows machine & trigger the .bat file through jenkine's job.

Getting error in SCP plugin in jenkins

I want to deploy my created war automatically to /tomcat/webapps from jenkins scp plugin.
In jenkins ->Manage Jenkins ->configure system
Hostname-deploy port-22 repository- "ipaddress:8080"/usr/bin/scp
Username-jenkins
Error here "Cant connect to server"
password-jenkins
In jenkins->new job ->configure
scp site - deploy
file to upload
source - http://"ip:8080"/var/lib/jenkins/workspace/WebWarDemo/source/**
destination - http://"ip:8080"/usr/share/tomcat6/webapps/
above is my configuration for scp plugin but i am getting error in first configuration as shown.
but when i tried to run the another error is "jenkins scp com.jcraft.jsch.jschexception auth cancel" i tried so many times changing user name no effect plz suggest anything
I am entering username and password of jenkins server user.
Make sure of the following things:
The user with which you are trying to connect to Repository server has "WRITE" access.
SSH connection has been established between the twos servers with public keys of the respective users
Login to jenkins as jenkins user and run the following
ssh repouser#repository server
What do you get?
Let me know if you have ensured these. Will take it ahead from there

is it possible to stop manually dev server from jenkins

my dev server is installed in jboss aplication server(linux). is it possible to stop manually dev server from jenkins. whenever developer wants depolyment at that time only i have to stop server and deploy artifacts in to dev server.All these operations is possible from jenkins.i already have scripts to stop and start the server. But i dont know how to configure in jenkins.
If your jenkins is also on linux, use "Execute shell" build step and in there connect to your server and execute command:
For example:
ssh user#server "remote_script_command"

Resources