htaccess ip restriction

Create .htaccess file inside your site folder and copy the below content to .htaccess file and replace "your_site_folder" to your's and also the IP

----------------------------------------------------------------------------------------------------------------------------------------
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/vhosts/your_site_folder/.htpasswd   
#path to htpasswd   
AuthGroupFile /dev/null


Satisfy Any
<Limit GET POST>
    Order Deny,Allow
    Deny from all
    Allow from 192.168.0.5              #(ip needed to be allowed)

    Allow from 192.168.0.6              #(ip needed to be allowed)
    Allow from 192.168.0.7              #(ip needed to be allowed)
    Require valid-user
</Limit>

----------------------------------------------------------------------------------------------------------------------------------------

OR                                                        


The htpassd file can also be added in /etc/apache2/site-available ceare a file in this folder and add the below line to that folder. And below is that if you are using proxy.

<VirtualHost *:80>
      ServerName kir.example.com

    ProxyRequests off

ProxyRequests off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    <Location />
        AuthType Basic
        AuthName "Please Log in"
        AuthUserFile /var/www/myapp/.htpasswd            #path to htpasswd file
        Require valid-user
        Order allow,deny
        Allow from 000.00.00.00
        Allow from 000.00.00.00

        Allow from 000.00.00.00
        satisfy any
        ProxyPass http://localhost:3500/
        ProxyPassReverse http://kir.example.com:3500/
    </Location>

</VirtualHost>

 

Add a User To Group Linux

Add a existing user to existing group :

To add an existing user jerry to sftpjail supplementary/secondary group with usermod command using -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option:
-----------------------------------------------------------------------------------------------------------------------------
usermod -a -G sftpjail jerry
-----------------------------------------------------------------------------------------  
 
To change existing jerry's primary group to lll, enter:

-----------------------------------------------------------------------------------------
usermod -g lll jerry 
-----------------------------------------------------------------------------------------

Errr 'mongo.js:L112 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112'

If you are running Ubuntu, then there is an issue with folder ownership. 

Run these commands:
  1. Stop the MongoDB service
    -------------------------------------------------------------------------------------------------------------------------------
    sudo service mongodb stop
    -------------------------------------------------------------------------------------------
  2. Remove the MongoDB lock file
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo rm /var/lib/mongodb/mongod.lock
    --------------------------------------------------------------------------------------------
  3. Change ownership from root to the MongoDB path
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo chown -R mongodb:mongodb /var/lib/mongodb/
    ---------------------------------------------------------------------------------------------
  4. Start the MongoDB service
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo service mongodb start
    ----------------------------------------------------------------------------------------------
  5. Test the mongo application
    ------------------------------------------------------------------------------------------------------------------------------- 
    mongo 
    ---------------------------------------------------------------------------------------------

Start and Stop ssh-agent

Below is the bash script used to start and stop ss-agent #!/bin/bash ## in .bash_profile SSHAGENT=`which ssh-agent` SSHAGENTARGS="...