Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Tuesday, September 17, 2019

Misc. Linux Sysadmin tips

Got around to updating the home office machines, and thought it would be a good idea to keep some recurring tips handy:



Disabling SSH login for root user

  1.  Edit /etc/ssh/sshd_config
  2. Set PermitRootLogin to no (Remove # if present)
  3. Add AllowUsers  
  4. Save, then restart sshd: 
    $ service sshd restart

Setup Passwordless SSH:
  1. Create SSH keypair with options, such as:
    $ ssh-keygen -b 5120
  2. chmod created keypair: 
    $ chmod 600
  3. SCP the public key to target machine.
  4. On target machine:
    $ mkdir ~/.ssh$ chmod 700 ~/.ssh
  5. If ~/.ssh/authorized_keys doesn't exist:
     move the public key from home folder to ~/.ssh/authorized_keys then
    $ chmod 600 ~/.ssh/authorized_keys
  6. If it does exist, then append the public key to the authorized_keys: 
    $ cat >> ~/.ssh/authorized_keys, then delete the public key.
  7. Test by SSHing to the target machine

Editing Hostnames
  1. Edit /etc/sysconfig/network.  modify HOSTNAME= to FQDN
  2. Edit /etc/hosts.  Add IP address with FQDN and shortname
  3. Restart network services:
    $ /etc/init.d/network restart