Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

Saturday 8 June 2019

AWS SSH and SFTP Disconnected: No supported authentication methods available (server sent: publickey)

Disconnected: No supported authentication methods available (server sent: publickey)

Could not connect to server

Step 1 : Login aws console
Step 2 : Go to instance list
Step 3 : Stop instance which have issue
Step 4 : After stop instance, Click and open "View/Change User Data" (See image)



Step 5 : Add Following code into textarea
 Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
ls -Al
ls -Al /home
ls -Al /home/ubuntu
ls -Al /home/ubuntu/.ssh
sudo cat /home/ubuntu/.ssh/authorized_keys
chown root:root /home
chmod 755 /home
chown ubuntu:ubuntu /home/ubuntu -R
chmod 700 /home/ubuntu
chmod 700 /home/ubuntu/.ssh
chmod 600 /home/ubuntu/.ssh/authorized_keys
ls -Al
ls -Al /home
ls -Al /home/ubuntu
ls -Al /home/ubuntu/.ssh
sudo cat /home/ubuntu/.ssh/authorized_keys
sudo ufw disable
sudo service sshd restart
--//
Step 6 : Click on save button
 Step 7 : Finish! Check your SSH and SFTP detail

Tuesday 28 May 2019

How to connect ssh using PPK file into Cpanel from terminal Ubuntu

Connection command without PPK file
ssh username@146.66.87.208 -p18765
 Connection command with PPK file
ssh -i privatekey.ppk username@146.66.87.208 -p18765 (if not connect with PPK or give an error like "Load key "privatekey.ppk": invalid format" so please use the direct file without PPK format (See the following screenshot) ) (Supported port : 22, 18765, 18675)

Thursday 13 December 2018

How to generate new SSH key and adding it to the ssh-agent

1. Open Terminal
2. Paste the text, change email address. $ ssh-keygen -t rsa -b 4096 -C "jaydipkansagra@example.com"
3. Enter a file in which to save the key (/root/.ssh/id_rsa): [Press enter] (Recommend press enter)
4. Enter passphrase (empty for no passphrase): [Type password] (Recommend keep blank)
5. Enter same passphrase again: [Type password again] (Recommend keep blank)
6. For ubuntu
     Start the ssh-agent - $ eval "$(ssh-agent -s)"
   For windows
     1. $ ssh-agent bash
     2. $ eval "$(ssh-agent -s)" 
7. $ ssh-add ~/.ssh/id_rsa
8. Open  ssh-keygen.pub
9. Copy key from ssh-keygen.pub
10. Add into ssh-agent
11. Now, get data from your repository : git clone git@github.com:whatever

Tuesday 12 December 2017

How to Enable SSL certificate in cloud.google.com

How to Enable SSL certificate in cloud.google.com


Open cloud.google.com
1. Goto your VM instance
2. Click on name of your instance
3. Edit instance
4. Checked "Firewalls Allow HTTPS traffic" and save


5. Goto Network services -> Load balancing -> Edit / add your Load balancer
6. Add / Edit "https protocol" on Frontend configuration and select / create new certificate




7. Again goto your VM instance list
8. Click on SSH



9. After open google cloud ssh window, write "sudo su" on ssh window
10. ssh-keygen
11. gcloud compute ssl-certificates list
12. gcloud compute ssl-certificates describe ssl2111(name of your ssl certificate)
13. nano /etc/apache2/sites-available/default-ssl.conf
Upload certificate files and update path here where you place your SSLCertificateFiles
<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
        <Directory /var/www/html/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>
    DocumentRoot /var/www/html

    ..........
    ..........
    ..........
    ..........
    #SSLCertificateFile     /etc/ssl/certs/ssl-cert-snakeoil.pem
    #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    SSLCertificateFile "/var/www/html/cert/cert.pem"
    SSLCertificateKeyFile "/var/www/html/cert/privkey.key"
    SSLCertificateChainFile "/var/www/html/cert/chain.crt"
    ..........
    ..........
    ..........
    ..........
</VirtualHost>
</IfModule>

14. sudo service apache2 restart
15. gcloud auth login
16. gcloud config set project projectname-010412(Your project id)
17. sudo a2ensite default-ssl
18. service apache2 reload
19. sudo a2enmod ssl
20. sudo service apache2 restart
21. gcloud compute firewall-rules create www-firewall     --target-tags https-tag --allow tcp:443
22. service apache2 reload 

That's It, Please check your SSL