Explore Courses Blog Tutorials Interview Questions
+3 votes
in AWS by (12.9k points)
edited by

I'm using a EC2 server instance. Used the following to install Jenkins:

wget -q -O - | sudo apt-key add -

sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'

sudo apt-get update

sudo apt-get install jenkins

but I need to install software on the Jenkins server so in my EC2 instance I did

sudo –s –H –u jenkins

to get into the jenkins server. Then I tried to do

sudo cabal install quickcheck

but it prompted me for jenkins password. I've been searching around the internet for 4hrs now and nothing is helping me get administrative privilege in the jenkins server.

So I'm building my project using the following command in shell:

sudo cabal clean

sudo cabal configure

sudo cabal build

sudo cabal install

This is the error I'm getting:

 Started by timer

Building in workspace /var/lib/jenkins/jobs/Finance/workspace

Checkout:workspace / /var/lib/jenkins/jobs/Finance/workspace - hudson.remoting.LocalChannel@eea6dc

Using strategy: Default

Last Built Revision: Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

Fetching changes from 1 remote Git repository

Fetching upstream changes from origin

Commencing build of Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

Checking out Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master)

[workspace] $ /bin/sh -xe /tmp/

+ sudo cabal clean

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: no tty present and no askpass program specified

Sorry, try again.

sudo: 3 incorrect password attempts

Build step 'Execute shell' marked build as failure

Sending e-mails to: [email protected]

ERROR: Could not connect to SMTP host: localhost, port: 25

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;

  nested exception is: Connection refused

    at com.sun.mail.smtp.SMTPTransport.openServer(

    at com.sun.mail.smtp.SMTPTransport.protocolConnect(

    at javax.mail.Service.connect(

    at javax.mail.Service.connect(

    at javax.mail.Service.connect(

    at javax.mail.Transport.send0(

    at javax.mail.Transport.send(

    at hudson.tasks.MailSender.execute(

    at hudson.tasks.Mailer.perform(

    at hudson.tasks.BuildStepMonitor$1.perform(

    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(

    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(

    at hudson.model.Build$BuildExecution.post2(

    at hudson.model.AbstractBuild$

    at hudson.model.Run.execute(


    at hudson.model.ResourceController.execute(


Caused by: Connection refused

    at Method)






    at com.sun.mail.util.SocketFetcher.createSocket(

    at com.sun.mail.util.SocketFetcher.getSocket(

    at com.sun.mail.smtp.SMTPTransport.openServer(

    ... 17 more

Finished: FAILURE

2 Answers

+4 votes
by (18.2k points)

Follow the below-mentioned steps to fix your error:

1. Stop Jenkins

2. Go to edit the config file. Path:/var/lib/jenkins/config.xml

3. Change the "use security" setting from true to false

4. Go to Jenkins dashboard and navigate to the configure security option, set it to "allow anyone to do anything" and allow user signup

5. Create a user on:

6. Go back to Jenkins dashboard and to configure security and change it from "allow anyone to do anything" to what you want your users to be able to do.

by (12.9k points)
Nice explanation. Thanks!
+4 votes
by (108k points)

Just perform the following command:

sudo passwd jenkins

This should display the password of your Jenkins

by (12.9k points)
This works for me Thanks!

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories