Question:

The system admins team of xFusionCorp Industries has set up some scripts on “jump host” that run on regular intervals and perform operations on all app servers in Stratos Datacenter. To make these scripts work properly we need to make sure the thor user on jump host has password-less SSH access to all app servers through their respective sudo users (i.e tony for app server 1). Based on the requirements, perform the following:

Set up a password-less authentication from user “thor” on jump host to all app servers through their respective sudo users.


Solution:

Step 1

# Copy the user thor's public key to tony@stapp01
ssh-copy-id tony@stapp01
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: 
/usr/bin/ssh-copy-id: ERROR: No identities found

# No private and public key found. So lets create one for user thor
ssh-keygen -t ed25519

Step 2

Now copy run ssh-copy-id to copy the public key of user thor to remote server

ssh-copy-id tony@stapp01
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'tony@stapp01'"
and check to make sure that only the key(s) you wanted were added.

Now the pub key is copied to the app server 1. Enable PubkeyAuthentication on app server 1 to login via key pair

# SSH to App server 1
ssh tony@stapp01

# Edit ssh file
sudo vi /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes

# Check or any errors and restart service to apply changes
sudo sshd -t
sudo systemctl restart sshd

# Exit to jump host
exit

Now do the step 2 for App server 2 and 3 as well.

Step 3

Now lets test our configuration

# SSH from jump host => App server 1
thor@jump-host ~$ ssh tony@stapp01
Last login: Sun Nov  1 14:11:58 2026 from 10.244.30.51
[tony@stapp01 ~]$ whoami
tony
[tony@stapp01 ~]$ exit
# SSH from jump host => App server 2
thor@jump-host ~$ 
thor@jump-host ~$ ssh steve@stapp02
Last login: Sun Nov  1 14:12:12 2026 from 10.244.30.51
[steve@stapp02 ~]$ whoami
steve
[steve@stapp02 ~]$ exit
# SSH from jump host => App server 3
thor@jump-host ~$ ssh banner@stapp03
Last login: Sun Nov  1 14:10:09 2026 from 10.244.30.51
[banner@stapp03 ~]$ whoami
banner
[banner@stapp03 ~]$ exit

By shafdo

Leave a Reply

Your email address will not be published. Required fields are marked *