PageRenderTime 22ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/pmd-cli.md

https://gitlab.com/unofficial-mirrors/vmware-photon
Markdown | 486 lines | 406 code | 80 blank | 0 comment | 0 complexity | fc95dc990982407a4a458f956ba031cb MD5 | raw file
  1. # Photon Management Daemon Command-line Interface (pmd-cli)
  2. Photon OS 2.0 provides the Photon Management Daemon command line interface (pmd-cli).
  3. - [Setup Steps](#setup-steps)
  4. - [Syntax](#syntax)
  5. - [Firewall Management](#firewall-management)
  6. - [Network Management](#network-management)
  7. - [Package Management](#package-management)
  8. - [User Management](#user-management)
  9. # Setup Steps
  10. The pmd-cli utility is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run:
  11. ~~~~
  12. tdnf install pmd-cli
  13. ~~~~
  14. # Syntax
  15. ~~~~
  16. pmd-cli [connection_auth_options] <component> <command> [command_options]
  17. ~~~~
  18. Passed-in parameter values can be enclosed in single (&#39;) or double-quotes (&quot;) as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether.
  19. ## Connection / Authorization Options
  20. ### Local Connections
  21. For local connections, you omit the connection and authorization options:
  22. ~~~~
  23. pmd-cli <component> <cmd> <options>
  24. ~~~~
  25. Permissions for the currently logged-in user apply when executing commands. This is the same as specifying --servername localhost.
  26. ### Remote Connections
  27. For connecting to a remote server (a server other than the local server), you specify two connection / authorization options:
  28. - ``--servername``: name of the server
  29. - ``--user``: username of a user account on the server
  30. **Note:** For authentication, you can specify the username (user &lt;username&gt;) on the command line, but never the password. For security reasons, the system must prompt you for the password.
  31. What follows are three options for remote connections.
  32. **System User**
  33. ~~~~
  34. pmd-cli --servername <server> --user <username>
  35. ~~~~
  36. **Lightwave User**
  37. Before using this method, the pmd server must be joined or should be part of embedded Lightwave.
  38. ~~~~
  39. pmd-cli --servername <server> --user <username> --domain <lightwave_domain>
  40. ~~~~
  41. **Kerberos spn**
  42. Before using this method, the client must run kinit successfully.
  43. ~~~~
  44. pmd-cli --servername <server> --spn <service_principal_name>
  45. ~~~~
  46. ## Component
  47. ``<component>`` is one of the following values:
  48. - ``firewall``
  49. - ``net``
  50. - ``pkg``
  51. - ``usr``
  52. # Firewall Management
  53. The Photon Management Daemon provides CLI commands to help you get information about the firewall.
  54. ## Syntax
  55. ~~~~
  56. pmd-cli [connection_auth_options] firewall <command> [command_options]
  57. ~~~~
  58. ## firewall help
  59. Get help for firewall CLI commands.
  60. ~~~~
  61. pmd-cli firewall help
  62. ~~~~
  63. ## firewall rules
  64. Get a list of the current persistent firewall rules.
  65. ~~~~
  66. pmd-cli firewall rules [command-options]
  67. ~~~~
  68. This command returns information about each firewall rule, such as the chain to which it belongs, the policy to enforce, the table to manipulate, and so on.
  69. Add a new firewall rule.
  70. ~~~~
  71. pmd-cli firewall rules --chain <chain_name> --add <rule_specification>
  72. ~~~~
  73. Example:
  74. ~~~~
  75. pmd-cli firewall rules --chain INPUT --add "-p tcp -m tcp --dport 21 -j ACCEPT"
  76. ~~~~
  77. **Note:** To confirm that the firewall rule was added, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
  78. Delete a new firewall rule.
  79. ~~~~
  80. pmd-cli firewall rules --chain <chain_name> --delete <rule_specification>
  81. ~~~~
  82. **Note:** To confirm that the firewall rule was removed, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
  83. Make firewall rule changes peristent (add --persist flag)
  84. ~~~~
  85. pmd-cli firewall rules --chain <chain_name> --add <rule_specification> --persist
  86. ~~~~
  87. ## firewall version
  88. Get the version number of the fwmgmt component on the server.
  89. ~~~~
  90. pmd-cli firewall version
  91. ~~~~
  92. # Network Management
  93. The Photon Management Daemon provides CLI commands to help you manage network interfaces.
  94. ## Syntax
  95. ~~~~
  96. pmd-cli [connection_auth_options] net <command> [command_options]
  97. ~~~~
  98. Many of these commands require the interface name (interface &lt;ifname&gt;). Command options are described below.
  99. ## net link_info
  100. Get the mac address, mtu, link state, and link mode for the specified interface.
  101. ~~~~
  102. pmd-cli net link_info --get --interface <ifname>
  103. ~~~~
  104. Set the MAC address, mode (manual or auto), link state (up or down), link mode (manual or auto), and MTU for the specified interface.
  105. ~~~~
  106. pmd-cli net link_info --set --interface <ifname> --macaddr <mac_address> --mode <manual|auto> --state <up|down> --mtu <mtu>
  107. ~~~~
  108. ## net ip4_address
  109. Get the IPv4 address for the specified interface.
  110. ~~~~
  111. pmd-cli net ip4_address --get --interface <ifname>
  112. ~~~~
  113. Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface.
  114. ~~~~
  115. pmd-cli net ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <IPv4Address/prefix> --gateway <gateway_address>
  116. ~~~~
  117. ## net ip6_address
  118. Get IPv6 address(es) for the specified interface.
  119. ~~~~
  120. pmd-cli net ip6_address --get --interface <ifname>
  121. ~~~~
  122. Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface.
  123. ~~~~
  124. pmd-cli net ip6_address --add --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
  125. ~~~~
  126. Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface.
  127. ~~~~
  128. pmd-cli net ip6_address --del --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
  129. ~~~~
  130. Set the DHCP mode (1=enable, 0=disable) and autoconfigure settings (1=enable, 0=disable) for the specified interface.
  131. ~~~~
  132. pmd-cli net ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0>
  133. ~~~~
  134. ## net ip_route
  135. Get the static IP route for the specified interface.
  136. ~~~~
  137. pmd-cli net ip_route --get --interface <ifname>
  138. ~~~~
  139. Add the static IP route (gateway IP, destination network, and metric) to the specified interface.
  140. ~~~~
  141. pmd-cli net ip_route --add --interface <ifname> --gateway <GatewayIP> --destination <DestinationNetwork/prefix> --metric <N>
  142. ~~~~
  143. Delete the specified static IP route from the specified interface.
  144. ~~~~
  145. pmd-cli net ip_route --del --interface <ifname> --destination <DestinationNetwork/prefix>
  146. ~~~~
  147. ## net dns_servers
  148. Get the list of DNS servers.
  149. ~~~~
  150. pmd-cli net dns_servers --get
  151. ~~~~
  152. Set the DNS mode (dhcp or static) for one or more DNS servers (comma-separated list).
  153. ~~~~
  154. pmd-cli net dns_servers --set --mode <dhcp|static> --servers <server1,server2,...>
  155. ~~~~
  156. Add a DNS server to the list of DNS servers.
  157. ~~~~
  158. pmd-cli net dns_servers --add --servers <server>
  159. ~~~~
  160. Remove the specified DNS server from the list of DNS servers.
  161. ~~~~
  162. pmd-cli net dns_servers --del --servers <server>
  163. ~~~~
  164. ## net dns_domains
  165. Get the list of DNS domains.
  166. ~~~~
  167. pmd-cli net dns_domains --get
  168. ~~~~
  169. Set the list of DNS domains (one or more DNS domains in a comma-separated list).
  170. ~~~~
  171. pmd-cli net dns_domains --set --domains <domain1,domain2,...>
  172. ~~~~
  173. Add a DNS domain to the list of DNS domains.
  174. ~~~~
  175. pmd-cli net dns_domains --add --domains <domain1>
  176. ~~~~
  177. Delete a DNS domain from the list of DNS domains.
  178. ~~~~
  179. pmd-cli net dns_domains --del --domains <domain1>
  180. ~~~~
  181. ## net dhcp_duid
  182. Get the DHCP DUID (optionally interface-specific DUID) for the system.
  183. ~~~~
  184. pmd-cli net dhcp_duid --get
  185. ~~~~
  186. Set the DHCP DUID for the system, optionally per-interface if the interface is specified.
  187. ~~~~
  188. pmd-cli net dhcp_duid --set --duid <duid>
  189. ~~~~
  190. ## net if_iaid
  191. Get the IAID for the specified interface.
  192. ~~~~
  193. pmd-cli net if_iaid --get --interface <ifname>
  194. ~~~~
  195. Set the IAID for the specified interface.
  196. ~~~~
  197. pmd-cli net if_iaid --set --interface <ifname> --iaid <iaid>
  198. ~~~~
  199. ## net ntp_servers
  200. Get the NTP servers list.
  201. ~~~~
  202. pmd-cli net ntp_servers --get
  203. ~~~~
  204. Set the NTP servers list.
  205. ~~~~
  206. pmd-cli net ntp_servers --set --servers <server1,server2,...>
  207. ~~~~
  208. Add the specified server to the NTP servers list.
  209. ~~~~
  210. pmd-cli net ntp_servers --add --servers <server>
  211. ~~~~
  212. Delete the specified server from the NTP servers list.
  213. ~~~~
  214. pmd-cli net ntp_servers --del --servers <server>
  215. ~~~~
  216. ## net hostname
  217. Get the system hostname.
  218. ~~~~
  219. pmd-cli net hostname --get
  220. ~~~~
  221. Set the system hostname.
  222. ~~~~
  223. pmd-cli net hostname --set --name <hostname>
  224. ~~~~
  225. ## net wait_for_link
  226. Wait for the specified network interface to be up and usable (it can send and receive packets).
  227. ~~~~
  228. pmd-cli net wait_for_link --interface <ifname> --timeout <timeout>
  229. ~~~~
  230. The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
  231. **Note:** You might need to use net wait_for_ip to wait until you can send and receive IP packets.
  232. ## net wait_for_ip
  233. Wait for the specified interface to acquire a valid IP address for the specified address type.
  234. ~~~~
  235. pmd-cli net wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6>
  236. ~~~~
  237. The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
  238. ## net error_info
  239. Get error information about the specified error code.
  240. ~~~~
  241. pmd-cli net error_info --errcode <error_code>
  242. ~~~~
  243. Here is a list of error codes:
  244. - 4097 - invalid parameter
  245. - 4098 - not supported
  246. - 4099 - out of memory
  247. - 4100 - value not found
  248. - 4101 - value exists
  249. - 4102 - invalid interface
  250. - 4103 - invalid mode
  251. - 4104 - bad configuration file
  252. - 4105 - write failed
  253. - 4106 - timout
  254. - 4107 - DCHP timeout
  255. ## net net_info
  256. Get the specified network configuration parameter for the specified object.
  257. ~~~~
  258. pmd-cli net net_info --get --object <ifname or filename> --paramname <param_name>
  259. ~~~~
  260. **Note:** The object can be an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf).
  261. Set the value of the specified network configuration parameter for the specified object (interface or file).
  262. ~~~~
  263. pmd-cli net net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value>
  264. ~~~~
  265. **Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -.
  266. # Package Management
  267. The Photon Management Daemon provides CLI commands to help you manage packages and repositories.
  268. ## Syntax
  269. ~~~~
  270. pmd-cli [connection options] pkg <command> [command options]
  271. ~~~~
  272. If a command allows for multiple package names, simply specify on the command line, separated by spaces.
  273. ~~~~
  274. pmd-cli pkg info <package_name_1> <package_name_2> <package_name_3> ...
  275. ~~~~
  276. ## pkg help
  277. Get help text for pkg CLI commands.
  278. ~~~~
  279. pmd-cli pkg help
  280. ~~~~
  281. ## pkg count
  282. Get the total number of packages in all repos (including installed).
  283. ~~~~
  284. pmd-cli pkg count
  285. ~~~~
  286. ## pkg distro-sync
  287. Synchronize installed packages to the latest available versions. If no packages are specified, then all available packages are synchronized.
  288. ~~~~
  289. pmd-cli pkg distro-sync
  290. ~~~~
  291. ## pkg downgrade
  292. Downgrade the specified package(s). If no packages are specified, then all available packages are downgraded.
  293. ~~~~
  294. pmd-cli pkg downgrade <package_name>
  295. ~~~~
  296. ## pkg erase
  297. Remove the specified package(s).
  298. ~~~~
  299. pmd-cli pkg erase <package_name>
  300. ~~~~
  301. ## pkg info
  302. Get general information about the specified package(s), such as name, version, release, repository, install size, and so on.
  303. ~~~~
  304. pmd-cli pkg info <package_name>
  305. ~~~~
  306. If no packages are specified, then this command returns information about all packages.
  307. ~~~~
  308. ## pkg install
  309. ~~~~
  310. Install the specified package(s). Update the package if an update is available.
  311. ~~~~
  312. pmd-cli pkg install <package_name>
  313. ~~~~
  314. ## pkg list
  315. Get a list of packages or groups of packages.
  316. ~~~~
  317. pmd-cli pkg list
  318. ~~~~
  319. You can filter by group: all, available, installed, extras, obsoletes, recent, and upgrades.
  320. ~~~~
  321. pmd-cli pkg list upgrades
  322. ~~~~
  323. You can also filter by wildcards.
  324. ~~~~
  325. pmd-cli pkg list ph\*
  326. ~~~~
  327. ## pkg reinstall
  328. Reinstall the specified package(s).
  329. ~~~~
  330. pmd-cli pkg reinstall <package_name>
  331. ~~~~
  332. ## pkg repolist
  333. Get a list of the configured software repositories.
  334. ~~~~
  335. pmd-cli pkg repolist
  336. ~~~~
  337. This command returns a list of the configured software repositories, including the repository ID, repitory name, and status.
  338. ## pkg update
  339. Update the specified package(s).
  340. ~~~~
  341. pmd-cli pkg update <package_name>
  342. ~~~~
  343. If no parameters are specified, then all available packages are updated.
  344. ## pkg updateinfo
  345. Get the update information on all enabled repositories (status = enabled). If this command returns nothing, then the update information may not exist on the server.
  346. ~~~~
  347. pmd-cli pkg updateinfo
  348. ~~~~
  349. # User Management
  350. The Photon Management Daemon provides CLI commands to help you manage users and user groups.
  351. ## Syntax
  352. ~~~~
  353. pmd-cli [connection options] usr <command> [command options]
  354. ~~~~
  355. ## usr help
  356. Display help text for user commands.
  357. ~~~~
  358. pmd-cli usr users
  359. ~~~~
  360. ## usr users
  361. Get a list of users. This command returns information about each user, including their user name, user ID, user group (if applicable), home directory, and default shell.
  362. ~~~~
  363. pmd-cli usr users
  364. ~~~~
  365. ## usr useradd
  366. Add a new user. Specify the username.
  367. ~~~~
  368. pmd-cli usr useradd <username>
  369. ~~~~
  370. The system assigns a user ID, home directory, and default shell to the new user. The user group is unspecified.
  371. ## usr userdel
  372. Delete the specified user.
  373. ~~~~
  374. pmd-cli usr userdel <username>
  375. ~~~~
  376. ## usr userid
  377. Get the user ID of the specified user (by name). Used to determine whether the specified user exists.
  378. ~~~~
  379. pmd-cli usr userid <username>
  380. ~~~~
  381. ## usr groups
  382. Get a list of user groups. This command returns the following information about each user group: user group name and user group ID.
  383. ~~~~
  384. pmd-cli usr groups
  385. ~~~~
  386. ## usr groupadd
  387. Add a new user group.
  388. ~~~~
  389. pmd-cli usr groupadd <user_group_name>
  390. ~~~~
  391. The system assigns a group ID to the new user group.
  392. ## usr groupdel
  393. Delete the specified user group.
  394. ~~~~
  395. pmd-cli usr groupdel <user_group_name>
  396. ~~~~
  397. ## usr groupid
  398. Get the group ID for the specified user group (by name). Used to determine whether the specified user group exists.
  399. ~~~~
  400. pmd-cli usr groupid <user_group_name>
  401. ~~~~
  402. ## usr version
  403. Get the version of the usermgmt component at the server.
  404. ~~~~
  405. pmd-cli usr version
  406. ~~~~