Skip to main content

Jenkins: SSH connect with username and password to AWS Linux instance

Jenkins 2.46.1 does not support to have a ssh connection with default pem file from aws. To do the automatically deployment from Jenkins server, a ssh connection should be establish from Jenkins server to the instance.These are steps to do to enable the SSH connection:AWS instance:
  • Create a new user on the instance
  • Edit the SSH config file to enable Password authentication for SSH and especially, specify some special encryption algorithms that supports Jenkins 
File: /etc/ssh/sshd_config


Put this at the end of the file

KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

Use the new created user for Jenkins  

Comments

Popular posts from this blog

HTTP_REFERER

A friend of mine ask me if a server can know where we come from before we go to that server (referal link). YES. This information is the field "HTTP_REFERRER" in $_SERVER of the coming request. Here is an example: http://113.161.96.198/referal/ For the reason of SEO, some guys do not want any server know about this referal link that points to their own server. Here are some solutions: HTML5: Add norefer attribute   No REFERRER PHP redirect: <?php header( 'Location: http://113.161.96.198/referal/ ' ) ; ?> .... lot of solutions lol

PHP json_encode return empty array [] instead of empty object {}

Problem: Get below array for example.  $status = array ( "message" => "error" , "club_id" => $_club_id , "status" => "1" , "membership_info" => array (), ); This array will be encoded in json format echo json_encode($status); This function return json: {"message":"error","club_id":275,"status":"1","membership_info": [] } Notice the empty array [], it is not consistent, it should be an empty object {} {"message":"error","club_id":275,"status":"1","membership_info": {} } The cause: This problem is caused by the called function array(), which yields an empty array [] Solution: There are 2 solutions for this issue: Solution 1: Call new stdClass instead of array(), stdClass generates an empty object {} Solution 2: The above solution is complex in case there are plenty of arr

SQL query optimization

SELECT query {EXPLAIN | DESCRIBE | DESC}  We usually use this command to check to see if how many rows the query goes through. Especially for the INDEX column checking. Search LIKE '%key%' consumes more resource than LIKE 'key%' Denormalisation This database design helps to speed up the data reading. Because the SQL query no need to join data between tables.