Check SSH connection
Below are the steps to verify that our system is successfully authenticated using ssh
Command : pgrep -l ssh-agent
pgrep -l ssh-agentpgrep: A command-line utility used to find and list processes based on their name.p: Stands for "process."grep: Stands for "global regular expression print." In this context, it searches for processes.
-l: A flag that tellspgrepto list the process name alongside the process ID (PID).Example: Output will look like
12345 ssh-agent.
ssh-agent: The name of the process we are searching for. It manages private keys and helps with SSH authentication.
Purpose: This checks if the ssh-agent process is running and displays its PID and name if found.
Command : eval "$(ssh-agent -s)"
eval "$(ssh-agent -s)"eval: A shell command that evaluates the arguments as a shell command. It processes the result as if it was directly typed in the terminal.Purpose: To execute the output of a command dynamically.
$(): Command substitution. It runs the command inside the parentheses and replaces it with the output.Inside
$():ssh-agent: Starts the SSH authentication agent.-s: Outputs environment variables in a shell-friendly format. These variables are essential for the SSH client to communicate with the agent.
Result: Sets up the
SSH_AUTH_SOCKandSSH_AGENT_PIDenvironment variables so that the shell can interact with thessh-agent.
Command : ssh-add ~/.ssh/myGitHubProjects/id_rsa_sj_github
ssh-add ~/.ssh/myGitHubProjects/id_rsa_sj_githubssh-add: Adds a private key to the runningssh-agentfor authentication.Purpose: Enables the agent to manage this key, allowing you to use SSH without re-entering the passphrase repeatedly.
~: Represents the home directory of the current user./.ssh/myGitHubProjects/: A path to the directory where SSH keys are stored. This is specific to your setup.id_rsa_sj_github: The private key file for your GitHub project. Private keys are used for authenticating with Git servers.
Command : ssh-add -l
ssh-add -lssh-add: Same as above but used with a different flag.-l: Lists all the identities (keys) currently managed by thessh-agent.Output: Displays the public key fingerprint and comment for each key.
Command : ssh -T [email protected]
ssh -T [email protected]ssh: Secure Shell protocol used for secure communication between systems.-T: Disables the pseudo-terminal allocation.Purpose: Prevents interactive login since we are testing authentication.
[email protected]: The SSH username and hostname of the GitHub server.git: The default user for GitHub SSH connections.github.com: The hostname of GitHub.
Purpose: Tests whether the SSH connection to GitHub is successful.
Command : git clone [email protected]:sv10joshi/ComposePlayground.git
git clone [email protected]:sv10joshi/ComposePlayground.gitgit: The Git version control system command.clone: A Git subcommand to copy a repository from a remote source to your local machine.[email protected]:: Specifies the SSH protocol and repository host. It follows the formatuser@host:.git: The SSH user.github.com: The hostname of the GitHub server.:: Separates the host from the repository path.
sv10joshi/ComposePlayground.git: The repository to be cloned.sv10joshi: The GitHub username or organization name owning the repository.ComposePlayground.git: The specific repository name, with.gitindicating it is a Git repository.
please: (Optional, not part of the actual command): The local directory where the repository will be cloned. This is specific to your setup.
Would you like me to expand on any specific part, or was this detailed enough?
Last updated