Authorize Your IP by Editing .htaccess Using vim

give permission to IP address AWS

If you are involved in a large project, you often have permission restrictions to certain servers. This time, I will introduce how to add your own IP to a server that has IP address restrictions.

Specify the target server and log in to the bastion server

For details on ssh login to the bastion server, refer to the previous post.

First, let’s ssh login to the bastion server.

In this case, local port 31313 on the local client is being forwarded to the same port (22) of the given remote server.

ssh -L 31313:YYYYYY:22 mickey.mouse@XXXXXXXXXX -i C:\Users\t_yam\.ssh\aaaaaaaa.pem

If something like the following is displayed, login is successful.

Open a second terminal and enter the following code.

Now use the same number as the 31313 you specified earlier.

ssh pf@localhost -p 31313 -i C:\Users\t_yam\.ssh\aaaaaaaa.pem

Move to the target directory

Go to the directory you want to give permissions to (www this time)

Add your IP to .htaccess

[pf@disney-ec2 10:25:31 admin_tool]$ ls -al

This time, use the ls -al command to display files name and their details.

Open .htaccess with vim

After opening vim, first press “i” to switch to insert mode and add the address you want to add authority to in the red line.

When the addition is finished, exit the insert mode with “esc”, save with “: wq” and exit.

IP [Options]

  1. -a Show all files, including hidden files
  2. -A Shows all files, including hidden files
  3. “.” “..” is not displayed
  4. -F Display the file name / directory name with a symbol indicating the type.
    (/: Directory, *: Executable)
  5. -i i Show node number
  6. -l Show file details as well as file name
  7. -m Show file / directory names separated by commas
  8. -r Display the order in reverse
  9. -R Recursively display file / directory names
  10. -S Display in descending order of size
  11. -t Display update time in chronological order
  12. -1 Display only the file name vertically
  13. –help Get help for the command
  14. –full Show detailed update date and time

Recommend

Linux Command Cheat Sheet

ALLOWING AND DENYING WEBSITE ACCESS USING .HTACCESS

タイトルとURLをコピーしました