#1 Download SSH client Putty & Putty gen
puttygen optional to generate keys in local machine.
1.2 Obtain IP Address & root Password of the server
if not, you can add ssh Key by their dashboard like google cloud, Digital ocean etc.
or you can directly login without any credentials from hosting provider dashboard with their building ssh client.
SSH connection through putty using root & password
enter your ip address and select port as 22, (21 for fTp).
Once its asks name enter root (any username if it is has root privileges)
then asks you enter the password.
once you login to
yournamme@machine# will appears
but you need to learn linux commands here
Generating SSH keys & pairing between remote machine
#1. Generating SSH keys on remote server
ssh-keygen -t rsa
or you can add encryption strength 1024, 2048, 4096 etc
root@instance-1:~# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:TooN6YdwYieraczFb+uL0wYxuEgcXsNPpuQK4OPxM9U root@instance-1 The key's randomart image is: +---[RSA 2048]----+ | . | |.. = o | |= * * . | |.O = + E | |= % O S | |.= / = + | |o o X + . | | * ..* | |+ .=+o | +----[SHA256]-----+
public key location /root/.ssh/id_rsa.pub.
. .cache boot etc lib lib64 lost+found mnt proc run srv tmp var
.. bin dev home lib32 libx32 media opt root sbin sys usr
root@instance-1:/# cd root
root@instance-1:~# ls -a
. .. .bashrc .profile .ssh
root@instance-1:~# cd .ssh
root@instance-1:~/.ssh# nano authorized_keys
#2 Connecting to Remote server & copying public key
Note: public key at Target machine (server)
Private key at source machine (local)
a. connection
ssh user@remoteip
ssh root@192.168.0.1 if ssh key it will ask you to yes or no
it asks root password , once you enter the root password.
it will allow to communicate.
after connection use SCP command
scp /var/www/bak.zip root@192.168.0.1: /var/www/
scp /var/www/html/srt.sql root@192.168.0.1:/var/www/html
Copying Public key to Authorized_keys .
we use cat command to append at end of the file or you can manually edit using nano.
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Beware: you must file path.
Then You may follow syncing & copying between 2 servers.
SSH Folder & keys file permission
File permissions should be
750 for folder &
640 for files.
How to use ssh-keygen to generate a new SSH key
- download puttygen
- click on generate keys
- just drag by mouse it will generate public & priate keys.
Copy the Prite keys to root/.ssh/authrized_keys
Manual through sftp client winscp
command line by nano command.
Restart SSHD if needed
sudo systemctl restart sshd.service
Enable / disable root password login in SSH
nano /etc/ssh/sshd_config
allow root password login = yes
comment or uncomment change no or year depending on your need.
its better to turn off root password to avoid attacks.
sudo service sshd reload
Download winscp SFtp as for file Transfers
we can do file transfer by SCP & CP command . But the winscp gies a look of file manager just like cpanel.
- Download & install winscp.
- Open winscp and click add new site.
- Enter Ip address & Port
- Enter Username
- Password leave it blank if you already added Public key at server .
- click on Advanced and advanced>>SSH>> authenticate key browse for the private key and Save.
- or if you not yet added the public to the serer.
- by hosting provider dashboard ft gce,digital ocean etc
- login with root & password add key check connection then disable password
- Hosting provider default ssh client
Copy the Private key from server or generate private key pair form puttygen.
putty integration with winscp
download and install putty , then winscp automatically uses for command line interface.
winscp+putty (must).
other popular SFTP & FTP clients for windows
Filezilla etc
Creating SSH Keys for non root users
user able to login to /home/user/
after user login
generate key
the ssh directory basically already created in user directory.
.ssh
/home/user/.ssh/keys
root@instance-1:/home# cd ubuntu root@instance-1:/home/ubuntu# ls -a . .. .bash_logout .bashrc .profile .ssh root@instance-1:/home/ubuntu# cd .ssh root@instance-1:/home/ubuntu/.ssh# ls -a . .. authorized_keys root@instance-1:/home/ubuntu/.ssh#
linux users & group management
//////////////////// ////
Troubleshooting
Incorrect public & private keys for User
Reasons: File Permissions assign directory & files with Correct permissions.
VSFTPD FTP client installation
Install VSFTPD on the server