0% found this document useful (0 votes)
60 views3 pages

12 SSH

The document provides instructions for setting up secure shell (SSH) access between two servers. It describes adding a new user and generating an SSH key pair on the first server. It then shows copying the public key to the second server and adding it to the authorized keys file, allowing passwordless login. Finally, it modifies the SSH configuration files on the second server to disable root login and change the SSH port to 2222 to enhance security.

Uploaded by

yessir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

12 SSH

The document provides instructions for setting up secure shell (SSH) access between two servers. It describes adding a new user and generating an SSH key pair on the first server. It then shows copying the public key to the second server and adding it to the authorized keys file, allowing passwordless login. Finally, it modifies the SSH configuration files on the second server to disable root login and change the SSH port to 2222 to enhance security.

Uploaded by

yessir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

SSH

1. On Inxclt2, login as root


Useradd user1
Mkdir p /home/user1
chown user1:users /home/user1
- Login as user 1, create SSH keys, enter passphrase Skills7
#Mkdir ~/.ssh
#Ssh-keygen
User1@Inxclt2: ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
f6:61:a8:27:35:cf:4c:6d:13:22:70:cf:4c:c8:a0:23
2. On Inxsrv1:
- Install openssh on Inxsrv1
#Apt-get install openssh-server
- Assign permission:
#Chmod 777 /var/www/intranet.library-pvmtc.vn
Chown library /var/www/intranet.library-pvmtc.vn
-

Login as intranet
Su intranet
Mkdir .ssh
exit
3. On Inxclt2,
Login as user 1
Su user1
- Copy the public key into the ~/.ssh/upload_key.pub file on the Inxsrv1
scp ~/.ssh/id_rsa.pub [email protected]:/var/www/intranet.librarypvmtc.vn/.ssh/upload_key.pub
4. On Inxsrv1:
- Login as user intranet
Su intranet
- Copy upload_key.pub to authorized_keys

cat ~/.ssh/upload_key.pub >> ~/.ssh/authorized_keys

5. Test result:
- On Inxclt2, login as user1
Su user1
Ssh l intranet 192.168.10.10
- Enter: Skills7 for passphrase

6. Root access is prohibited


Nano /etc/ssh/sshd_config
# Prevent root logins:
PermitRootLogin no

/etc/init.d/ssh restart
Test result:

7. Change port 2222


Nano /etc/ssh/sshd_config

/etc/init.d/ssh restart
Test result:

You might also like