1

I have my Jenkins installed on a windows server and I have created a Jenkins user on the server now I need to push the WAR files to my Linux server to a particular user root (myrootuser) who is there in the sudoers file.

I have access to this server also (myusername) in sudoers files, so I can login using my credentials and su sudo su - myrootuser to gain access.

My question
Can Jenkins user access myrootuser using without being in the sudoers file I tried adding the public key of Jenkns into myrootuser .ssh/ authorized_keys and i added a file know_hosts in the windows server with the Linux server details

EDITED

I have a Linux server with Jenkins on it and that server talks to this Linux server perfectly fine... its public key is present in authorized_keys so I add my windows server key here... but it doesn't work

arieljannai
  • 225
  • 1
  • 3
  • 9
  • Sorry but it's not all clear to me. Are you trying copy war files from one server to another? Do you have any error message? – Daniel PC May 08 '18 at 06:44
  • yes that's what I want to do using jenkins, Unfortunately jenkins throws an bad connection error... so I need the 2 servers to connect before actually trying to send the files over – rohit thomas May 08 '18 at 07:56

3 Answers3

1

you can add access to the folder in linux using chown command where you can add user or group with recursive options, example : chown -R jenkins:root /folderpath also set proper read write permission using chmod or you can use setfacl command setfacl

Vijay Muddu
  • 436
  • 2
  • 9
  • I have a linux server with Jenkins on it and that server talks to this linux server perfectly fine...its public key is present in authorized_keys so I add my windows server key here... but it does'nt work – rohit thomas May 08 '18 at 10:46
1

Like Vijay said, create a shared folder:

mkdir /jenkins

Then create a group to allow the root user and jenkins to share access:

groupadd jenkins

And add the jenkins and root user to it:

usermod jenkins -G jenkins
usermod root -G jenkins

Last chown and chmod the directory to jenkins:

chown jenkins:jenkins /jenkins
chmod 770 /jenkins

Good luck!

Joe M
  • 301
  • 1
  • 4
  • Unfortunately it was more complex than that ... all the above conditions were meet already and it turns out, it required an additional IP address to be mentioned in the access.conf file – rohit thomas May 17 '18 at 03:50
0

So it turns out that the server accept only a particular IP address(other servers).How I found out the issue was by following the below steps:

Firstly, I viewed the issue on client side using -vv

ssh -vv prcsvc@d9t1050g.houston.hp.com

turns out there was no issue on the client side so I moved on to the server side.

To view issue on server side for ssh

vi /var/log/secure

Here i found out that my client server(IP address was being denied) and after some googling I found out that I had to modify the below file

sudo  vi /etc/security/access.conf

You will find the user followed by IP Address e.g myrootuser 10.1.2.3 10.2.3.3

Just add the new client server IP address and your good to go :)
P.S. you need root access or sudo to modify this file