How to set up SSH key authentication in CentOS 6.4

1. Generate your keys

[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config

[sourcecode language="plain" title="Open sshd_config for editing"]nano /etc/ssh/sshd_config[/sourcecode]

[sourcecode language="plain" title="uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]

[sourcecode language="plain" title="restart the sshd service"]service sshd restart[/sourcecode]

[sourcecode language="plain" title="put your private key in your other environment and test it"]ssh [email protected] -i ~/.ssh/id_rsa[/sourcecode]

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys
ssh-keygen -t rsa -C "[email protected]"

2. Copy public key to authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config
-open up sshd_config (root)
nano /etc/ssh/sshd_config
-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes
#RSAAuthentication yes
#PubkeyAuthentication yes
-restart the sshd service
service sshd restart
-put your private key in your other environment and test it
ssh yourserver.tld -i ~/.ssh/id_rsa

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys
ssh-keygen -t rsa -C "[email protected]"

2. Copy public key to authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

3. Chmod
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys

4. Enable key authentication in sshd_config

-open up sshd_config (root)
nano /etc/ssh/sshd_config

-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes
#RSAAuthentication yes
#PubkeyAuthentication yes

-restart the sshd service
service sshd restart

-test it
ssh yourserver.tld -i ~/.ssh/id_rsa

 

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys
ssh-keygen -t rsa -C "[email protected]"
2. Copy public key to authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3. Chmod

chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys


4. Enable key authentication in sshd_config

-open up sshd_config (root)
nano /etc/ssh/sshd_config
-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes

#RSAAuthentication yes
#PubkeyAuthentication yes

-restart the sshd service
service sshd restart
-put your private key in your other environment and test it
ssh yourserver.tld -i ~/.ssh/id_rsa

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys
ssh-keygen -t rsa -C "[email protected]"

2. Copy public key to authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

3. Chmod
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys

4. Enable key authentication in sshd_config

-open up sshd_config (root)
nano /etc/ssh/sshd_config

-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes
#RSAAuthentication yes
#PubkeyAuthentication yes

-restart the sshd service
service sshd restart

-put your private key in your other environment and test it
ssh yourserver.tld -i ~/.ssh/id_rsa

 

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys

[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config

[sourcecode language="plain" title="Open sshd_config for editing"]nano /etc/ssh/sshd_config[/sourcecode]

[sourcecode language="plain" title="uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]

[sourcecode language="plain" title="restart the sshd service"]service sshd restart[/sourcecode]

-put your private key in your other environment and test it

[sourcecode language="plain"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys
[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config
-open up sshd_config (root)
[sourcecode language="plain"]nano /etc/ssh/sshd_config[/sourcecode]


-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes
[sourcecode language="plain"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]


-restart the sshd service
[sourcecode language="plain"]service sshd restart[/sourcecode]


-put your private key in your other environment and test it
[sourcecode language="plain"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys

[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config
-open up sshd_config (root)

[sourcecode language="plain"]nano /etc/ssh/sshd_config[/sourcecode]

-uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes

[sourcecode language="plain"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]

-restart the sshd service

[sourcecode language="plain"]service sshd restart[/sourcecode]

-put your private key in your other environment and test it

[sourcecode language="plain"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys

[sourcecode language="plain"]
ssh-keygen -t rsa -C "[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config

[sourcecode language="plain" title="Open sshd_config for editing"]nano /etc/ssh/sshd_config[/sourcecode]

[sourcecode language="plain" title="uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]

[sourcecode language="plain" title="restart the sshd service"]service sshd restart[/sourcecode]

[sourcecode language="plain" title="put your private key in your other environment and test it"]ssh yourserver.tld -i ~/.ssh/id_rsa[/sourcecode]

How to set up SSH key authentication in CentOS 6.4

1. Generate your keys

[sourcecode language="plain"]
ssh-keygen -t rsa -C "yo[email protected]"
[/sourcecode]

2. Copy public key to authorized_keys


[sourcecode language="plain"]
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[/sourcecode]

3. Chmod

[sourcecode language="plain"]
chmod 700 ~/ssh
chmod 600 ~/ssh/id_rsa.pub
chmod 600 ~/ssh/authorized_keys
[/sourcecode]

4. Enable key authentication in sshd_config

[sourcecode language="plain" title="Open sshd_config for editing"]nano /etc/ssh/sshd_config[/sourcecode]

[sourcecode language="plain" title="uncomment (remove the #) these lines in /etc/ssh/ssdh_config and write the changes"]
#RSAAuthentication yes
#PubkeyAuthentication yes
[/sourcecode]

[sourcecode language="plain" title="restart the sshd service"]service sshd restart[/sourcecode]

[sourcecode language="plain" title="put your private key in your other environment and test it"]ssh [email protected] -i ~/.ssh/id_rsa[/sourcecode]