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]

It worked!

Now running a VPS for JoeJiko.com with CentOS 6.4.
My colleague said I should've gone with Debian.. but he was too late.

The process was mostly flawless, except a few problems with iptables.

I followed the guide to install Centos 6.4 with Apache
(I tried nginx first but it was so unfamiliar that I decided to go with Apache for now until I can test more)

http://www.howtoforge.com/perfect-server-centos-6.4-x86_64-apache2-dovecot-ispconfig-3

 

I was stuck for awhile trying to get ISPconfig3's interface to show up. Every time I tried to access :8080, the connection timed out.
Of course, it had to do with the firewall. I disabled that using system-config-firewall and it worked!

 

Also found these useful in my journey:

MySQL commands

http://www.pantz.org/software/mysql/mysqlcommands.html

 

Add Linux user with document root permissions

http://www.rackspace.com/knowledge_center/article/how-to-add-linux-user-with-document-root-permissions

It worked!

Now running a VPS for JoeJiko.com with CentOS 6.4.
My colleague said I should've gone with Debian.. but he was too late.

The process was mostly flawless, except a few problems with iptables.

I followed the guide to install Centos 6.4 with Apache
(I tried nginx first but it was so unfamiliar that I decided to go with Apache for now until I can test more)

http://www.howtoforge.com/perfect-server-centos-6.4-x86_64-apache2-dovecot-ispconfig-3

 

I was stuck for awhile trying to get ISPconfig3's interface to show up. Every time I tried to access :8080, the connection timed out.
Of course, it had to do with the firewall. I disabled that using system-config-firewall and it worked!

 

Also found these useful in my journey:

MySQL commands

http://www.pantz.org/software/mysql/mysqlcommands.html

 

Add Linux user with document root permissions

http://www.rackspace.com/knowledge_center/article/how-to-add-linux-user-with-document-root-permissions

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 "[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]

Linux - Manually mount a drive to shared location

Format drive and create desired permissions (GParted)

List drives with uuid
sudo blkid
ls -l /dev/disk/by-uuid
lsblk -f

Create folder wherever you want to access the drive with correct permissions
mkdir /media/data.ext2

Add to fstab (This will automatically mount it as desired on startup)
sudo edit /etc/fstab
UUID=f48dc231-02 /media/data.ext2 ntfs-3g permissions,auto 0 0

Remount
sudo mount -a