{ "video": "wzp9StCgvgk", "seconds": 204, "title": "Connect to Oracle Cloud VM (Mac OS)", "prior": "Create Compute Instance", "transcript": "In this video, we'll see how to connect to a virtual machine in the Oracle Cloud from the Macintosh operating system. I'll assume you already have a virtual machine running. If not, check out the videos listed above.\r\n\r\nIn a previous video, I've already downloaded the private key file created when I configured the virtual machine.\r\n\r\nNow, I'll launch the Mac OS terminal by typing \"command space,\" then entering \"terminal\" and pressing the \"return\" key.\r\n\r\nI can see that my current working directory is the home directory for my user account. That's good, because to make accessing my VM easy, I'll want to put that private key file in the expected location. It belongs in a folder called .ssh in my home directory. Let's see if that folder is already here by trying to make it the active directory.\r\n\r\nI'll type \"cd .ssh.\"\r\n\r\nI got an error message telling me that the directory does not exist. I'll create it by typing \"mk dir dot ssh.\"\r\n\r\nNow, I'll activate that directory by typing \"cd .ssh\" again.\r\n\r\nNext, I'll open finder in this folder by typing, \"open\", \"dot\", so I can move my private key file to the \".ssh\" directory. I'll also open the folder that holds the key files I downloaded when building the VM. Even though I don't really need the public key file to be here, I'll keep them together by moving them both.\r\n\r\nI should be able to see these files in terminal now, so I'll ask for a directory listing of the current folder. \r\n\r\nIt looks as though they are here. \r\n\r\nWhen I try to connect to the remote VM, the secure shell client will automatically try to use this private key for authentication if it is in the .ssh folder and named i d, _, r s a, so I'll rename it now with the \"mv\" command.\r\n\r\nThis private key file should not be accessible by anyone but me, after all, it's private. Before I can use it to connect, I must change the permissions so that I'm the only one with access.\r\n\r\nIn this prior listing, this \"are\" indicates that any user is allowed to read this file. This one indicates that users in the \"staff\" group are allowed to read it and this one indicates that my user can read it. That's not secure enough. \r\n\r\nI'll change it so I alone am allowed to read it by executing the command \"c h m o d, 400, id_rsa.\"\r\n\r\nAnother directory listing will show that now I'm the only one with access to read this file.\r\n\r\nI'm ready to connect to the VM, so I'll make my user's home folder the active directory by entering \"cd dot-dot.\"\r\n\r\nNow I'll connect to my VM using the ssh client by typing \"ssh\" followed by the username, which is \"opc.\" Then I'll type the, \"@,\" sign followed by the public IP address of my VM and press \"return.\"\r\n\r\nThe first time I connect to a new machine, the ssh client prompts me to be sure I want to connect. I'll type y e s and press \"return.\"\r\n\r\nIt looks as though I'm connected. Here's the machine name I chose when I configured the machine. I'll check my current working directory. Sure enough, I'm in the home folder of the opc user. To end my remote session with the VM, I'll type \"exit,\" and press \"return\".\r\n\r\nThe connection is closed and I'm back at my terminal prompt on my local computer.\r\n\r\n", "code": [ { "summary": "Commands", "detail": "cd .ssh\r\nmkdir .ssh\r\ncd .ssh\r\nopen .\r\nls -al\r\nmv ssh-key id_rsa\r\nchmod 400 id_rsa\r\nls -al\r\ncd ..\r\nssh opc@vm.ip.add.ress\r\npwd\r\nexit" } ] }