can i bind the ip's with the account

alexelixir

Verified User
Joined
Jun 9, 2011
Messages
38
Location
Russia
can i bind the ip's with the user account so that the particular user log in only their mentioned ip all other ip rejected even they have the valid username and password
 
I used this script but there is some error I am facing, File not found.

I checked the file.. It is present in the directory and path I entered in the script.
When I remove the dolar $ {} it wont show any error, but not accepting the sting .

Can you suggest what might be possible error in this. Also can you tell me what is the use of cut in this.
 
Maybe (not tested) should be something like this:

Code:
#!/bin/sh

if ["${username}" = "USERNAME" ]; then

     #repeat the following check on the IP as many times as desired.

     if [ "$caller_ip" = "1.2.3.4" ]; then
         exit 0;
     fi

     #end of ip check

     echo "IP $caller_ip is not allowed to be logged in as an $username";
     exit 1;
fi
exit 0;

Let me know.

Regards
 
if i run the script then this comes
./all_pre.sh: line 3: [: =: unary operator expected
 
Line

Code:
if ["${username}" = "USERNAME" ]; then

should looks like

Code:
if [ "${username}" = "USERNAME" ]; then

a space is missing bettwen [ and ".
 
Back
Top