I'm Keytaro from JK (Java writing) who has been a system engineer for 10 months! This is a story of a failure when I took my recently purchased MacBook Pro to a friend's house and messed with it while drinking. Please listen loosely.
After having a meal with a friend for the first time in a long weekend, I decided to have a drinking party at my friend's house. While opening the MacBook Pro, I was drinking the usual drink (Kakuhaikin) while talking about uncertainties. And for some reason I wanted to brag to my friends.
Kitaro "By the way, I've been able to make a server in seconds recently." Friend "How?" Keytaro "You can easily start a server by using EC2 Teuedaburyuesu?" My friend "Wow !!!!!!!!!!!!!!!!" Kitaro "Did I do something again? Lol"
How to launch EC2 on mac 1: Select EC2 from the AWS Management Console and create a key pair. 2: Download the created private key (pem). 3: Change the key authority.
chmod 400 ●●●●●.pem
4: Execute the ssh command.
ssh [email protected] -i ●●●●●.pem
5: The server runs.
__| | ) | ( / Amazon Linux 2 AMI |_||
I explained it roughly, but it looks like this.
After that, I was proud of it, so I created a directory to store the key, and after creating it, I decided to move the key and put it into practice. I don't know that the rainy season will cause a tragedy ...
Key Taro (Drunk) "It's kind of like just leaving the key out, so why not create a directory and manage it?" Keytaro (Drunk) "First, let's make a directory" Keitarou "It must have been mkdir or touch to create a directory ..."
Key Taro "Then move the key in the current directory ..." Keytaro "I'm reincarnated in another world with the mv command !!!"
mv ●●●●●.pem /●●/●●/SSH/
Keytaro "Run ... Yeah! It looks like I was able to run it without any errors." Kitaro "Well, I've finished my work safely and can I open it with a toast?"
After that, I will try to make a ssh connection again for the time being while feeling a sense of accomplishment. First try to move to the SSH directory that contains the key.
Key Taro "Move ... that?"
cd: not a directory: ●●●●●.pem
Keitarou "It's not a directory ...? What do you mean? Is it a problem with access privileges? No, the terminal tells me that it's not a directory ..."
After that, I tried every means and couldn't move to that directory.
Keytaro "Ahhhhhh ... it's over. It's completely packed. If you can't put it in the directory, you won't be able to retrieve the key ..."
Well, if you have a good feeling, you may have noticed the first one. That's right. This tragedy is due to the touch command, which was the first command executed.
The touch command is a command to change the time stamp of a file, and it has a function to create a new file without contents by specifying a file name that does not exist. Please google for details.
Organize from the beginning.
In the current directory
The current directory after executing the touch SSH command is
I thought that the touch command was a command to create a directory, and I recognize SSH as a directory. Then run the mv command to move the key to the SSH directory.
mv ●●●●●.pem SSH
Again, there are serious problems. The mv command is a command that can be renamed as well as moved! In other words ...
mv File name you want to change Name you want to change
So the above command I executed was perceived as a command to rename rather than move. Lol lol After changing the name, there will be a file with the same name as SSH, so the old SSH file will be overwritten by the new SSH file which is the key changed to SSH. In that case, only the word SSH remains in the current directory ... It looks as if the key was successfully moved to the SSH directory.
The current directory after executing the mv command is
/ ** The directory named SSH does not exist, only the ●●●●● .pem named SSH exists * / SSH
I was so drunk that I didn't realize it, and I had the illusion that the key had been reincarnated in a different world in a mysterious directory I created called not a directory.
Did I do something again?
● Learning from this incident ・ Be very careful when moving important files. -Execute the command after understanding the command accurately. ・ Do not work while drinking alcohol.
afterwards··· Kitaro "What was this ... I feel like I was wrapped in a fox." My friend "I think it's a directory if you don't have .txt or .html.java at a glance." Kitaro "Well, I was able to experience a pseudo-different world reincarnation, lol !!!" Friend "committee!"
that's all. Thank you very much for reading this bad sentence. If you notice something, or if you have any questions, please feel free to send us a comment.