Skip to content

Instantly share code, notes, and snippets.

@leommoore
Last active December 17, 2015 23:38
Show Gist options
  • Save leommoore/5690176 to your computer and use it in GitHub Desktop.
Save leommoore/5690176 to your computer and use it in GitHub Desktop.
Linux - Basic Security

#Linux - Basic Security

##Restricting Remote IP Addresses

It is always a good idea to restrict the access to users and hosts that you trust. To do this you need to:

Edit the /etc/hosts.deny and create a rule

sshd: ALL

This will deny access to all hosts. Next, edit the /etc/hosts.allow file and add:

sshd: 192.168.1 201.130.177.31

This will give access to the 192.168.1.0/24 network and the 201.130.177.31 host.

More information on the syntax for hosts.allow and hosts.deny can be found on man hosts_access. Information on additional options can be found on man hosts_options.

##Package Installation

It is strongly encouraged that you should not to do package management with sudo. Packages can run arbitrary scripts, which makes using sudo when running a package manager command is a security risk.

Rather, it is recommended that you first ensure that you have rights to the /usr/local directory. You can do using:

sudo chown -R $USER /usr/local

Where $USER is your username.

That sets your user account as the owner of the /usr/local directory, so that you can just issue normal commands in there. Then you won’t ever have to use sudo when you install node or issue npm commands.

It’s much better this way. /usr/local is supposed to be the stuff you installed, after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment