❌

Reading view

There are new articles available, click to refresh the page.

SSH – A View

SSH, also known as Secure Shell or Secure Socket Shell, is aΒ network protocolΒ that gives users, particularly system administrators, a secure way to access a computer over an unsecured network.

By default SSH is installed in linux.We can check the version by using this below command.

ssh -V

Otherwise we can install it by..,

sudo apt install openssh-server openssh-client
sudo systemctl status ssh

Also we can check the status of SSH.The default Port Number assigned by ssh is 22.We can change it in the configuration file also we can allow or deny users or groups and Alive Interval in the configuration file.
NOTE :
Restart the ssh after configured.

nano /etc/ssh/sshd_config
AllowUsers user_name
AllowGroups group_name

To allow permissions to specific users and groups to access ssh.

DenyUsers user_name
DenyGroups group_name

To deny the permission to specific users and groups.

LoginGraceTime specify_time

(i.e) 1m ==> 1 minute.
If a user can’t make a successful login with the specific time,it will not allow the user to enter into the remote machine.

ClientAliveInterval 600
ClientAliveCountMax 0 ==> Default it is zero.

(i.e) 600 ==> 600 seconds = 10 minutes.
The tunnel will break after the mentioned time (600 seconds) if there is no actions were performed by the user in the server.

NOTE: Restart the service once changes are made in configuration file.

ssh user_name@remote_ip
ssh user_name@remote_hostname -p port_number

To connect to the ssh server we must need three credentials of the remote machine.

  • Username.
  • Password.
  • Ip Address or Hostname.
scp file_to_transfer user_name@hostname:/path_to_copy_the_file_in_remote_server

scp -P specific_port_number file_to_transfer user_name@hostname:/path_to_copy_the_file_in_remote_server ===> For using Port Number other than 22.

Example : scp hello.go student@ip_address:/home/student/Checking_scp_command/
scp -P 2027 hello.go student@ip_address:/home/student/Checking_scp_command/

SCP ==> Secure Copy.
To copy a file securely to the remote server’s directory named β€œChecking_scp_command”.

scp user_name@hostname:/path_of_the_file/file /path_to_copy_in_local_system

scp -P specific_port_number user_name@hostname:/path_of_the_file/file /path_to_copy_in_local_system ===> For using Port Number other than 22.

Example : scp student@ip_address:/home/student/Checking_scp_command/Remote_to_Local.txt /home/g/Downloads/
scp -P 2027 student@ip_address:/home/student/Checking_scp_command/Remote_to_Local.txt /home/g/Downloads/

In this command,we are going to get the file from remote server to our local system.

NOTE:

There is a command called β€œssh-keygen” which generates a unique key for accessing the remote server via local system.
This never ask passwords to enter into the system,But be careful of handling this key.If you are not familiar with this method,just practice with the password type few times.
Keygen will be discussed later in our next post.Stay tuned…

That’s it..!

SSH – A View

SSH, also known as Secure Shell or Secure Socket Shell, is aΒ network protocolΒ that gives users, particularly system administrators, a secure way to access a computer over an unsecured network.

By default SSH is installed in linux.We can check the version by using this below command.

ssh -V

Otherwise we can install it by..,

sudo apt install openssh-server openssh-client
sudo systemctl status ssh

Also we can check the status of SSH.The default Port Number assigned by ssh is 22.We can change it in the configuration file also we can allow or deny users or groups and Alive Interval in the configuration file.
NOTE :
Restart the ssh after configured.

nano /etc/ssh/sshd_config
AllowUsers user_name
AllowGroups group_name

To allow permissions to specific users and groups to access ssh.

DenyUsers user_name
DenyGroups group_name

To deny the permission to specific users and groups.

LoginGraceTime specify_time

(i.e) 1m ==> 1 minute.
If a user can’t make a successful login with the specific time,it will not allow the user to enter into the remote machine.

ClientAliveInterval 600
ClientAliveCountMax 0 ==> Default it is zero.

(i.e) 600 ==> 600 seconds = 10 minutes.
The tunnel will break after the mentioned time (600 seconds) if there is no actions were performed by the user in the server.

NOTE: Restart the service once changes are made in configuration file.

ssh user_name@remote_ip
ssh user_name@remote_hostname -p port_number

To connect to the ssh server we must need three credentials of the remote machine.

  • Username.
  • Password.
  • Ip Address or Hostname.
scp file_to_transfer user_name@hostname:/path_to_copy_the_file_in_remote_server

scp -P specific_port_number file_to_transfer user_name@hostname:/path_to_copy_the_file_in_remote_server ===> For using Port Number other than 22.

Example : scp hello.go student@ip_address:/home/student/Checking_scp_command/
scp -P 2027 hello.go student@ip_address:/home/student/Checking_scp_command/

SCP ==> Secure Copy.
To copy a file securely to the remote server’s directory named β€œChecking_scp_command”.

scp user_name@hostname:/path_of_the_file/file /path_to_copy_in_local_system

scp -P specific_port_number user_name@hostname:/path_of_the_file/file /path_to_copy_in_local_system ===> For using Port Number other than 22.

Example : scp student@ip_address:/home/student/Checking_scp_command/Remote_to_Local.txt /home/g/Downloads/
scp -P 2027 student@ip_address:/home/student/Checking_scp_command/Remote_to_Local.txt /home/g/Downloads/

In this command,we are going to get the file from remote server to our local system.

NOTE:

There is a command called β€œssh-keygen” which generates a unique key for accessing the remote server via local system.
This never ask passwords to enter into the system,But be careful of handling this key.If you are not familiar with this method,just practice with the password type few times.
Keygen will be discussed later in our next post.Stay tuned…

That’s it..!

OpenSSH Server Day 14

The Secure Shell Protocol (SSH) is a network protocol for operating network services securely over an unsecured network.

OpenSSH is the connectivity tool for remote login with the SSH protocol.


Installing openSSH in both client and server machines

apt install openssh-server openssh-client

To check status of openssh

systemctl status ssh


Remote login from local machine


Disabling Root Login

Make configuration changes in /etc/ssh/sshd config to disable root login.

set PermitRootLogin to no

restart ssh to apply changes

systemctl restart ssh

Modifying default port to 2222 from 22

Make configuration changes in /etc/ssh/sshd config to change default port to 2222.

Allow/Deny users or groups

Make configuration changes in /etc/ssh/sshd config


No Password login with public/private rsa key pair

Generate key to login without password

ssh-keygen

Sharing Public key to enable Password less login

id_rsa is the private key

id_rsa.pub is the public key

copy key to remote server
ssh-copy-id -i id_rsa.pub -p 2222 kaniyam@remote_server

verify public key in remote server


Execute command from local/client

commands like touch, mkdir, and rmdir could be executed form local.


SCP command

Secured copy let copying of files to and from server to local


OpenSSH Server Day 14

The Secure Shell Protocol (SSH) is a network protocol for operating network services securely over an unsecured network.

OpenSSH is the connectivity tool for remote login with the SSH protocol.


Installing openSSH in both client and server machines

apt install openssh-server openssh-client

To check status of openssh

systemctl status ssh


Remote login from local machine


Disabling Root Login

Make configuration changes in /etc/ssh/sshd config to disable root login.

set PermitRootLogin to no

restart ssh to apply changes

systemctl restart ssh

Modifying default port to 2222 from 22

Make configuration changes in /etc/ssh/sshd config to change default port to 2222.

Allow/Deny users or groups

Make configuration changes in /etc/ssh/sshd config


No Password login with public/private rsa key pair

Generate key to login without password

ssh-keygen

Sharing Public key to enable Password less login

id_rsa is the private key

id_rsa.pub is the public key

copy key to remote server
ssh-copy-id -i id_rsa.pub -p 2222 kaniyam@remote_server

verify public key in remote server


Execute command from local/client

commands like touch, mkdir, and rmdir could be executed form local.


SCP command

Secured copy let copying of files to and from server to local


❌