小编典典

Jenkins的默认密码是什么?

jenkins

我正在使用EC2服务器实例。使用以下命令安装Jenkins:

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

但是我需要在Jenkins服务器上安装软件,因此在我的EC2实例中

sudo –s –H –u jenkins

进入詹金斯服务器。然后我试着做

sudo cabal install quickcheck

但是它提示我输入詹金斯密码。我已经在互联网上搜索了4个小时,没有任何东西可以帮助我在jenkins服务器中获得管理特权。

所以我在shell中使用以下命令来构建我的项目:

sudo cabal clean
sudo cabal configure
sudo cabal build
sudo cabal install

这是我得到的错误:

 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/hudson3500373817395137440.sh
+ 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: ***@gmail.com
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:
    java.net.ConnectException: Connection refused
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
    at javax.mail.Service.connect(Service.java:295)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at hudson.tasks.MailSender.execute(MailSender.java:116)
    at hudson.tasks.Mailer.perform(Mailer.java:117)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733)
    at hudson.model.Run.execute(Run.java:1592)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:237)
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
    ... 17 more
Finished: FAILURE

阅读 403

收藏
2020-07-25

共1个答案

小编典典

解决方法如下:

  • 停止詹金斯
  • 去编辑 /var/lib/jenkins/config.xml
  • 更改<useSecurity>true</useSecurity>为false
  • 重新启动詹金斯: sudo service jenkins restart
  • 导航到Jenkins仪表板,找到您以前可能使用过的“配置安全性”选项。这次,设置安全性与以前相同,但是将其设置为allow anyone to do anything,并允许用户注册。
  • 转到www.yoursite.com/securityRealm/addUser并创建一个用户
  • 然后转到allow anyone to do anything您实际上希望用户能够执行的操作。就我而言,是allow logged in users to do anything
2020-07-25