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