github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/docs/source/markdown/podman-machine-ssh.1.md (about) 1 % podman-machine-ssh(1) 2 3 ## NAME 4 podman\-machine\-ssh - SSH into a virtual machine 5 6 ## SYNOPSIS 7 **podman machine ssh** [*options*] [*name*] [*command* [*arg* ...]] 8 9 ## DESCRIPTION 10 11 SSH into a Podman-managed virtual machine and optionally execute a command 12 on the virtual machine. Unless using the default virtual machine, the 13 first argument must be the virtual machine name. The optional command to 14 execute can then follow. If no command is provided, an interactive session 15 with the virtual machine is established. 16 17 The exit code from ssh command will be forwarded to the podman machine ssh caller, see [Exit Codes](#Exit-Codes). 18 19 ## OPTIONS 20 21 #### **--help** 22 23 Print usage statement. 24 25 #### **--username**=*name* 26 27 Username to use when SSH-ing into the VM. 28 29 ## Exit Codes 30 31 The exit code from `podman machine ssh` gives information about why the command failed. 32 When `podman machine ssh` commands exit with a non-zero code, 33 the exit codes follow the `chroot` standard, see below: 34 35 **125** The error is with podman **_itself_** 36 37 $ podman machine ssh --foo; echo $? 38 Error: unknown flag: --foo 39 125 40 41 **126** Executing a _contained command_ and the _command_ cannot be invoked 42 43 $ podman machine ssh /etc; echo $? 44 Error: fork/exec /etc: permission denied 45 126 46 47 **127** Executing a _contained command_ and the _command_ cannot be found 48 49 $ podman machine ssh foo; echo $? 50 Error: fork/exec /usr/bin/bogus: no such file or directory 51 127 52 53 **Exit code** _contained command_ exit code 54 55 $ podman machine ssh /bin/sh -c 'exit 3'; echo $? 56 3 57 58 ## EXAMPLES 59 60 To get an interactive session with the default virtual machine: 61 62 ``` 63 $ podman machine ssh 64 ``` 65 66 To get an interactive session with a VM called `myvm`: 67 ``` 68 $ podman machine ssh myvm 69 ``` 70 71 To run a command on the default virtual machine: 72 ``` 73 $ podman machine ssh rpm -q podman 74 ``` 75 76 To run a command on a VM called `myvm`: 77 ``` 78 $ podman machine ssh myvm rpm -q podman 79 ``` 80 81 ## SEE ALSO 82 **[podman(1)](podman.1.md)**, **[podman-machine(1)](podman-machine.1.md)** 83 84 ## HISTORY 85 March 2021, Originally compiled by Ashley Cui <acui@redhat.com>