Search
Archives

You are currently browsing the Acidinc Blog blog archives for June, 2016.

Archive for June, 2016

Add newly assigned IP addresses

To add newly assigned IP addresses from SSH, follow this procedure:

(Please follow the steps given below only on a Centos / Fedora.)

  • Login to your server with SSH as root.
  • Go to the /etc/sysconfig/network-scripts directory.
cd  /etc/sysconfig/network-scripts/
  • Verify which interface you will use to add IP addresses. Typically, this will be eth0 for public IP addresses.

/sbin/ifconfig

  • Make a copy of ifcfg-eth0 for each IP you wish to add and name them as ifcfg-eth0:0, ifcfg-eth0:1 etc.
cp ifcfg-eth0 ifcfg-eth0:0 
cp ifcfg-eth0 ifcfg-eth0:1 
cp ifcfg-eth0 ifcfg-eth0:2 
cp ifcfg-eth0 ifcfg-eth0:3 
cp ifcfg-eth0 ifcfg-eth0:4
  • Open each of them and change the fields DEVICE, .IPADDR and NETMASK accordingly.
  • Restart the network:
/etc/init.d/network restart

Disable Password Authentication

Disable Password Auth, Follow these steps….

Once you have SSH Keys configured, you can add some extra security to your server by disabling password authentication for SSH. (Note that if you do lose your private key, this will make the server inaccessible and you will need to contact your host to have this re-enabled.)

To disable this setting, you can do the following:

nano /etc/ssh/sshd_config

In this file, set the following settings to the following values. If these settings are already in the file, set them to “no” rather than add new lines.

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Once this is done, restart the SSH daemon to apply the settings.

/etc/init.d/sshd restart

Save a Public Key on your Centos Server or VPS

Save a Public Key on your Centos Server or VPS

  1. Log in to your destination server
  2. If your SSH folder does not yet exist, create it manually:

mkdir ~/.ssh

chmod 0700 ~/.ssh

touch ~/.ssh/authorized_keys

chmod 0644 ~/.ssh/authorized_keys