$G$ is cyclic iff $f(H) = H$ for every automorphism $f$ 
Let $(G,\cdot)$ be a finite group, $|G| = n \in \mathbb{N}, n \geq 2$ such that $n$ is not divisible with the cube of any prime number.
Prove that $G$ is cyclic $\iff$ $\forall f \in Aut(G), f(H) = H$, for every subgroup $H$ of $G$.

For the direct implication, I tried assuming the contrary and then try to use the fact that $G = <x>$, but I couldn't solve the problem.
For the inverse implication, using the inner automorphisms, we get that every subgroup $H$ of $G$ is normal. But I don't know how to use the fact that $n$ is not divisible with the cube of any prime number in order to prove that $G$ is cyclic.
 A: One way to do this would be the following: 
"$\Rightarrow$": If $G=\langle x\rangle$ is cyclic of order $n$, it has only one subgroup of order $m$ for every $m\vert n$ (the one generated by $x^{n/m}$). As $\lvert f(H)\rvert =\lvert H\rvert$ for any automorphism $f$, this implies $f(H)=H$ for any $f\in\mathrm{Aut}(G)$ and any subgroup $H\subset G$.
"$\Leftarrow$": Now assume that $f(H)=H$ for any $f\in \mathrm{Aut}(G)$ and any subgroup $H\subset G$. As pointed out by you and in the comments, applying this to the inner automorphisms implies that $G$ is abelian(*). Then, the sturcture theorem on finitely generated abelian groups states that 
$$G\simeq \prod_iG_i,$$
where $G_{i}$ is a $p_i$-group, for pairwise distinct primes $p_i$ (more precisely, it states that the $G_{p_i}$ are direct products of some $\mathbb{Z}_{p_i^k}:=\mathbb{Z}/p_i^k\mathbb{Z}$).
In particular, $\mathrm{Aut}(G)=\prod_i\mathrm{Aut}(G_i)$, as the $G_i$ are of coprime orders, so any $f\in \mathrm{Aut}(G)$ must map $G_i$ on $G_i$.
By hypothesis (that no cube of a prime divides $\lvert G\rvert =n$), the $G_i$ must be of the form 


*

*$G_i\simeq \mathbb{Z}_{p_i}$, or

*$G_i\simeq \mathbb{Z}_{p_i^2}$, or

*$G_i\simeq\mathbb{Z}_{p_i}\times\mathbb{Z}_{p_i}$.


Now, if any of the $G_i$ had form 3., say $G_{i_0}=\mathbb{Z}_{p_{i_0}}\times \mathbb{Z}_{p_{i_0}}=:H_1\times H_2$ for some $i_0$, consider $f:=\prod_i\varphi_i\in\prod_i\mathrm{Aut}(G_i)=\mathrm{Aut}(G)$, where $\varphi_i=\mathrm{Id}_{G_i}$ for any $i\neq i_0$ and $\varphi_{i_0}\in\mathrm{Aut}(G_{i_0})$ is the automorphism switching the two factors $H_1$ and $H_2$ of $G_{i_0}$. Then by construction $f(H_1)=H_2\neq H_1$, contradicting the assumption. So all $G_i$ are of the form 1. or 2., in particular cyclic, so $G$ is cyclic as a direct product of cyclic groups of coprime orders.
(*)  Considering the comments, I feel I should add a few words to this point, for completeness: Assuming $f(H)=H$ for any $f\in\mathrm{Aut}(G)$ and any subgroup $H\subset G$, we want to show that $G$ is ablian, where we know that no cube of a prime divides $G$. As you pointed out, using the assumption for inner automorphisms, it follows that every subgroup of $G$ is normal. Let $p_i$, $i=1,\ldots,r$ be all (distinct) primes dividing $n=\lvert G\rvert$. Let $S_{p_i}$ be the (unique, as they are normal) $p_i$-Sylowsubgroups of $G$. By definition of Sylow-subgroups, $\lvert G\rvert = \prod_i\lvert S_{p_i}\rvert $ and the orders of the $S_{p_i}$ are coprime, in particular, 
$$\tag{1}S_{p_i}\cap S_{p_j}=\{1\}\text{ for }i\neq j.$$ 
As all $S_{p_i}$ are normal, we may build the subgroup $U:=S_{p_1}\cdot\ldots\cdot S_{p_r}\subset G$. By (1), we have an isomorphism 
$$\begin{aligned}
S_{p_1}\times\ldots \times S_{p_r}&\longrightarrow U\\ 
(s_1,\ldots,s_r)&\longmapsto s_1\cdot\ldots\cdot s_r.
\end{aligned}$$
In particular, $U$ is abelian, as $S_{p_i}$ is abelian for any $i$ (because $\lvert S_{p_i}\rvert =p_i^{k_i}$ for some $k_i$ by definition of a $p_i$-Sylowgroup and $k<3$ by the hypothesis that no cube of a prime divides $\lvert G\rvert $, so $S_{p_i}$ is abelian for all $i$ as a group of order either $p_i^2$ or $p_i$), and $\lvert U\rvert =\prod\lvert S_{p_i}\rvert =\lvert G\rvert $, so $U=G$.
